Simplify cross-compilation
Now we can make reference to build step in another target platform, we can simplify cross-compilation fo libmagic and icu4c.
This commit is contained in:
parent
a87ba06bf3
commit
c8c0192675
|
@ -12,13 +12,9 @@ class AllBaseDependencies(Dependency):
|
||||||
class Builder(NoopBuilder):
|
class Builder(NoopBuilder):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_dependencies(cls, platformInfo):
|
def get_dependencies(cls, platformInfo):
|
||||||
base_deps = ['zlib', 'lzma', 'xapian-core', 'gumbo', 'pugixml', 'libmicrohttpd', 'libaria2']
|
base_deps = ['zlib', 'lzma', 'xapian-core', 'gumbo', 'pugixml', 'libmicrohttpd', 'libaria2', 'icu4c']
|
||||||
if platformInfo.build != 'native':
|
|
||||||
base_deps += ["icu4c_cross-compile"]
|
|
||||||
if platformInfo.build != 'win32':
|
if platformInfo.build != 'win32':
|
||||||
base_deps += ["libmagic_cross-compile"]
|
base_deps += ["libmagic"]
|
||||||
else:
|
|
||||||
base_deps += ["icu4c", "libmagic"]
|
|
||||||
if (platformInfo.build != 'android' and
|
if (platformInfo.build != 'android' and
|
||||||
neutralEnv('distname') != 'Darwin'):
|
neutralEnv('distname') != 'Darwin'):
|
||||||
base_deps += ['ctpp2c', 'ctpp2']
|
base_deps += ['ctpp2c', 'ctpp2']
|
||||||
|
|
|
@ -25,36 +25,21 @@ class Icu(Dependency):
|
||||||
class Builder(MakeBuilder):
|
class Builder(MakeBuilder):
|
||||||
subsource_dir = "source"
|
subsource_dir = "source"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_dependencies(cls, platformInfo):
|
||||||
|
plt = 'native_static' if platformInfo.static else 'native_dyn'
|
||||||
|
return [(plt, 'icu4c')]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
options = "--disable-samples --disable-tests --disable-extras --disable-dyload --enable-rpath"
|
options = "--disable-samples --disable-tests --disable-extras --disable-dyload --enable-rpath"
|
||||||
if self.buildEnv.platformInfo.build == 'android':
|
platformInfo = self.buildEnv.platformInfo
|
||||||
|
if platformInfo.build != 'native':
|
||||||
|
icu_native_builder = get_target_step(
|
||||||
|
'icu4c',
|
||||||
|
'native_static' if platformInfo.static else 'native_dyn')
|
||||||
|
options += " --with-cross-build={} --disable-tools".format(
|
||||||
|
icu_native_builder.build_path)
|
||||||
|
if platformInfo.build == 'android':
|
||||||
options += " --with-data-packaging=archive"
|
options += " --with-data-packaging=archive"
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
class Icu_native(Icu):
|
|
||||||
name = "icu4c_native"
|
|
||||||
force_native_build = True
|
|
||||||
|
|
||||||
class Builder(Icu.Builder):
|
|
||||||
@property
|
|
||||||
def build_path(self):
|
|
||||||
return super().build_path+"_native"
|
|
||||||
|
|
||||||
def _install(self, context):
|
|
||||||
raise SkipCommand()
|
|
||||||
|
|
||||||
|
|
||||||
class Icu_cross_compile(Icu):
|
|
||||||
name = "icu4c_cross-compile"
|
|
||||||
|
|
||||||
class Builder(Icu.Builder):
|
|
||||||
dependencies = ['icu4c_native']
|
|
||||||
|
|
||||||
@property
|
|
||||||
def configure_option(self):
|
|
||||||
icu_native_builder = get_target_step('icu4c_native', self.buildEnv.platformInfo.name)
|
|
||||||
return (super().configure_option
|
|
||||||
+ " --with-cross-build={} --disable-tools"
|
|
||||||
).format(icu_native_builder.build_path)
|
|
||||||
|
|
|
@ -14,14 +14,11 @@ class Kiwixlib(Dependency):
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_dependencies(cls, platformInfo):
|
def get_dependencies(cls, platformInfo):
|
||||||
base_dependencies = ["pugixml", "libzim", "zlib", "lzma", "libaria2"]
|
base_dependencies = ["pugixml", "libzim", "zlib", "lzma", "libaria2", "icu4c"]
|
||||||
if (platformInfo.build != 'android' and
|
if (platformInfo.build != 'android' and
|
||||||
neutralEnv('distname') != 'Darwin'):
|
neutralEnv('distname') != 'Darwin'):
|
||||||
base_dependencies += ['ctpp2c', 'ctpp2']
|
base_dependencies += ['ctpp2c', 'ctpp2']
|
||||||
if platformInfo.build != 'native':
|
return base_dependencies
|
||||||
return base_dependencies + ["icu4c_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c"]
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -6,10 +6,10 @@ from .base import (
|
||||||
MakeBuilder,
|
MakeBuilder,
|
||||||
)
|
)
|
||||||
|
|
||||||
from kiwixbuild.utils import Remotefile, pj, Defaultdict, SkipCommand
|
from kiwixbuild.utils import Remotefile, pj, Defaultdict, SkipCommand, run_command
|
||||||
from kiwixbuild._global import get_target_step
|
from kiwixbuild._global import get_target_step
|
||||||
|
|
||||||
class LibMagicBase(Dependency):
|
class LibMagic(Dependency):
|
||||||
name = "libmagic"
|
name = "libmagic"
|
||||||
|
|
||||||
class Source(ReleaseDownload):
|
class Source(ReleaseDownload):
|
||||||
|
@ -19,37 +19,24 @@ class LibMagicBase(Dependency):
|
||||||
'1c52c8c3d271cd898d5511c36a68059cda94036111ab293f01f83c3525b737c6',
|
'1c52c8c3d271cd898d5511c36a68059cda94036111ab293f01f83c3525b737c6',
|
||||||
'https://fossies.org/linux/misc/file-5.33.tar.gz')
|
'https://fossies.org/linux/misc/file-5.33.tar.gz')
|
||||||
|
|
||||||
Builder = MakeBuilder
|
class Builder(MakeBuilder):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
class LibMagic_native(LibMagicBase):
|
def get_dependencies(cls, platformInfo):
|
||||||
name = "libmagic_native"
|
if platformInfo.build != 'native':
|
||||||
force_native_build = True
|
return [('native_static', 'libmagic')]
|
||||||
|
return []
|
||||||
class Builder(LibMagicBase.Builder):
|
|
||||||
static_configure_option = dynamic_configure_option = "--disable-shared --enable-static"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def build_path(self):
|
|
||||||
return super().build_path+"_native"
|
|
||||||
|
|
||||||
def _install(self, context):
|
|
||||||
raise SkipCommand()
|
|
||||||
|
|
||||||
|
|
||||||
class LibMagic_cross_compile(LibMagicBase):
|
|
||||||
name = "libmagic_cross-compile"
|
|
||||||
|
|
||||||
class Builder(LibMagicBase.Builder):
|
|
||||||
dependencies = ['libmagic_native']
|
|
||||||
|
|
||||||
def _compile(self, context):
|
def _compile(self, context):
|
||||||
|
platformInfo = self.buildEnv.platformInfo
|
||||||
|
if platformInfo.build == 'native':
|
||||||
|
return super()._compile(context)
|
||||||
context.try_skip(self.build_path)
|
context.try_skip(self.build_path)
|
||||||
command = "make -j4 {make_target} {make_option}".format(
|
command = "make -j4 {make_target} {make_option}".format(
|
||||||
make_target=self.make_target,
|
make_target=self.make_target,
|
||||||
make_option=self.make_option
|
make_option=self.make_option
|
||||||
)
|
)
|
||||||
libmagic_native_builder = get_target_step('libmagic_native', self.buildEnv.platformInfo.name)
|
libmagic_native_builder = get_target_step('libmagic', 'native_static')
|
||||||
env = Defaultdict(str, os.environ)
|
env = Defaultdict(str, os.environ)
|
||||||
env['PATH'] = ':'.join([pj(libmagic_native_builder.build_path, 'src'), env['PATH']])
|
env['PATH'] = ':'.join([pj(libmagic_native_builder.build_path, 'src'), env['PATH']])
|
||||||
self.buildEnv.run_command(command, self.build_path, context, env=env)
|
run_command(command, self.build_path, context, buildEnv=self.buildEnv, env=env)
|
||||||
|
|
|
@ -12,11 +12,4 @@ class Libzim(Dependency):
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
test_option = "-t 8"
|
test_option = "-t 8"
|
||||||
|
dependencies = ['zlib', 'lzma', 'xapian-core', 'icu4c']
|
||||||
@classmethod
|
|
||||||
def get_dependencies(cls, platformInfo):
|
|
||||||
base_dependencies = ['zlib', 'lzma', 'xapian-core']
|
|
||||||
if platformInfo.build != 'native':
|
|
||||||
return base_dependencies + ["icu4c_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c"]
|
|
||||||
|
|
|
@ -12,13 +12,7 @@ class Zimwriterfs(Dependency):
|
||||||
release_git_ref = "1.1"
|
release_git_ref = "1.1"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
@classmethod
|
dependencies = ['libzim', 'zlib', 'xapian-core', 'gumbo', 'icu4c', 'libmagic']
|
||||||
def get_dependencies(cls, platformInfo):
|
|
||||||
base_dependencies = ['libzim', 'zlib', 'xapian-core', 'gumbo']
|
|
||||||
if platformInfo.build != 'native':
|
|
||||||
return base_dependencies + ["icu4c_cross-compile", "libmagic_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c", "libmagic"]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
|
|
Loading…
Reference in New Issue