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' diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index a526658..b28f5e8 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 = { @@ -174,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 @@ -186,8 +186,15 @@ class FlatpakBuilder: module['config-opts'] = builder.configure_option.split(' ') manifest = MANIFEST.copy() - manifest['modules'] = list(modules.values()) - with open(pj(self.platform.buildEnv.build_dir, 'manifest.json'), 'w') as f: + 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) + with open(manifest_path, 'w') as f: f.write(json.dumps(manifest, indent=4)) def copy_patches(self): @@ -206,7 +213,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()