From c244e5b779f7c6c9317ed2b90980bb09ca2f3e43 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 30 Jun 2021 16:14:39 +0200 Subject: [PATCH 1/6] Link with ssp on win32. Recent version of mingw need projects using `-D_FORTIFY_SOURCE` to link with `ssp`. See https://github.com/msys2/MINGW-packages/issues/5868#issuecomment-544107564 --- kiwixbuild/platforms/win32.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiwixbuild/platforms/win32.py b/kiwixbuild/platforms/win32.py index 444e8cd..2d2a2cf 100644 --- a/kiwixbuild/platforms/win32.py +++ b/kiwixbuild/platforms/win32.py @@ -9,7 +9,7 @@ class Win32PlatformInfo(PlatformInfo): build = 'win32' compatible_hosts = ['fedora', 'debian'] arch_full = 'i686-w64-mingw32' - extra_libs = ['-lwinmm', '-lshlwapi', '-lws2_32'] + extra_libs = ['-lwinmm', '-lshlwapi', '-lws2_32', '-lssp'] def get_cross_config(self): return { From b995976c8a3bfc03744c8f48054aaaf8de52c335 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 30 Jun 2021 16:15:16 +0200 Subject: [PATCH 2/6] Fix packages name on fedora. --- kiwixbuild/packages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/packages.py b/kiwixbuild/packages.py index 69fc35a..162cdbf 100644 --- a/kiwixbuild/packages.py +++ b/kiwixbuild/packages.py @@ -1,6 +1,6 @@ -_fedora_common = ['automake', 'libtool', 'cmake', 'git', 'subversion', 'ccache', 'pkg-config', 'gcc-c++', 'gettext-devel'] +_fedora_common = ['automake', 'libtool', 'cmake', 'git', 'subversion', 'ccache', 'pkgconf-pkg-config', 'gcc-c++', 'gettext-devel'] _debian_common = ['automake', 'libtool', 'cmake', 'git', 'subversion', 'ccache', 'pkg-config', 'gcc', 'autopoint'] PACKAGE_NAME_MAPPERS = { 'flatpak': { @@ -27,7 +27,7 @@ PACKAGE_NAME_MAPPERS = { 'file' : ['file-devel'], 'gumbo' : ['gumbo-parser-devel'], 'aria2': ['aria2'], - 'qt': ['qt5-qtbase-devel', 'qt5-devel', 'qt5-qtsvg'], + 'qt': ['qt5-qtbase-devel', 'qt5-qtsvg'], 'qtwebengine': ['qt5-qtwebengine-devel'] }, 'fedora_native_static': { From 0e6ed1384c18282fb64a0df06768ef672709affa Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 30 Jun 2021 16:16:19 +0200 Subject: [PATCH 3/6] Introduce a intermediate method to detect binaries. --- kiwixbuild/buildenv.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/kiwixbuild/buildenv.py b/kiwixbuild/buildenv.py index 05f1e1e..c41d733 100644 --- a/kiwixbuild/buildenv.py +++ b/kiwixbuild/buildenv.py @@ -23,7 +23,7 @@ class PlatformNeutralEnv: self.detect_platform() self.ninja_command = self._detect_ninja() if not self.ninja_command: - sys.exit("ERROR: ninja command not found") + sys.exit("ERROR: ninja command not found.") self.meson_command = self._detect_meson() if not self.meson_command: sys.exit("ERROR: meson command not found") @@ -47,8 +47,8 @@ class PlatformNeutralEnv: where = where or self.archive_dir download_remote(what, where) - def _detect_ninja(self): - for n in ['ninja', 'ninja-build']: + def _detect_binary(self, *bin_variants): + for n in bin_variants: try: retcode = subprocess.check_call([n, '--version'], stdout=subprocess.DEVNULL) @@ -58,16 +58,12 @@ class PlatformNeutralEnv: if retcode == 0: return n + + def _detect_ninja(self): + return self._detect_binary('ninja', 'ninja-build') + def _detect_meson(self): - for n in ['meson.py', 'meson']: - try: - retcode = subprocess.check_call([n, '--version'], - stdout=subprocess.DEVNULL) - except (FileNotFoundError, PermissionError): - # Doesn't exist in PATH or isn't executable - continue - if retcode == 0: - return n + return self._detect_binary('meson.py', 'meson') class BuildEnv: From c7ea2a31cb75360c37363e342c26a001cb3a0519 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 30 Jun 2021 16:17:09 +0200 Subject: [PATCH 4/6] Correctly detect qmake command. qmake may be named qmake-qt5 on some distribution. --- kiwixbuild/buildenv.py | 8 +++++++- kiwixbuild/dependencies/base.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/buildenv.py b/kiwixbuild/buildenv.py index c41d733..8348118 100644 --- a/kiwixbuild/buildenv.py +++ b/kiwixbuild/buildenv.py @@ -26,7 +26,10 @@ class PlatformNeutralEnv: sys.exit("ERROR: ninja command not found.") self.meson_command = self._detect_meson() if not self.meson_command: - sys.exit("ERROR: meson command not found") + sys.exit("ERROR: meson command not found.") + self.qmake_command = self._detect_qmake() + if not self.qmake_command: + print("WARNING: qmake command not found.", file=sys.stderr) self.mesontest_command = "{} test".format(self.meson_command) def detect_platform(self): @@ -65,6 +68,9 @@ class PlatformNeutralEnv: def _detect_meson(self): return self._detect_binary('meson.py', 'meson') + def _detect_qmake(self): + return self._detect_binary('qmake-qt5', 'qmake') + class BuildEnv: def __init__(self, platformInfo): diff --git a/kiwixbuild/dependencies/base.py b/kiwixbuild/dependencies/base.py index bb8637d..4499929 100644 --- a/kiwixbuild/dependencies/base.py +++ b/kiwixbuild/dependencies/base.py @@ -448,11 +448,12 @@ class QMakeBuilder(MakeBuilder): def _configure(self, context): context.try_skip(self.build_path) cross_option = "" - command = ("qmake {configure_option}" + command = ("{command} {configure_option}" " {env_option}" " {source_path}" " {cross_option}") command = command.format( + command = neutralEnv('qmake_command'), configure_option=self.configure_option, env_option=self.env_option, source_path=self.source_path, From 11fc5a0a9c99ff6d3e616a37c5d5868c0330493c Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 2 Jul 2021 11:16:02 +0200 Subject: [PATCH 5/6] Use correct name for the qtwebengine class. Wrong copy/paste. This is not important as we reference dependencies by their name attribute, not by the class name. But it is better to have a correct name. --- kiwixbuild/dependencies/flatpak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiwixbuild/dependencies/flatpak.py b/kiwixbuild/dependencies/flatpak.py index d4764ec..943c777 100644 --- a/kiwixbuild/dependencies/flatpak.py +++ b/kiwixbuild/dependencies/flatpak.py @@ -36,7 +36,7 @@ class org_kde(Dependency): self.command('install_sdk', self._install_sdk) -class org_kde(Dependency): +class io_qt_qtwebengine(Dependency): neutral = False name = 'io.qt.qtwebengine' From 274aec60d2190076bad751fedcc91b3ceadf8205 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 2 Jul 2021 11:19:18 +0200 Subject: [PATCH 6/6] Copy the right directory on libkiwix android. The sub-directory `android-kiwix-lib-publisher` has not been renamed. We plan to move this code in another repository anyway. It is better for now to use the existing name instead of change the directory. --- kiwixbuild/dependencies/libkiwix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiwixbuild/dependencies/libkiwix.py b/kiwixbuild/dependencies/libkiwix.py index 21a9b31..e441391 100644 --- a/kiwixbuild/dependencies/libkiwix.py +++ b/kiwixbuild/dependencies/libkiwix.py @@ -64,7 +64,7 @@ class LibkiwixApp(Dependency): except FileNotFoundError: pass if not os.path.exists(self.build_path): - shutil.copytree(pj(self.source_path, 'android-libkiwix-publisher'), self.build_path, symlinks=True) + shutil.copytree(pj(self.source_path, 'android-kiwix-lib-publisher'), self.build_path, symlinks=True) for arch in option('android_arch'): try: kiwix_builder = get_target_step('libkiwix', 'android_{}'.format(arch))