Correctly build Icu when cross-compiling.

When cross-compiling, icu need to be build two times :
- Once in 'native' mode.
- Once cross-compiling.

This is needed as the cross-compiling need to launch executable that are
build in the first step.

Icu dependency become a bit more complex as the second compilation needs to
reference the first compilation and that configure options and buildEnv
change.
This commit is contained in:
Matthieu Gautier 2017-01-17 11:35:26 +01:00 committed by Matthieu Gautier
parent 4089928ed6
commit a8c4bff709
1 changed files with 31 additions and 3 deletions

View File

@ -76,6 +76,7 @@ def command(name):
except: except:
print("ERROR") print("ERROR")
raise raise
wrapper._wrapped = function
return wrapper return wrapper
return decorator return decorator
@ -567,10 +568,27 @@ class Icu(Dependency, ReleaseDownloadMixin, MakeMixin):
) )
data = Remotefile('icudt56l.dat', data = Remotefile('icudt56l.dat',
'e23d85eee008f335fc49e8ef37b1bc2b222db105476111e3d16f0007d371cbca') 'e23d85eee008f335fc49e8ef37b1bc2b222db105476111e3d16f0007d371cbca')
configure_option = "Linux --disable-samples --disable-tests --disable-extras --enable-static --disable-dyload" configure_option = "--disable-samples --disable-tests --disable-extras --enable-static --disable-dyload"
configure_script = "runConfigureICU"
subsource_dir = "source" subsource_dir = "source"
def __init__(self, buildEnv, cross_compile_process=False, cross_build=None):
Dependency.__init__(self, buildEnv)
self.cross_compile_process = cross_compile_process
self.cross_build = cross_build
@property
def build_path(self):
if self.cross_compile_process and not self.cross_build:
return pj(self.buildEnv.build_dir, self.source_dir+"_native")
return pj(self.buildEnv.build_dir, self.source_dir)
@property
def configure_option(self):
default_configure_option = "--disable-samples --disable-tests --disable-extras --enable-static --disable-dyload"
if self.cross_build:
return default_configure_option + " --with-cross-build=" + self.cross_build.build_path
return default_configure_option
@command("download_data") @command("download_data")
def _download_data(self, context): def _download_data(self, context):
self.buildEnv.download(self.data) self.buildEnv.download(self.data)
@ -580,6 +598,12 @@ class Icu(Dependency, ReleaseDownloadMixin, MakeMixin):
context.try_skip(self.source_path) context.try_skip(self.source_path)
shutil.copyfile(pj(self.buildEnv.archive_dir, self.data.name), pj(self.source_path, 'data', 'in', self.data.name)) shutil.copyfile(pj(self.buildEnv.archive_dir, self.data.name), pj(self.source_path, 'data', 'in', self.data.name))
@command("install")
def _install(self, context):
if self.cross_compile_process and not self.cross_build:
raise SkipCommand()
return super()._install._wrapped(self, context)
def prepare(self): def prepare(self):
super().prepare() super().prepare()
self._download_data() self._download_data()
@ -613,13 +637,17 @@ class Builder:
def __init__(self, buildEnv): def __init__(self, buildEnv):
self.buildEnv = buildEnv self.buildEnv = buildEnv
if buildEnv.build_target != 'native': if buildEnv.build_target != 'native':
subBuildEnv = BuildEnv(buildEnv.options)
subBuildEnv.setup_build_target('native')
nativeICU = Icu(subBuildEnv, True)
self.dependencies = [ self.dependencies = [
Xapian(buildEnv), Xapian(buildEnv),
CTPP2(buildEnv), CTPP2(buildEnv),
Pugixml(buildEnv), Pugixml(buildEnv),
Zimlib(buildEnv), Zimlib(buildEnv),
MicroHttpd(buildEnv), MicroHttpd(buildEnv),
Icu(buildENv), nativeICU,
Icu(buildEnv, True, nativeICU),
Kiwixlib(buildEnv), Kiwixlib(buildEnv),
KiwixTools(buildEnv) KiwixTools(buildEnv)
] ]