Merge pull request #296 from kiwix/release_build

Build in release mode.
This commit is contained in:
Matthieu Gautier 2019-02-20 09:39:47 +01:00 committed by GitHub
commit f296f59a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 36 additions and 11 deletions

View File

@ -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,

View File

@ -23,6 +23,7 @@ class Icu(Dependency):
class Builder(MakeBuilder):
subsource_dir = "source"
make_install_target = "install"
@classmethod
def get_dependencies(cls, platformInfo, allDeps):

View File

@ -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':

View File

@ -14,4 +14,6 @@ class Pugixml(Dependency):
patches = ["pugixml_meson.patch"]
flatpak_dest = "src"
Builder = MesonBuilder
class Builder(MesonBuilder):
build_type = 'release'
strip_option = ''

View File

@ -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']

View File

@ -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):

View File

@ -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):

View File

@ -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()

View File

@ -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):

View File

@ -4,6 +4,7 @@ c = '{binaries[CC]}'
ar = '{binaries[AR]}'
cpp = '{binaries[CXX]}'
strip = '{binaries[STRIP]}'
ranlib = '{binaries[RANLIB]}'
{exec_wrapper_def}
[properties]

View File

@ -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 = {

View File

@ -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'):