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
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):
name = "zimlib"
class Source(GitClone):
#git_remote = "https://gerrit.wikimedia.org/r/p/openzim.git"
git_remote = "https://github.com/mgautierfr/openzim"
git_dir = "openzim"
git_ref = "meson"
Source = OpenzimSource
class Builder(MesonBuilder):
subsource_dir = "zimlib"
class Kiwixlib(Dependency):
name = "kiwix-lib"
dependencies = ['zlib', 'lzma']
class Zimwriterfs(Dependency):
name = "zimwriterfs"
extra_packages = ['file', 'gumbo']
@property
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':
base_dependencies += ['CTPP2']
if self.buildEnv.platform_info.build != 'native':

View File

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

View File

@ -82,6 +82,8 @@ PACKAGE_NAME_MAPPERS = {
'lzma': ['xz-devel'],
'icu4c': None,
'zimlib': None,
'file' : ['file-devel'],
'gumbo' : ['gumbo-parser-devel'],
},
'fedora_native_static': {
'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['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
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:
log = open(context.log_file, 'w')
print("run command '{}'".format(command), file=log)
print("current directory is '{}'".format(cwd), file=log)
print("env is :", file=log)
for k, v in env.items():
print(" {} : {!r}".format(k, v), file=log)
@ -449,6 +454,10 @@ class BuildEnv:
if packages:
packages_list += packages
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):
print("SKIP")
return