Move dependencies declaration of a target into the builder.
This is the builder that depends on other target, not the target itself.
This commit is contained in:
parent
7e0b403ccc
commit
115fbfa147
|
@ -32,12 +32,12 @@ class Builder:
|
||||||
targetClass = Dependency.all_deps[targetName]
|
targetClass = Dependency.all_deps[targetName]
|
||||||
target = targetClass(self.buildEnv)
|
target = targetClass(self.buildEnv)
|
||||||
targets[targetName] = target
|
targets[targetName] = target
|
||||||
for dep in target.dependencies:
|
for dep in target.builder.get_dependencies(self.platform):
|
||||||
self.add_targets(dep, targets)
|
self.add_targets(dep, targets)
|
||||||
|
|
||||||
def order_dependencies(self, _targets, targetName):
|
def order_dependencies(self, _targets, targetName):
|
||||||
target = _targets[targetName]
|
target = _targets[targetName]
|
||||||
for depName in target.dependencies:
|
for depName in target.builder.dependencies(self.platform):
|
||||||
yield from self.order_dependencies(_targets, depName)
|
yield from self.order_dependencies(_targets, depName)
|
||||||
yield targetName
|
yield targetName
|
||||||
|
|
||||||
|
|
|
@ -8,23 +8,21 @@ from kiwixbuild._global import neutralEnv
|
||||||
class AllBaseDependencies(Dependency):
|
class AllBaseDependencies(Dependency):
|
||||||
name = "alldependencies"
|
name = "alldependencies"
|
||||||
|
|
||||||
@property
|
Source = NoopSource
|
||||||
def dependencies(self):
|
class Builder(NoopBuilder):
|
||||||
|
@classmethod
|
||||||
|
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']
|
||||||
if self.buildEnv.platform_info.build != 'native':
|
if platformInfo.build != 'native':
|
||||||
base_deps += ["icu4c_cross-compile"]
|
base_deps += ["icu4c_cross-compile"]
|
||||||
if self.buildEnv.platform_info.build != 'win32':
|
if platformInfo.build != 'win32':
|
||||||
base_deps += ["libmagic_cross-compile"]
|
base_deps += ["libmagic_cross-compile"]
|
||||||
else:
|
else:
|
||||||
base_deps += ["icu4c", "libmagic"]
|
base_deps += ["icu4c", "libmagic"]
|
||||||
if ( self.buildEnv.platform_info.build != 'android'
|
if (platformInfo.build != 'android' and
|
||||||
and neutralEnv('distname') != 'Darwin'):
|
neutralEnv('distname') != 'Darwin'):
|
||||||
base_deps += ['ctpp2c', 'ctpp2']
|
base_deps += ['ctpp2c', 'ctpp2']
|
||||||
if self.buildEnv.platform_info.build == 'android':
|
if platformInfo.build == 'android':
|
||||||
base_deps += ['Gradle']
|
base_deps += ['Gradle']
|
||||||
|
|
||||||
return base_deps
|
return base_deps
|
||||||
|
|
||||||
|
|
||||||
Source = NoopSource
|
|
||||||
Builder = NoopBuilder
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ class _MetaDependency(type):
|
||||||
|
|
||||||
class Dependency(metaclass=_MetaDependency):
|
class Dependency(metaclass=_MetaDependency):
|
||||||
all_deps = {}
|
all_deps = {}
|
||||||
dependencies = []
|
|
||||||
force_native_build = False
|
force_native_build = False
|
||||||
|
|
||||||
def __init__(self, buildEnv):
|
def __init__(self, buildEnv):
|
||||||
|
@ -205,11 +204,16 @@ class SvnClone(Source):
|
||||||
|
|
||||||
class Builder:
|
class Builder:
|
||||||
subsource_dir = None
|
subsource_dir = None
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
self.target = target
|
self.target = target
|
||||||
self.buildEnv = target.buildEnv
|
self.buildEnv = target.buildEnv
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_dependencies(cls, platformInfo):
|
||||||
|
return cls.dependencies
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return self.target.name
|
return self.target.name
|
||||||
|
|
|
@ -48,9 +48,10 @@ class Icu_native(Icu):
|
||||||
|
|
||||||
class Icu_cross_compile(Icu):
|
class Icu_cross_compile(Icu):
|
||||||
name = "icu4c_cross-compile"
|
name = "icu4c_cross-compile"
|
||||||
dependencies = ['icu4c_native']
|
|
||||||
|
|
||||||
class Builder(Icu.Builder):
|
class Builder(Icu.Builder):
|
||||||
|
dependencies = ['icu4c_native']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
icu_native_dep = self.buildEnv.targetsDict['icu4c_native']
|
icu_native_dep = self.buildEnv.targetsDict['icu4c_native']
|
||||||
|
|
|
@ -9,13 +9,14 @@ from kiwixbuild.utils import pj
|
||||||
|
|
||||||
class KiwixAndroid(Dependency):
|
class KiwixAndroid(Dependency):
|
||||||
name = "kiwix-android"
|
name = "kiwix-android"
|
||||||
dependencies = ["Gradle", "kiwix-lib"]
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-android"
|
git_remote = "https://github.com/kiwix/kiwix-android"
|
||||||
git_dir = "kiwix-android"
|
git_dir = "kiwix-android"
|
||||||
|
|
||||||
class Builder(GradleBuilder):
|
class Builder(GradleBuilder):
|
||||||
|
dependencies = ["Gradle", "kiwix-lib"]
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
if self.buildEnv.options.targets == 'kiwix-android-custom':
|
if self.buildEnv.options.targets == 'kiwix-android-custom':
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
|
|
|
@ -10,7 +10,6 @@ from kiwixbuild.utils import Remotefile, pj, SkipCommand
|
||||||
|
|
||||||
class KiwixCustomApp(Dependency):
|
class KiwixCustomApp(Dependency):
|
||||||
name = "kiwix-android-custom"
|
name = "kiwix-android-custom"
|
||||||
dependencies = ["kiwix-android", "kiwix-lib"]
|
|
||||||
|
|
||||||
def __init__(self, buildEnv):
|
def __init__(self, buildEnv):
|
||||||
super().__init__(buildEnv)
|
super().__init__(buildEnv)
|
||||||
|
@ -21,6 +20,8 @@ class KiwixCustomApp(Dependency):
|
||||||
git_dir = "kiwix-android-custom"
|
git_dir = "kiwix-android-custom"
|
||||||
|
|
||||||
class Builder(GradleBuilder):
|
class Builder(GradleBuilder):
|
||||||
|
dependencies = ["kiwix-android", "kiwix-lib"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gradle_target(self):
|
def gradle_target(self):
|
||||||
return "assemble{}".format(self.target.custom_name)
|
return "assemble{}".format(self.target.custom_name)
|
||||||
|
|
|
@ -7,22 +7,23 @@ from kiwixbuild._global import neutralEnv
|
||||||
class Kiwixlib(Dependency):
|
class Kiwixlib(Dependency):
|
||||||
name = "kiwix-lib"
|
name = "kiwix-lib"
|
||||||
|
|
||||||
@property
|
|
||||||
def dependencies(self):
|
|
||||||
base_dependencies = ["pugixml", "libzim", "zlib", "lzma", "libaria2"]
|
|
||||||
if ( self.buildEnv.platform_info.build != 'android'
|
|
||||||
and neutralEnv('distname') != 'Darwin'):
|
|
||||||
base_dependencies += ['ctpp2c', 'ctpp2']
|
|
||||||
if self.buildEnv.platform_info.build != 'native':
|
|
||||||
return base_dependencies + ["icu4c_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c"]
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-lib.git"
|
git_remote = "https://github.com/kiwix/kiwix-lib.git"
|
||||||
git_dir = "kiwix-lib"
|
git_dir = "kiwix-lib"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
|
@classmethod
|
||||||
|
def get_dependencies(cls, platformInfo):
|
||||||
|
base_dependencies = ["pugixml", "libzim", "zlib", "lzma", "libaria2"]
|
||||||
|
if (platformInfo.build != 'android' and
|
||||||
|
neutralEnv('distname') != 'Darwin'):
|
||||||
|
base_dependencies += ['ctpp2c', 'ctpp2']
|
||||||
|
if platformInfo.build != 'native':
|
||||||
|
return base_dependencies + ["icu4c_cross-compile"]
|
||||||
|
else:
|
||||||
|
return base_dependencies + ["icu4c"]
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
base_option = "-Dctpp2-install-prefix={buildEnv.install_dir}"
|
base_option = "-Dctpp2-install-prefix={buildEnv.install_dir}"
|
||||||
|
|
|
@ -5,13 +5,14 @@ from .base import (
|
||||||
|
|
||||||
class KiwixTools(Dependency):
|
class KiwixTools(Dependency):
|
||||||
name = "kiwix-tools"
|
name = "kiwix-tools"
|
||||||
dependencies = ["kiwix-lib", "libmicrohttpd", "zlib"]
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-tools.git"
|
git_remote = "https://github.com/kiwix/kiwix-tools.git"
|
||||||
git_dir = "kiwix-tools"
|
git_dir = "kiwix-tools"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
|
dependencies = ["kiwix-lib", "libmicrohttpd", "zlib"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
if self.buildEnv.platform_info.static:
|
if self.buildEnv.platform_info.static:
|
||||||
|
|
|
@ -8,7 +8,6 @@ from kiwixbuild.utils import Remotefile, run_command
|
||||||
|
|
||||||
class Aria2(Dependency):
|
class Aria2(Dependency):
|
||||||
name = "libaria2"
|
name = "libaria2"
|
||||||
dependencies = ['zlib']
|
|
||||||
|
|
||||||
class Source(ReleaseDownload):
|
class Source(ReleaseDownload):
|
||||||
archive = Remotefile('libaria2-1.33.1.tar.gz',
|
archive = Remotefile('libaria2-1.33.1.tar.gz',
|
||||||
|
@ -23,4 +22,5 @@ class Aria2(Dependency):
|
||||||
run_command(command, self.extract_path, context)
|
run_command(command, self.extract_path, context)
|
||||||
|
|
||||||
class Builder(MakeBuilder):
|
class Builder(MakeBuilder):
|
||||||
|
dependencies = ['zlib']
|
||||||
configure_option = "--enable-libaria2 --disable-ssl --disable-bittorent --disable-metalink --without-sqlite3 --without-libxml2 --without-libexpat"
|
configure_option = "--enable-libaria2 --disable-ssl --disable-bittorent --disable-metalink --without-sqlite3 --without-libxml2 --without-libexpat"
|
||||||
|
|
|
@ -38,9 +38,10 @@ class LibMagic_native(LibMagicBase):
|
||||||
|
|
||||||
class LibMagic_cross_compile(LibMagicBase):
|
class LibMagic_cross_compile(LibMagicBase):
|
||||||
name = "libmagic_cross-compile"
|
name = "libmagic_cross-compile"
|
||||||
dependencies = ['libmagic_native']
|
|
||||||
|
|
||||||
class Builder(LibMagicBase.Builder):
|
class Builder(LibMagicBase.Builder):
|
||||||
|
dependencies = ['libmagic_native']
|
||||||
|
|
||||||
def _compile(self, context):
|
def _compile(self, 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(
|
||||||
|
|
|
@ -6,17 +6,17 @@ from .base import (
|
||||||
class Libzim(Dependency):
|
class Libzim(Dependency):
|
||||||
name = "libzim"
|
name = "libzim"
|
||||||
|
|
||||||
@property
|
|
||||||
def dependencies(self):
|
|
||||||
base_dependencies = ['zlib', 'lzma', 'xapian-core']
|
|
||||||
if self.buildEnv.platform_info.build != 'native':
|
|
||||||
return base_dependencies + ["icu4c_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c"]
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/libzim.git"
|
git_remote = "https://github.com/openzim/libzim.git"
|
||||||
git_dir = "libzim"
|
git_dir = "libzim"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
test_option = "-t 8"
|
test_option = "-t 8"
|
||||||
|
|
||||||
|
@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"]
|
||||||
|
|
|
@ -20,10 +20,10 @@ class Xapian(Dependency):
|
||||||
configure_env = {'_format_LDFLAGS': "-L{buildEnv.install_dir}/{buildEnv.libprefix}",
|
configure_env = {'_format_LDFLAGS': "-L{buildEnv.install_dir}/{buildEnv.libprefix}",
|
||||||
'_format_CXXFLAGS': "-I{buildEnv.install_dir}/include"}
|
'_format_CXXFLAGS': "-I{buildEnv.install_dir}/include"}
|
||||||
|
|
||||||
@property
|
@classmethod
|
||||||
def dependencies(self):
|
def get_dependencies(cls, platformInfo):
|
||||||
deps = ['zlib', 'lzma']
|
deps = ['zlib', 'lzma']
|
||||||
if (self.buildEnv.platform_info.build == 'win32'
|
if (platformInfo.build == 'win32'
|
||||||
or neutralEnv('distname') == 'Darwin'):
|
or neutralEnv('distname') == 'Darwin'):
|
||||||
return deps
|
return deps
|
||||||
return deps + ['uuid']
|
return deps + ['uuid']
|
||||||
|
|
|
@ -5,13 +5,14 @@ from .base import (
|
||||||
|
|
||||||
class ZimTools(Dependency):
|
class ZimTools(Dependency):
|
||||||
name = "zim-tools"
|
name = "zim-tools"
|
||||||
dependencies = ['libzim']
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/zim-tools.git"
|
git_remote = "https://github.com/openzim/zim-tools.git"
|
||||||
git_dir = "zim-tools"
|
git_dir = "zim-tools"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
|
dependencies = ['libzim']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_option(self):
|
def configure_option(self):
|
||||||
if self.buildEnv.platform_info.static:
|
if self.buildEnv.platform_info.static:
|
||||||
|
|
|
@ -6,20 +6,20 @@ from .base import (
|
||||||
class Zimwriterfs(Dependency):
|
class Zimwriterfs(Dependency):
|
||||||
name = "zimwriterfs"
|
name = "zimwriterfs"
|
||||||
|
|
||||||
@property
|
|
||||||
def dependencies(self):
|
|
||||||
base_dependencies = ['libzim', 'zlib', 'xapian-core', 'gumbo']
|
|
||||||
if self.buildEnv.platform_info.build != 'native':
|
|
||||||
return base_dependencies + ["icu4c_cross-compile", "libmagic_cross-compile"]
|
|
||||||
else:
|
|
||||||
return base_dependencies + ["icu4c", "libmagic"]
|
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/zimwriterfs.git"
|
git_remote = "https://github.com/openzim/zimwriterfs.git"
|
||||||
git_dir = "zimwriterfs"
|
git_dir = "zimwriterfs"
|
||||||
release_git_ref = "1.1"
|
release_git_ref = "1.1"
|
||||||
|
|
||||||
class Builder(MesonBuilder):
|
class Builder(MesonBuilder):
|
||||||
|
@classmethod
|
||||||
|
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):
|
||||||
base_option = "-Dmagic-install-prefix={buildEnv.install_dir}"
|
base_option = "-Dmagic-install-prefix={buildEnv.install_dir}"
|
||||||
|
|
Loading…
Reference in New Issue