build script: add ogg target

This commit is contained in:
alexey.lysiuk 2020-11-29 12:01:31 +02:00
parent cfc1052495
commit 219977a708
3 changed files with 68 additions and 1 deletions

4
.gitignore vendored
View file

@ -1,3 +1,7 @@
/.idea/ /.idea/
/build/ /build/
/prefix/ /prefix/
deps/*/share
*.la
*.pc

View file

@ -551,6 +551,35 @@ class QuakespasmTarget(MakeTarget):
self.options[ldflags] = self.environment[ldflags] self.options[ldflags] = self.environment[ldflags]
class OggTarget(ConfigureMakeTarget):
def __init__(self, name='ogg'):
super().__init__(name)
def prepare_source(self, builder: 'Builder'):
builder.download_source(
'https://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.gz',
'fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e')
test_arg = '--dry-run'
os_types_path = builder.source_path + 'include/ogg/os_types.h'
patch_path = builder.root_source_path + 'ogg.patch'
args = ['patch', test_arg, os_types_path, patch_path]
if subprocess.call(args) == 0:
args.remove(test_arg)
subprocess.check_call(args)
def initialize(self, builder: 'Builder'):
super().initialize(builder)
self.options['--enable-shared'] = 'no'
def detect(self, builder: 'Builder') -> bool:
return os.path.exists(builder.source_path + 'ogg.pc.in')
def post_build(self, builder: 'Builder'):
self.install(builder)
# Case insensitive dictionary class from # Case insensitive dictionary class from
# https://github.com/psf/requests/blob/v2.25.0/requests/structures.py # https://github.com/psf/requests/blob/v2.25.0/requests/structures.py
@ -633,6 +662,7 @@ class Builder(object):
self.bin_path = self.prefix_path + 'bin' + os.sep self.bin_path = self.prefix_path + 'bin' + os.sep
self.include_path = self.prefix_path + 'include' + os.sep self.include_path = self.prefix_path + 'include' + os.sep
self.lib_path = self.prefix_path + 'lib' + os.sep self.lib_path = self.prefix_path + 'lib' + os.sep
self.root_source_path = self.root_path + 'source' + os.sep
arguments = self._parse_arguments(args) arguments = self._parse_arguments(args)
@ -645,7 +675,7 @@ class Builder(object):
if arguments.target: if arguments.target:
self.target = self.targets[arguments.target] self.target = self.targets[arguments.target]
self.source_path = self.root_path + 'source' + os.sep + self.target.name self.source_path = self.root_source_path + self.target.name
else: else:
assert arguments.source_path assert arguments.source_path
self.source_path = arguments.source_path self.source_path = arguments.source_path
@ -729,6 +759,9 @@ class Builder(object):
Doom64EXTarget(), Doom64EXTarget(),
DevilutionXTarget(), DevilutionXTarget(),
QuakespasmTarget(), QuakespasmTarget(),
# Dependencies
OggTarget(),
) )
self.targets = CaseInsensitiveDict({target.name: target for target in targets}) self.targets = CaseInsensitiveDict({target.name: target for target in targets})

30
source/ogg.patch Normal file
View file

@ -0,0 +1,30 @@
From c8fca6b4a02d695b1ceea39b330d4406001c03ed Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tmatth@videolan.org>
Date: Sat, 7 Sep 2019 00:46:59 -0400
Subject: [PATCH] os_types: fix unsigned typedefs for MacOS
This effectively reverts f8ce071e1040c766157d630d920d6165d35fe422 which was
probably broken by 6449883ccacfee276ed9d99fa047342cdc51ab88.
---
include/ogg/os_types.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h
index eb8a32298916613f02a34e89f1174c9692521581..e655a1d6280dcd2839665929d899b84fc63f149f 100644
--- a/include/ogg/os_types.h
+++ b/include/ogg/os_types.h
@@ -72,11 +72,11 @@
# include <sys/types.h>
typedef int16_t ogg_int16_t;
- typedef uint16_t ogg_uint16_t;
+ typedef u_int16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
- typedef uint32_t ogg_uint32_t;
+ typedef u_int32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
- typedef uint64_t ogg_uint64_t;
+ typedef u_int64_t ogg_uint64_t;
#elif defined(__HAIKU__)