From 17a786092a1bf7f430cbc2033eaf0b2b344eddf8 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:19:07 +0100 Subject: [PATCH 1/6] Do not set unused configure options in flatpak. --- kiwixbuild/dependencies/kiwix_lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kiwixbuild/dependencies/kiwix_lib.py b/kiwixbuild/dependencies/kiwix_lib.py index 524e6e2..19d66c8 100644 --- a/kiwixbuild/dependencies/kiwix_lib.py +++ b/kiwixbuild/dependencies/kiwix_lib.py @@ -23,6 +23,8 @@ class Kiwixlib(Dependency): @property def configure_option(self): + if self.buildEnv.platformInfo.build == 'flatpak': + return "" base_option = "-Dctpp2-install-prefix={buildEnv.install_dir}" if self.buildEnv.platformInfo.build == 'android': base_option += ' -Dandroid=true' From 6b5df23b03ef943cfa31d0c8e32dcc5f24766f1b Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:24:40 +0100 Subject: [PATCH 2/6] `no-autogen` is already default to false. We don't need to add it by default. --- kiwixbuild/flatpak_builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index a526658..71e6fbc 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -138,7 +138,8 @@ class FlatpakBuilder: module['name'] = stepDef[1] if stepDef[0] == 'source': source = get_target_step(stepDef) - module['no-autogen'] = getattr(source, 'flatpack_no_autogen', False) + if getattr(source, 'flatpak_no_autogen', False): + module['no-autogen'] = True module_sources = module.setdefault('sources', []) if isinstance(source, ReleaseDownload): src = { From e11247c18aa40bb3bade0650fd474c1c0252298a Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:25:02 +0100 Subject: [PATCH 3/6] `builddir` is already default to True for meson. --- kiwixbuild/flatpak_builder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index 71e6fbc..9af585a 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -175,7 +175,6 @@ class FlatpakBuilder: builder = get_target_step(stepDef) if isinstance(builder, MesonBuilder): module['buildsystem'] = 'meson' - module['builddir'] = True elif isinstance(builder, CMakeBuilder): module['buildsystem'] = 'cmake' module['builddir'] = True From abf0e639e1629818d0e04d8fa2872496a0d004ee Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:28:08 +0100 Subject: [PATCH 4/6] The manifest file must be named as the app-id. --- kiwixbuild/flatpak_builder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index 9af585a..6320e84 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -187,7 +187,9 @@ class FlatpakBuilder: manifest = MANIFEST.copy() manifest['modules'] = list(modules.values()) - with open(pj(self.platform.buildEnv.build_dir, 'manifest.json'), 'w') as f: + manifest_name = "{}.json".format(MANIFEST['app-id']) + manifest_path = pj(self.platform.buildEnv.build_dir, manifest_name) + with open(manifest_path, 'w') as f: f.write(json.dumps(manifest, indent=4)) def copy_patches(self): @@ -206,7 +208,8 @@ class FlatpakBuilder: def build(self): log = pj(self.platform.buildEnv.log_dir, 'cmd_build_flatpak.log') context = Context('build', log, False) - command = "flatpak-builder --user --ccache --force-clean --repo=repo builddir manifest.json" + command = "flatpak-builder --user --ccache --force-clean --repo=repo builddir {id}.json" + command = command.format(id = MANIFEST['app-id']) try: run_command(command, self.platform.buildEnv.build_dir, context, self.platform.buildEnv) context._finalise() From ac0685877bf66b9eb344275990ba6707929742a6 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:28:45 +0100 Subject: [PATCH 5/6] Do not keep "empty" modules (without sources). `org.kde` dependency has no source. It used by kiwix-build to install the correct sdk/platform. --- kiwixbuild/flatpak_builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index 6320e84..ed1ce6e 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -186,7 +186,8 @@ class FlatpakBuilder: module['config-opts'] = builder.configure_option.split(' ') manifest = MANIFEST.copy() - manifest['modules'] = list(modules.values()) + modules = [m for m in modules.values() if m.get('sources')] + manifest['modules'] = modules manifest_name = "{}.json".format(MANIFEST['app-id']) manifest_path = pj(self.platform.buildEnv.build_dir, manifest_name) with open(manifest_path, 'w') as f: From f9610ce3b30972d3ef6d51bc010ad4e40ef468cf Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Dec 2018 11:31:50 +0100 Subject: [PATCH 6/6] Move the `sources` at the end of the modules. It is the usage to have `sources` attribute at the end of the module definition in flatpak manifest. Let's follow it. --- kiwixbuild/flatpak_builder.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index ed1ce6e..b28f5e8 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -187,6 +187,10 @@ class FlatpakBuilder: manifest = MANIFEST.copy() modules = [m for m in modules.values() if m.get('sources')] + for m in modules: + temp = m['sources'] + del m['sources'] + m['sources'] = temp manifest['modules'] = modules manifest_name = "{}.json".format(MANIFEST['app-id']) manifest_path = pj(self.platform.buildEnv.build_dir, manifest_name)