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]
|
||||
target = targetClass(self.buildEnv)
|
||||
targets[targetName] = target
|
||||
for dep in target.dependencies:
|
||||
for dep in target.builder.get_dependencies(self.platform):
|
||||
self.add_targets(dep, targets)
|
||||
|
||||
def order_dependencies(self, _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 targetName
|
||||
|
||||
|
|
|
@ -8,23 +8,21 @@ from kiwixbuild._global import neutralEnv
|
|||
class AllBaseDependencies(Dependency):
|
||||
name = "alldependencies"
|
||||
|
||||
@property
|
||||
def dependencies(self):
|
||||
base_deps = ['zlib', 'lzma', 'xapian-core', 'gumbo', 'pugixml', 'libmicrohttpd', 'libaria2']
|
||||
if self.buildEnv.platform_info.build != 'native':
|
||||
base_deps += ["icu4c_cross-compile"]
|
||||
if self.buildEnv.platform_info.build != 'win32':
|
||||
base_deps += ["libmagic_cross-compile"]
|
||||
else:
|
||||
base_deps += ["icu4c", "libmagic"]
|
||||
if ( self.buildEnv.platform_info.build != 'android'
|
||||
and neutralEnv('distname') != 'Darwin'):
|
||||
base_deps += ['ctpp2c', 'ctpp2']
|
||||
if self.buildEnv.platform_info.build == 'android':
|
||||
base_deps += ['Gradle']
|
||||
|
||||
return base_deps
|
||||
|
||||
|
||||
Source = NoopSource
|
||||
Builder = NoopBuilder
|
||||
class Builder(NoopBuilder):
|
||||
@classmethod
|
||||
def get_dependencies(cls, platformInfo):
|
||||
base_deps = ['zlib', 'lzma', 'xapian-core', 'gumbo', 'pugixml', 'libmicrohttpd', 'libaria2']
|
||||
if platformInfo.build != 'native':
|
||||
base_deps += ["icu4c_cross-compile"]
|
||||
if platformInfo.build != 'win32':
|
||||
base_deps += ["libmagic_cross-compile"]
|
||||
else:
|
||||
base_deps += ["icu4c", "libmagic"]
|
||||
if (platformInfo.build != 'android' and
|
||||
neutralEnv('distname') != 'Darwin'):
|
||||
base_deps += ['ctpp2c', 'ctpp2']
|
||||
if platformInfo.build == 'android':
|
||||
base_deps += ['Gradle']
|
||||
|
||||
return base_deps
|
||||
|
|
|
@ -20,7 +20,6 @@ class _MetaDependency(type):
|
|||
|
||||
class Dependency(metaclass=_MetaDependency):
|
||||
all_deps = {}
|
||||
dependencies = []
|
||||
force_native_build = False
|
||||
|
||||
def __init__(self, buildEnv):
|
||||
|
@ -205,11 +204,16 @@ class SvnClone(Source):
|
|||
|
||||
class Builder:
|
||||
subsource_dir = None
|
||||
dependencies = []
|
||||
|
||||
def __init__(self, target):
|
||||
self.target = target
|
||||
self.buildEnv = target.buildEnv
|
||||
|
||||
@classmethod
|
||||
def get_dependencies(cls, platformInfo):
|
||||
return cls.dependencies
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.target.name
|
||||
|
|
|
@ -48,9 +48,10 @@ class Icu_native(Icu):
|
|||
|
||||
class Icu_cross_compile(Icu):
|
||||
name = "icu4c_cross-compile"
|
||||
dependencies = ['icu4c_native']
|
||||
|
||||
class Builder(Icu.Builder):
|
||||
dependencies = ['icu4c_native']
|
||||
|
||||
@property
|
||||
def configure_option(self):
|
||||
icu_native_dep = self.buildEnv.targetsDict['icu4c_native']
|
||||
|
|
|
@ -9,13 +9,14 @@ from kiwixbuild.utils import pj
|
|||
|
||||
class KiwixAndroid(Dependency):
|
||||
name = "kiwix-android"
|
||||
dependencies = ["Gradle", "kiwix-lib"]
|
||||
|
||||
class Source(GitClone):
|
||||
git_remote = "https://github.com/kiwix/kiwix-android"
|
||||
git_dir = "kiwix-android"
|
||||
|
||||
class Builder(GradleBuilder):
|
||||
dependencies = ["Gradle", "kiwix-lib"]
|
||||
|
||||
def build(self):
|
||||
if self.buildEnv.options.targets == 'kiwix-android-custom':
|
||||
print("SKIP")
|
||||
|
|
|
@ -10,7 +10,6 @@ from kiwixbuild.utils import Remotefile, pj, SkipCommand
|
|||
|
||||
class KiwixCustomApp(Dependency):
|
||||
name = "kiwix-android-custom"
|
||||
dependencies = ["kiwix-android", "kiwix-lib"]
|
||||
|
||||
def __init__(self, buildEnv):
|
||||
super().__init__(buildEnv)
|
||||
|
@ -21,6 +20,8 @@ class KiwixCustomApp(Dependency):
|
|||
git_dir = "kiwix-android-custom"
|
||||
|
||||
class Builder(GradleBuilder):
|
||||
dependencies = ["kiwix-android", "kiwix-lib"]
|
||||
|
||||
@property
|
||||
def gradle_target(self):
|
||||
return "assemble{}".format(self.target.custom_name)
|
||||
|
|
|
@ -7,22 +7,23 @@ from kiwixbuild._global import neutralEnv
|
|||
class Kiwixlib(Dependency):
|
||||
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):
|
||||
git_remote = "https://github.com/kiwix/kiwix-lib.git"
|
||||
git_dir = "kiwix-lib"
|
||||
|
||||
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
|
||||
def configure_option(self):
|
||||
base_option = "-Dctpp2-install-prefix={buildEnv.install_dir}"
|
||||
|
|
|
@ -5,13 +5,14 @@ from .base import (
|
|||
|
||||
class KiwixTools(Dependency):
|
||||
name = "kiwix-tools"
|
||||
dependencies = ["kiwix-lib", "libmicrohttpd", "zlib"]
|
||||
|
||||
class Source(GitClone):
|
||||
git_remote = "https://github.com/kiwix/kiwix-tools.git"
|
||||
git_dir = "kiwix-tools"
|
||||
|
||||
class Builder(MesonBuilder):
|
||||
dependencies = ["kiwix-lib", "libmicrohttpd", "zlib"]
|
||||
|
||||
@property
|
||||
def configure_option(self):
|
||||
if self.buildEnv.platform_info.static:
|
||||
|
|
|
@ -8,7 +8,6 @@ from kiwixbuild.utils import Remotefile, run_command
|
|||
|
||||
class Aria2(Dependency):
|
||||
name = "libaria2"
|
||||
dependencies = ['zlib']
|
||||
|
||||
class Source(ReleaseDownload):
|
||||
archive = Remotefile('libaria2-1.33.1.tar.gz',
|
||||
|
@ -23,4 +22,5 @@ class Aria2(Dependency):
|
|||
run_command(command, self.extract_path, context)
|
||||
|
||||
class Builder(MakeBuilder):
|
||||
dependencies = ['zlib']
|
||||
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):
|
||||
name = "libmagic_cross-compile"
|
||||
dependencies = ['libmagic_native']
|
||||
|
||||
class Builder(LibMagicBase.Builder):
|
||||
dependencies = ['libmagic_native']
|
||||
|
||||
def _compile(self, context):
|
||||
context.try_skip(self.build_path)
|
||||
command = "make -j4 {make_target} {make_option}".format(
|
||||
|
|
|
@ -6,17 +6,17 @@ from .base import (
|
|||
class Libzim(Dependency):
|
||||
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):
|
||||
git_remote = "https://github.com/openzim/libzim.git"
|
||||
git_dir = "libzim"
|
||||
|
||||
class Builder(MesonBuilder):
|
||||
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}",
|
||||
'_format_CXXFLAGS': "-I{buildEnv.install_dir}/include"}
|
||||
|
||||
@property
|
||||
def dependencies(self):
|
||||
deps = ['zlib', 'lzma']
|
||||
if (self.buildEnv.platform_info.build == 'win32'
|
||||
or neutralEnv('distname') == 'Darwin'):
|
||||
return deps
|
||||
return deps + ['uuid']
|
||||
@classmethod
|
||||
def get_dependencies(cls, platformInfo):
|
||||
deps = ['zlib', 'lzma']
|
||||
if (platformInfo.build == 'win32'
|
||||
or neutralEnv('distname') == 'Darwin'):
|
||||
return deps
|
||||
return deps + ['uuid']
|
||||
|
|
|
@ -5,13 +5,14 @@ from .base import (
|
|||
|
||||
class ZimTools(Dependency):
|
||||
name = "zim-tools"
|
||||
dependencies = ['libzim']
|
||||
|
||||
class Source(GitClone):
|
||||
git_remote = "https://github.com/openzim/zim-tools.git"
|
||||
git_dir = "zim-tools"
|
||||
|
||||
class Builder(MesonBuilder):
|
||||
dependencies = ['libzim']
|
||||
|
||||
@property
|
||||
def configure_option(self):
|
||||
if self.buildEnv.platform_info.static:
|
||||
|
|
|
@ -6,20 +6,20 @@ from .base import (
|
|||
class Zimwriterfs(Dependency):
|
||||
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):
|
||||
git_remote = "https://github.com/openzim/zimwriterfs.git"
|
||||
git_dir = "zimwriterfs"
|
||||
release_git_ref = "1.1"
|
||||
|
||||
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
|
||||
def configure_option(self):
|
||||
base_option = "-Dmagic-install-prefix={buildEnv.install_dir}"
|
||||
|
|
Loading…
Reference in New Issue