From 82243ffea734b419f497f41c02f69ee8618ffb40 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 1 Aug 2021 13:16:14 +0300 Subject: [PATCH] aedi: add brotli target --- aedi/target/__init__.py | 1 + aedi/target/library_tier2.py | 25 +++++++++++++++++++++++++ deps/.gitignore | 1 + 3 files changed, 27 insertions(+) diff --git a/aedi/target/__init__.py b/aedi/target/__init__.py index 1051f47b..d91885bc 100644 --- a/aedi/target/__init__.py +++ b/aedi/target/__init__.py @@ -67,6 +67,7 @@ def targets(): ZMusicTarget(), # Libraries needed for other targets + BrotliTarget(), DumbTarget(), ExpatTarget(), FmtTarget(), diff --git a/aedi/target/library_tier2.py b/aedi/target/library_tier2.py index 71cb5900..be992f48 100644 --- a/aedi/target/library_tier2.py +++ b/aedi/target/library_tier2.py @@ -16,10 +16,35 @@ # along with this program. If not, see . # +import glob + from .base import * from ..state import BuildState +class BrotliTarget(CMakeStaticDependencyTarget): + def __init__(self, name='brotli'): + super().__init__(name) + + def prepare_source(self, state: BuildState): + state.download_source( + 'https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz', + 'f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46') + + def post_build(self, state: BuildState): + super().post_build(state) + + dylib_pattern = str(state.install_path / 'lib/*.dylib') + for dylib in glob.iglob(dylib_pattern): + os.unlink(dylib) + + archive_suffix = '-static.a' + archive_pattern = str(state.install_path / f'lib/*{archive_suffix}') + for archive in glob.iglob(archive_pattern): + no_suffix_name = archive.replace(archive_suffix, '.a') + os.rename(archive, no_suffix_name) + + class DumbTarget(CMakeStaticDependencyTarget): def __init__(self, name='dumb'): super().__init__(name) diff --git a/deps/.gitignore b/deps/.gitignore index af89bcc7..feb70b7f 100644 --- a/deps/.gitignore +++ b/deps/.gitignore @@ -40,6 +40,7 @@ /sndfile/include/sndfile.hh # Libraries, tier 2 +/brotli/bin/ /freetype/lib/cmake/ /lua/bin/ /lua/man/