diff --git a/dependencies.py b/dependencies.py index 43c6b93..ee80e46 100644 --- a/dependencies.py +++ b/dependencies.py @@ -34,11 +34,43 @@ class zlib(Dependency): '36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d') patches = ['zlib_std_libname.patch'] - class Builder(CMakeBuilder): + class Builder(MakeBuilder): + dynamic_configure_option = "--shared" + static_configure_option = "--static" + + def _pre_build_script(self, context): + context.try_skip(self.build_path) + shutil.copytree(self.source_path, self.build_path) + + @property + def all_configure_option(self): + return '--static' if self.buildEnv.build_static else '--shared' + @property def configure_option(self): - return "-DINSTALL_PKGCONFIG_DIR={}".format(pj(self.buildEnv.install_dir, self.buildEnv.libprefix, 'pkgconfig')) + options = "-DINSTALL_PKGCONFIG_DIR={}".format(pj(self.buildEnv.install_dir, self.buildEnv.libprefix, 'pkgconfig')) + if self.buildEnv.build_static: + options += " -DBUILD_SHARED_LIBS=false" + else: + options += " -DBUILD_SHARED_LIBS=true" + return options + def _configure(self, context): + if self.buildEnv.target_info.build == 'win32': + raise SkipCommand() + return super()._configure(context) + + @property + def make_option(self): + if self.buildEnv.target_info.build == 'win32': + return "--makefile win32/Makefile.gcc PREFIX={host}- SHARED_MODE={static} INCLUDE_PATH={include_path} LIBRARY_PATH={library_path} BINARY_PATH={binary_path}".format( + host='i686-w64-mingw32', + static="0" if self.buildEnv.target_info.static else "1", + include_path=pj(self.buildEnv.install_dir, 'include'), + library_path=pj(self.buildEnv.install_dir, self.buildEnv.libprefix), + binary_path=pj(self.buildEnv.install_dir, 'bin'), + ) + return "" class lzma(Dependency): name = 'lzma'