Merge pull request #21 from kiwix/zimwriterfs

Zimwriterfs
This commit is contained in:
Matthieu Gautier 2017-03-28 11:29:23 +02:00 committed by GitHub
commit 0390135a42
3 changed files with 44 additions and 10 deletions

View File

@ -224,26 +224,49 @@ class Icu_cross_compile(Icu):
return super().configure_option + " --with-cross-build=" + Icu_native.builder.build_path return super().configure_option + " --with-cross-build=" + Icu_native.builder.build_path
class OpenzimSource(GitClone):
git_remote = "https://gerrit.wikimedia.org/r/p/openzim.git"
git_dir = "openzim"
def _post_prepare_script(self, context):
context.try_skip(self.git_path)
command = "./autogen.sh"
self.buildEnv.run_command(command, pj(self.git_path, 'zimwriterfs'), context)
class Zimlib(Dependency): class Zimlib(Dependency):
name = "zimlib" name = "zimlib"
class Source(GitClone): Source = OpenzimSource
#git_remote = "https://gerrit.wikimedia.org/r/p/openzim.git"
git_remote = "https://github.com/mgautierfr/openzim"
git_dir = "openzim"
git_ref = "meson"
class Builder(MesonBuilder): class Builder(MesonBuilder):
subsource_dir = "zimlib" subsource_dir = "zimlib"
class Kiwixlib(Dependency): class Zimwriterfs(Dependency):
name = "kiwix-lib" name = "zimwriterfs"
dependencies = ['zlib', 'lzma'] extra_packages = ['file', 'gumbo']
@property @property
def dependencies(self): def dependencies(self):
base_dependencies = ["Xapian", "Pugixml", "Zimlib"] base_dependencies = ['Zimlib', 'zlib', 'lzma', 'Xapian']
if self.buildEnv.platform_info.build != 'native':
return base_dependencies + ["Icu_cross_compile"]
else:
return base_dependencies + ["Icu"]
Source = OpenzimSource
class Builder(MakeBuilder):
subsource_dir = "zimwriterfs"
class Kiwixlib(Dependency):
name = "kiwix-lib"
@property
def dependencies(self):
base_dependencies = ["Xapian", "Pugixml", "Zimlib", "zlib", "lzma"]
if self.buildEnv.platform_info.build != 'android': if self.buildEnv.platform_info.build != 'android':
base_dependencies += ['CTPP2'] base_dependencies += ['CTPP2']
if self.buildEnv.platform_info.build != 'native': if self.buildEnv.platform_info.build != 'native':

View File

@ -144,6 +144,8 @@ class GitClone(Source):
def prepare(self): def prepare(self):
self.command('gitclone', self._git_clone) self.command('gitclone', self._git_clone)
self.command('gitupdate', self._git_update) self.command('gitupdate', self._git_update)
if hasattr(self, '_post_prepare_script'):
self.command('post_prepare_script', self._post_prepare_script)
class Builder: class Builder:

View File

@ -82,6 +82,8 @@ PACKAGE_NAME_MAPPERS = {
'lzma': ['xz-devel'], 'lzma': ['xz-devel'],
'icu4c': None, 'icu4c': None,
'zimlib': None, 'zimlib': None,
'file' : ['file-devel'],
'gumbo' : ['gumbo-parser-devel'],
}, },
'fedora_native_static': { 'fedora_native_static': {
'COMMON': ['gcc-c++', 'cmake', 'automake', 'glibc-static', 'libstdc++-static', 'ccache'], 'COMMON': ['gcc-c++', 'cmake', 'automake', 'glibc-static', 'libstdc++-static', 'ccache'],
@ -364,7 +366,9 @@ class BuildEnv:
]) ])
env['CPPFLAGS'] = " ".join(['-I'+pj(self.install_dir, 'include'), env['CPPFLAGS']]) env['CPPFLAGS'] = " ".join(['-I'+pj(self.install_dir, 'include'), env['CPPFLAGS']])
env['LDFLAGS'] = " ".join(['-L'+pj(self.install_dir, 'lib'), env['LDFLAGS']]) env['LDFLAGS'] = " ".join(['-L'+pj(self.install_dir, 'lib'),
'-L'+pj(self.install_dir, 'lib64'),
env['LDFLAGS']])
return env return env
def run_command(self, command, cwd, context, env=None, input=None, cross_path_only=False): def run_command(self, command, cwd, context, env=None, input=None, cross_path_only=False):
@ -382,6 +386,7 @@ class BuildEnv:
if not self.options.verbose: if not self.options.verbose:
log = open(context.log_file, 'w') log = open(context.log_file, 'w')
print("run command '{}'".format(command), file=log) print("run command '{}'".format(command), file=log)
print("current directory is '{}'".format(cwd), file=log)
print("env is :", file=log) print("env is :", file=log)
for k, v in env.items(): for k, v in env.items():
print(" {} : {!r}".format(k, v), file=log) print(" {} : {!r}".format(k, v), file=log)
@ -449,6 +454,10 @@ class BuildEnv:
if packages: if packages:
packages_list += packages packages_list += packages
dep.skip = True dep.skip = True
for dep in self.targetsDict.values():
packages = getattr(dep, 'extra_packages', [])
for package in packages:
packages_list += package_name_mapper.get(package, [])
if os.path.exists(autoskip_file): if os.path.exists(autoskip_file):
print("SKIP") print("SKIP")
return return