From 3062c4373b234f46b131b1092448946f25160351 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Sun, 24 Feb 2019 10:10:00 -0700 Subject: [PATCH] flatpak: allow building with QSV enabled --- pkg/linux/flatpak/fr.handbrake.ghb.json | 5 ++++- pkg/linux/module.defs | 4 ++++ pkg/linux/module.rules | 8 ++++---- scripts/create_flatpak_manifest.py | 17 +++++++++++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/pkg/linux/flatpak/fr.handbrake.ghb.json b/pkg/linux/flatpak/fr.handbrake.ghb.json index 8cb5e1453..4df07caed 100644 --- a/pkg/linux/flatpak/fr.handbrake.ghb.json +++ b/pkg/linux/flatpak/fr.handbrake.ghb.json @@ -60,7 +60,10 @@ { "name": "handbrake", "no-autogen": true, - "config-opts": ["--flatpak", "--disable-gtk-update-checks"], + "config-opts": [ + "--flatpak", + "--disable-gtk-update-checks" + ], "builddir": true, "post-install": ["install -d /app/extensions"], "sources": [ diff --git a/pkg/linux/module.defs b/pkg/linux/module.defs index c3dc20524..954fbd452 100644 --- a/pkg/linux/module.defs +++ b/pkg/linux/module.defs @@ -28,6 +28,10 @@ ifneq ($(PGP_ID),) PGPSIGN = --gpg-sign=$(PGP_ID) endif +ifeq (1,$(FEATURE.qsv)) + FPQSV = -q +endif + ifneq ($(FP_RUNTIME),) FPRUNTIME = -r $(FP_RUNTIME) endif diff --git a/pkg/linux/module.rules b/pkg/linux/module.rules index e12d00830..11b536c8a 100644 --- a/pkg/linux/module.rules +++ b/pkg/linux/module.rules @@ -63,23 +63,23 @@ $(PKG.rpm.stamp): $(PKG.native.rpm.stamp) # $(PKG.gui.flathub.manifest): $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(SRC/)scripts/create_flatpak_manifest.py -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.gui.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.gui.flathub.manifest) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.gui.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.gui.flathub.manifest) $(PKG.cli.flathub.manifest): $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(SRC/)scripts/create_flatpak_manifest.py -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.cli.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.cli.flathub.manifest) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.cli.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.cli.flathub.manifest) $(PKG.gui.flatpak): GNUmakefile $(PKG.src.tar.bz2) $(MKDIR.exe) -p $(STAGE.out.flatpak/) $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(SRC/)scripts/create_flatpak_manifest.py -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.gui.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(STAGE.out.flatpak/)fr.handbrake.ghb.json + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.gui.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(STAGE.out.flatpak/)fr.handbrake.ghb.json flatpak-builder --default-branch=$(PKG.flatpak.branch) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.gui.build.flatpak) $(STAGE.out.flatpak/)fr.handbrake.ghb.json flatpak build-bundle $(PKG.repo.flatpak) $(PKG.gui.flatpak) fr.handbrake.ghb $(PKG.flatpak.branch) $(PKG.cli.flatpak): GNUmakefile $(PKG.src.tar.bz2) $(MKDIR.exe) -p $(STAGE.out.flatpak/) $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(SRC/)scripts/create_flatpak_manifest.py -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.cli.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(STAGE.out.flatpak/)fr.handbrake.HandBrakeCLI.json + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.cli.manifest.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(STAGE.out.flatpak/)fr.handbrake.HandBrakeCLI.json flatpak-builder --default-branch=$(PKG.flatpak.branch) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.cli.build.flatpak) $(STAGE.out.flatpak/)fr.handbrake.HandBrakeCLI.json flatpak build-bundle $(PKG.repo.flatpak) $(PKG.cli.flatpak) fr.handbrake.HandBrakeCLI $(PKG.flatpak.branch) diff --git a/scripts/create_flatpak_manifest.py b/scripts/create_flatpak_manifest.py index 4800db176..2d1373576 100755 --- a/scripts/create_flatpak_manifest.py +++ b/scripts/create_flatpak_manifest.py @@ -33,7 +33,7 @@ class SourceEntry: self.sha256 = sha256 class FlatpakManifest: - def __init__(self, source_list, runtime, template=None): + def __init__(self, source_list, runtime, qsv, template=None): if template != None: with open(template, 'r') as fp: self.manifest = json.load(fp, object_pairs_hook=OrderedDict) @@ -41,6 +41,7 @@ class FlatpakManifest: self.finish_args = self.manifest["finish-args"] self.modules = self.manifest["modules"] self.hbmodule = self.modules[len(self.modules) - 1] + self.hbconfig = self.hbmodule["config-opts"] self.sources = [None] self.hbmodule["sources"] = self.sources @@ -54,10 +55,14 @@ class FlatpakManifest: self.manifest["modules"] = self.modules self.modules[0] = self.hbmodule self.hbmodule["sources"] = self.sources + self.hbconfig = [None] if runtime != None: self.manifest["runtime-version"] = runtime + if qsv: + self.hbconfig.append("--enable-qsv"); + handbrake_found = False for key, value in source_list.items(): source = OrderedDict() @@ -93,13 +98,14 @@ def usage(): print " -s --sha256 - sha256 of previous file on command line" print " -t --template - Flatpak manifest template" print " -r --runtime - Flatpak SDK runtime version" + print " -q --qsv - Build with Intel QSV support" print " -h --help - Show this message" if __name__ == "__main__": try: - opts, args = getopt.getopt(sys.argv[1:], "a:c:s:t:r:h", + opts, args = getopt.getopt(sys.argv[1:], "a:c:s:t:r:qh", ["archive=", "contrib=", "sha265=", - "template=", "runtime=", "help"]) + "template=", "runtime=", "qsv", "help"]) except getopt.GetoptError: print "Error: Invalid option" usage() @@ -112,6 +118,7 @@ if __name__ == "__main__": source_list = OrderedDict() current_source = None runtime = None + qsv = 0 for opt, arg in opts: if opt in ("-h", "--help"): usage() @@ -135,13 +142,15 @@ if __name__ == "__main__": template = arg elif opt in ("-r", "--runtime"): runtime = arg + elif opt in ("-q", "--qsv"): + qsv = 1; if len(args) > 0: dst = args[0] else: dst = None - manifest = FlatpakManifest(source_list, runtime, template) + manifest = FlatpakManifest(source_list, runtime, qsv, template) if dst != None: with open(dst, 'w') as fp: json.dump(manifest.manifest, fp, ensure_ascii=False, indent=4) -- 2.40.0