diff --git a/aedi/target/__init__.py b/aedi/target/__init__.py index 7f77e21e..8a3736b5 100644 --- a/aedi/target/__init__.py +++ b/aedi/target/__init__.py @@ -84,6 +84,7 @@ def targets(): Sdl2NetTarget(), Sdl2TtfTarget(), SodiumTarget(), + TiffTarget(), WebpTarget(), ZstdTarget(), diff --git a/aedi/target/library_tier2.py b/aedi/target/library_tier2.py index 2628c57d..0bd06e81 100644 --- a/aedi/target/library_tier2.py +++ b/aedi/target/library_tier2.py @@ -386,6 +386,39 @@ class SodiumTarget(ConfigureMakeStaticDependencyTarget): return os.path.exists(state.source + 'libsodium.pc.in') +class TiffTarget(CMakeStaticDependencyTarget): + def __init__(self, name='tiff'): + super().__init__(name) + + opts = self.options + opts['cxx'] = 'NO' + opts['lzma'] = 'YES' + + def prepare_source(self, state: BuildState): + state.download_source( + 'https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz', + '0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8', + patches='tiff-remove-useless') + + def detect(self, state: BuildState) -> bool: + return os.path.exists(state.source + 'libtiff-4.pc.in') + + @staticmethod + def _process_pkg_config(pcfile: str, line: str) -> str: + version = 'Version:' + cflags = 'Cflags:' + libs = 'Libs:' + + if line.startswith(version): + return version + ' 4.3.0\n' + elif line.startswith(cflags): + return cflags + ' -I${includedir}\nRequires.private: libjpeg liblzma libwebp libzstd zlib\n' + elif line.startswith(libs): + return libs + ' -L${libdir} -ltiff\n' + + return line + + class WebpTarget(CMakeStaticDependencyTarget): def __init__(self, name='webp'): super().__init__(name)