From 505961be4cb18638fba95bb540b88aa8948b7d18 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 18 Feb 2019 14:31:53 +0100 Subject: [PATCH 1/2] Build in release mode. - Dependency are installed "striped". - Our project are build "debugoptimized" by default and "release" when building release instead of "debug" We need to update the `base_deps_meta_version` as we are changing how dependencies are compiled. --- kiwixbuild/dependencies/base.py | 18 +++++++++++++++++- kiwixbuild/dependencies/icu4c.py | 1 + kiwixbuild/dependencies/kiwix_desktop.py | 2 ++ kiwixbuild/dependencies/pugixml.py | 4 +++- kiwixbuild/dependencies/xapian.py | 1 + kiwixbuild/dependencies/zlib.py | 1 + kiwixbuild/platforms/android.py | 4 ++-- kiwixbuild/platforms/armhf.py | 8 ++++---- kiwixbuild/platforms/ios.py | 4 ++-- kiwixbuild/templates/meson_cross_file.txt | 1 + kiwixbuild/versions.py | 2 +- 11 files changed, 35 insertions(+), 11 deletions(-) diff --git a/kiwixbuild/dependencies/base.py b/kiwixbuild/dependencies/base.py index bc008a2..79d66f2 100644 --- a/kiwixbuild/dependencies/base.py +++ b/kiwixbuild/dependencies/base.py @@ -288,9 +288,14 @@ class MakeBuilder(Builder): configure_script = "configure" configure_env = None make_target = "" - make_install_target = "install" flatpak_buildsystem = None + @property + def make_install_target(self): + if self.buildEnv.platformInfo.build == 'iOS': + return 'install' + return 'install-strip' + @property def all_configure_option(self): option = self.configure_option_template.format( @@ -434,6 +439,14 @@ class MesonBuilder(Builder): test_option = "" flatpak_buildsystem = 'meson' + @property + def build_type(self): + return 'release' if option('make_release') else 'debugoptimized' + + @property + def strip_option(self): + return '--strip' if option('make_release') else '' + @property def library_type(self): return 'static' if self.buildEnv.platformInfo.static else 'shared' @@ -449,6 +462,7 @@ class MesonBuilder(Builder): cross_option = "--cross-file {}".format( self.buildEnv.meson_crossfile) command = ("{command} . {build_path}" + " --buildtype={build_type} {strip_option}" " --default-library={library_type}" " {configure_option}" " --prefix={buildEnv.install_dir}" @@ -456,6 +470,8 @@ class MesonBuilder(Builder): " {cross_option}") command = command.format( command=neutralEnv('meson_command'), + build_type=self.build_type, + strip_option=self.strip_option, library_type=self.library_type, configure_option=configure_option, build_path=self.build_path, diff --git a/kiwixbuild/dependencies/icu4c.py b/kiwixbuild/dependencies/icu4c.py index eee7c2e..e9457f0 100644 --- a/kiwixbuild/dependencies/icu4c.py +++ b/kiwixbuild/dependencies/icu4c.py @@ -23,6 +23,7 @@ class Icu(Dependency): class Builder(MakeBuilder): subsource_dir = "source" + make_install_target = "install" @classmethod def get_dependencies(cls, platformInfo, allDeps): diff --git a/kiwixbuild/dependencies/kiwix_desktop.py b/kiwixbuild/dependencies/kiwix_desktop.py index 3bafc5b..bbe33d2 100644 --- a/kiwixbuild/dependencies/kiwix_desktop.py +++ b/kiwixbuild/dependencies/kiwix_desktop.py @@ -12,6 +12,8 @@ class KiwixDesktop(Dependency): class Builder(QMakeBuilder): dependencies = ["qt", "qtwebengine", "kiwix-lib", "aria2"] + make_install_target = 'install' + @property def configure_option(self): if self.buildEnv.platformInfo.name == 'flatpak': diff --git a/kiwixbuild/dependencies/pugixml.py b/kiwixbuild/dependencies/pugixml.py index 57904ae..a8310b0 100644 --- a/kiwixbuild/dependencies/pugixml.py +++ b/kiwixbuild/dependencies/pugixml.py @@ -14,4 +14,6 @@ class Pugixml(Dependency): patches = ["pugixml_meson.patch"] flatpak_dest = "src" - Builder = MesonBuilder + class Builder(MesonBuilder): + build_type = 'release' + strip_option = '' diff --git a/kiwixbuild/dependencies/xapian.py b/kiwixbuild/dependencies/xapian.py index e70a7ad..5d0a70a 100644 --- a/kiwixbuild/dependencies/xapian.py +++ b/kiwixbuild/dependencies/xapian.py @@ -24,6 +24,7 @@ class Xapian(Dependency): configure_env = {'_format_LDFLAGS': "{env.LDFLAGS} -L{buildEnv.install_dir}/{buildEnv.libprefix}", '_format_CXXFLAGS': "{env.CXXFLAGS} -I{buildEnv.install_dir}/include"} + @classmethod def get_dependencies(cls, platformInfo, allDeps): deps = ['zlib', 'lzma'] diff --git a/kiwixbuild/dependencies/zlib.py b/kiwixbuild/dependencies/zlib.py index babc294..3950e46 100644 --- a/kiwixbuild/dependencies/zlib.py +++ b/kiwixbuild/dependencies/zlib.py @@ -20,6 +20,7 @@ class zlib(Dependency): class Builder(MakeBuilder): dynamic_configure_option = "--shared" static_configure_option = "--static" + make_install_target = 'install' configure_option_template = "{dep_options} {static_option} --prefix {install_dir} --libdir {libdir}" def _pre_build_script(self, context): diff --git a/kiwixbuild/platforms/android.py b/kiwixbuild/platforms/android.py index a8c6c6a..5777b29 100644 --- a/kiwixbuild/platforms/android.py +++ b/kiwixbuild/platforms/android.py @@ -66,8 +66,8 @@ class AndroidPlatformInfo(PlatformInfo): def set_compiler(self, env): binaries = self.binaries(self.ndk_builder.install_path) - env['CC'] = binaries['CC'] - env['CXX'] = binaries['CXX'] + for k,v in binaries.items(): + env[k] = v @property def configure_option(self): diff --git a/kiwixbuild/platforms/armhf.py b/kiwixbuild/platforms/armhf.py index 3d4eb60..98a1645 100644 --- a/kiwixbuild/platforms/armhf.py +++ b/kiwixbuild/platforms/armhf.py @@ -69,8 +69,8 @@ class ArmhfPlatformInfo(PlatformInfo): def set_env(self, env): env['PKG_CONFIG_LIBDIR'] = pj(self.root_path, 'lib', 'pkgconfig') - env['CFLAGS'] = " -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 "+env['CFLAGS'] - env['CXXFLAGS'] = " -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 "+env['CXXFLAGS'] + env['CFLAGS'] = " -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 "+env['CFLAGS'] + env['CXXFLAGS'] = " -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 "+env['CXXFLAGS'] env['QEMU_LD_PREFIX'] = pj(self.root_path, "arm-linux-gnueabihf", "libc") env['QEMU_SET_ENV'] = "LD_LIBRARY_PATH={}".format( ':'.join([ @@ -79,8 +79,8 @@ class ArmhfPlatformInfo(PlatformInfo): ])) def set_compiler(self, env): - env['CC'] = self.binaries['CC'] - env['CXX'] = self.binaries['CXX'] + for k, v in self.binaries.items(): + env[k] = v def finalize_setup(self): super().finalize_setup() diff --git a/kiwixbuild/platforms/ios.py b/kiwixbuild/platforms/ios.py index f1ac81d..933eb06 100644 --- a/kiwixbuild/platforms/ios.py +++ b/kiwixbuild/platforms/ios.py @@ -71,8 +71,8 @@ class iOSPlatformInfo(PlatformInfo): return '--host={}'.format(self.arch_full) def set_compiler(self, env): - env['CC'] = self.binaries['CC'] - env['CXX'] = self.binaries['CXX'] + for k,v in self.binaries.items(): + env[k] = v class iOSArmv7(iOSPlatformInfo): diff --git a/kiwixbuild/templates/meson_cross_file.txt b/kiwixbuild/templates/meson_cross_file.txt index eef32f1..cb226f4 100644 --- a/kiwixbuild/templates/meson_cross_file.txt +++ b/kiwixbuild/templates/meson_cross_file.txt @@ -4,6 +4,7 @@ c = '{binaries[CC]}' ar = '{binaries[AR]}' cpp = '{binaries[CXX]}' strip = '{binaries[STRIP]}' +ranlib = '{binaries[RANLIB]}' {exec_wrapper_def} [properties] diff --git a/kiwixbuild/versions.py b/kiwixbuild/versions.py index 30c87ab..4e6681c 100644 --- a/kiwixbuild/versions.py +++ b/kiwixbuild/versions.py @@ -35,7 +35,7 @@ release_versions = { # This is the "version" of the whole base_deps_versions dict. # Change this when you change base_deps_versions. -base_deps_meta_version = '16' +base_deps_meta_version = '17' base_deps_versions = { From 03c2c2608976387532560b60cb5976363c3378e2 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 19 Feb 2019 14:21:12 +0100 Subject: [PATCH 2/2] Add LOGS dir to the dependencies archives. This will help to debug. --- travis/compile_all.py | 1 + 1 file changed, 1 insertion(+) diff --git a/travis/compile_all.py b/travis/compile_all.py index f021f3a..ca5ec22 100755 --- a/travis/compile_all.py +++ b/travis/compile_all.py @@ -196,6 +196,7 @@ def make_deps_archive(target, full=False): TRAVIS_OS_NAME, PLATFORM, target) print_message("Create archive {}.", archive_name) files_to_archive = [INSTALL_DIR] + files_to_archive += HOME.glob('BUILD_*/LOGS') if PLATFORM == 'native_mixed': files_to_archive += [HOME/'BUILD_native_static'/'INSTALL'] if PLATFORM.startswith('android'):