From 9d45158f42e856db074aa251fd45e1d1d6e8c934 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 13 Mar 2017 18:17:42 +0100 Subject: [PATCH 1/7] Add print of current directory for command in the log file. --- kiwix-build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kiwix-build.py b/kiwix-build.py index 5494179..937f9c5 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -382,6 +382,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) From fa17b5e200570cbb2e3f6779296ab5434d666bee Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 13 Mar 2017 18:18:11 +0100 Subject: [PATCH 2/7] Add the lib64 path to LDFLAGS. --- kiwix-build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kiwix-build.py b/kiwix-build.py index 937f9c5..b1d75fd 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -364,7 +364,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): From a212ec622b4f69949f4a2b4277b3fdc08da1557b Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 13 Mar 2017 18:19:04 +0100 Subject: [PATCH 3/7] Allow a dependency to have _post_prepare_script in this GitClone source. --- dependency_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dependency_utils.py b/dependency_utils.py index 677d638..bf78d0c 100644 --- a/dependency_utils.py +++ b/dependency_utils.py @@ -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: From 50c56804b15ef1e633b9a35e6f76cecb7f7a8a73 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 13 Mar 2017 18:21:43 +0100 Subject: [PATCH 4/7] Move the OpenZim source outside of Zimlib dependency. The OpenZim source contains the zimlib source but also the zimwriterfs source. There is no zimwriterfs dependency for now but it is better to separate source from the dependency for latter commit. --- dependencies.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dependencies.py b/dependencies.py index 1120763..4ce7cbb 100644 --- a/dependencies.py +++ b/dependencies.py @@ -224,14 +224,15 @@ 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" + + 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" From b62388bae16ce17eb6abbcc921839ceb8d5c3492 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 21 Mar 2017 17:00:22 +0100 Subject: [PATCH 5/7] Allow a dependency to declare extra_packages to install. This is different from declaring a dependency as dependency may be build by kiwix-build.py. --- kiwix-build.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kiwix-build.py b/kiwix-build.py index b1d75fd..e4f0b77 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -452,6 +452,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 From 4bb20c6a49b8fa089705de4d1a8a18aaa28dcf2b Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 21 Mar 2017 17:00:52 +0100 Subject: [PATCH 6/7] Fix dependencies declaration of Kiwixlib. --- dependencies.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dependencies.py b/dependencies.py index 4ce7cbb..d1ee68a 100644 --- a/dependencies.py +++ b/dependencies.py @@ -240,11 +240,10 @@ class Zimlib(Dependency): class Kiwixlib(Dependency): name = "kiwix-lib" - dependencies = ['zlib', 'lzma'] @property def dependencies(self): - base_dependencies = ["Xapian", "Pugixml", "Zimlib"] + base_dependencies = ["Xapian", "Pugixml", "Zimlib", "zlib", "lzma"] if self.buildEnv.platform_info.build != 'android': base_dependencies += ['CTPP2'] if self.buildEnv.platform_info.build != 'native': From 3d9ab94195cd136cc3a6ee1c11508602997fe047 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 21 Mar 2017 17:02:45 +0100 Subject: [PATCH 7/7] Add Zimwriterfs dependency. Now kiwix-build.py can compile zimwriterfs. --- dependencies.py | 23 +++++++++++++++++++++++ kiwix-build.py | 2 ++ 2 files changed, 25 insertions(+) diff --git a/dependencies.py b/dependencies.py index d1ee68a..f0ec13f 100644 --- a/dependencies.py +++ b/dependencies.py @@ -228,6 +228,11 @@ 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" @@ -238,6 +243,24 @@ class Zimlib(Dependency): subsource_dir = "zimlib" +class Zimwriterfs(Dependency): + name = "zimwriterfs" + extra_packages = ['file', 'gumbo'] + + @property + def dependencies(self): + 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" diff --git a/kiwix-build.py b/kiwix-build.py index e4f0b77..c018fd9 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -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'],