From 219977a7082d7e821ab5d6ba730f26f26e12e091 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 29 Nov 2020 12:01:31 +0200 Subject: [PATCH] build script: add ogg target --- .gitignore | 4 ++++ build.py | 35 ++++++++++++++++++++++++++++++++++- source/ogg.patch | 30 ++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 source/ogg.patch diff --git a/.gitignore b/.gitignore index ce8704ea..279c0aaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /.idea/ /build/ /prefix/ + +deps/*/share +*.la +*.pc diff --git a/build.py b/build.py index 61b323cf..b67598a8 100755 --- a/build.py +++ b/build.py @@ -551,6 +551,35 @@ class QuakespasmTarget(MakeTarget): 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 # 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.include_path = self.prefix_path + 'include' + 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) @@ -645,7 +675,7 @@ class Builder(object): if 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: assert arguments.source_path self.source_path = arguments.source_path @@ -729,6 +759,9 @@ class Builder(object): Doom64EXTarget(), DevilutionXTarget(), QuakespasmTarget(), + + # Dependencies + OggTarget(), ) self.targets = CaseInsensitiveDict({target.name: target for target in targets}) diff --git a/source/ogg.patch b/source/ogg.patch new file mode 100644 index 00000000..bc46bc3e --- /dev/null +++ b/source/ogg.patch @@ -0,0 +1,30 @@ +From c8fca6b4a02d695b1ceea39b330d4406001c03ed Mon Sep 17 00:00:00 2001 +From: Tristan Matthews +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 + 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__) +