From adbd2a63b0479ed6fcf97967b4af98997c981927 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Sun, 24 Feb 2019 13:53:56 -0700 Subject: flatpak: add Intel MediaSDK plugin Defines a flatpak manifest that is used to download and build all the dependencies for MediaSDK 19.1.pre2. These are built into a flatpak plugin that can be installed independently from the main HandBrake flatpak. When the plugin is installed, HandBrake gains the ability to do QSV encoding with the latest MediaSDK and VA drivers. When HandBrake is configured with '--flatpak --enable-qsv' and 'make pkg.create.flatpak' is run, both the HandBrake flatpak and the MediaSDK plugin will be built. The name of the MediaSDK plugin file is: fr.handbrake.plugin.IntelMediaSDK-$(HB.version)-$(HB.machine).flatpak I've also changed the the name of the HandBrake flatpak file to conform better with flatpak naming: fr.handbrake.ghb-$(HB.version)-$(HB.machine).flatpak fr.handbrake.HandBrakeCLI-$(HB.version)-$(HB.machine).flatpak --- .../flatpak/fr.handbrake.plugin.IntelMediaSDK.json | 106 +++++++++++++++++++++ pkg/linux/module.defs | 92 +++++++++++------- pkg/linux/module.rules | 37 ++++--- 3 files changed, 190 insertions(+), 45 deletions(-) create mode 100644 pkg/linux/flatpak/fr.handbrake.plugin.IntelMediaSDK.json (limited to 'pkg/linux') diff --git a/pkg/linux/flatpak/fr.handbrake.plugin.IntelMediaSDK.json b/pkg/linux/flatpak/fr.handbrake.plugin.IntelMediaSDK.json new file mode 100644 index 000000000..86e7125af --- /dev/null +++ b/pkg/linux/flatpak/fr.handbrake.plugin.IntelMediaSDK.json @@ -0,0 +1,106 @@ +{ + "app-id": "fr.handbrake.plugin.IntelMediaSDK", + "branch": "1", + "runtime": "fr.handbrake.ghb", + "runtime-version": "development", + "sdk": "org.freedesktop.Sdk//18.08", + "build-extension": true, + "separate-locales": false, + "appstream-compose": false, + "modules": [ + { + "name": "intel-gmmlib", + "sources": [ + { + "type": "archive", + "url": "https://github.com/intel/gmmlib/archive/intel-gmmlib-18.4.1.tar.gz", + "sha256": "7970a8ae4e16efb98f38fbbc0346eea03227fc4462a9bd8e8077277cc3430a84" + } + ], + "buildsystem": "cmake", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release" + ], + "build-options": { + "prefix" : "/app/extensions/IntelMediaSDK", + "make-args": [ + "VERBOSE=1" + ], + "make-install-args": [ + "VERBOSE=1" + ] + } + }, + { + "name": "libva", + "sources": [ + { + "type": "archive", + "url": "https://github.com/intel/libva/releases/download/2.4.0/libva-2.4.0.tar.bz2", + "sha256": "99263056c21593a26f2ece812aee6fe60142b49e6cd46cb33c8dddf18fc19391" + } + ], + "no-autogen": true, + "config-opts": ["--with-drivers-path=/app/extensions/IntelMediaSDK/lib/dri"], + "build-options": { + "prefix" : "/app/extensions/IntelMediaSDK" + } + }, + { + "name": "libva-utils", + "sources": [ + { + "type": "archive", + "url": "https://github.com/intel/libva-utils/releases/download/2.4.0/libva-utils-2.4.0.tar.bz2", + "sha256": "5b7d1954b40fcb2c0544be20125c71a0852049715ab85a3e8aba60434a40c6b3" + } + ], + "no-autogen": true, + "build-options": { + "prefix" : "/app/extensions/IntelMediaSDK", + "prepend-pkg-config-path": "/app/extensions/IntelMediaSDK/lib/pkgconfig" + } + }, + { + "name": "intel-media-driver", + "sources": [ + { + "type": "archive", + "url": "https://github.com/VCDP/media-driver/archive/intel-media-kbl-19.1.0.tar.gz", + "sha256": "d494f8cf395e9996beda9846afdc736998de6978481aab0e483d818a0c836d66" + } + ], + "buildsystem": "cmake", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release" + ], + "build-options": { + "prefix" : "/app/extensions/IntelMediaSDK", + "prepend-pkg-config-path": "/app/extensions/IntelMediaSDK/lib/pkgconfig" + } + }, + { + "name": "mediasdk", + "sources": [ + { + "type": "archive", + "url": "https://github.com/Intel-Media-SDK/MediaSDK/archive/MSS-KBL-2019-R1.tar.gz", + "sha256": "ec3d23a2ca4f18144b52d2257b3050ba0f9a98f2688418dd40e8335a215be765" + } + ], + "buildsystem": "cmake", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DMFX_ENABLE_SW_FALLBACK=OFF" + ], + "build-options": { + "prefix" : "/app/extensions/IntelMediaSDK", + "prepend-pkg-config-path": "/app/extensions/IntelMediaSDK/lib/pkgconfig" + } + } + ] +} + diff --git a/pkg/linux/module.defs b/pkg/linux/module.defs index 954fbd452..939a62410 100644 --- a/pkg/linux/module.defs +++ b/pkg/linux/module.defs @@ -18,30 +18,11 @@ else ifeq ($(HB.repo.branch),) else PKG.rpm.hb.version = $(tag).$(HB.repo.shorthash).$(HB.repo.branch) endif -ifeq ($(HB.repo.type),release) - PKG.flatpak.branch = stable -else - PKG.flatpak.branch = development -endif ifneq ($(PGP_ID),) PGPSIGN = --gpg-sign=$(PGP_ID) endif -ifeq (1,$(FEATURE.qsv)) - FPQSV = -q -endif - -ifneq ($(FP_RUNTIME),) - FPRUNTIME = -r $(FP_RUNTIME) -endif - -ifneq ($(HB_URL),) -ifneq ($(HB_SHA256),) - FLATHUB_MANIFEST = $(PKG.gui.flathub.manifest) $(PKG.cli.flathub.manifest) -endif -endif - ############################################################################### PKG.cli.tar = $(PKG.out.abs/)$(HB.name)-$(HB.version)-$(BUILD.machine)_CLI.tar.gz @@ -55,7 +36,6 @@ PKG.rpm.src.tar.bz2 = $(STAGE.out.src.abs/)rpm/$(PKG.rpm.basename).tar.bz2 STAGE.out.rpm.src/ = $(STAGE.out.src.abs/)rpm/ PKG.debian = $(PKG.in.abs/)linux/debian -PKG.flatpak/ = $(PKG.in.abs/)linux/flatpak/ PKG.cli.deb = $(PKG.out.abs/)$(HB.name)-$(HB.debversion)-Ubuntu_CLI_$(BUILD.machine).deb PKG.gui.deb = $(PKG.out.abs/)$(HB.name)-$(HB.debversion)-Ubuntu_GUI_$(BUILD.machine).deb PKG.deb.basename = $(HB.name.lower)-$(HB.debversion) @@ -69,18 +49,6 @@ PKG.gui.tmp.deb = $(PKG.out.abs/)$(HB.name.lower)-gtk_$(HB.debversion)_$(PKG.deb PKG.native.rpm.stamp = $(RPM.out/).rpm.stamp PKG.rpm.stamp = $(PKG.out.abs/).rpm.stamp -PKG.out.flatpak/ = $(PKG.out.abs/)flatpak/ -STAGE.out.flatpak/ = $(STAGE.out.abs/)flatpak/ -PKG.gui.flathub.manifest = $(PKG.out.flatpak/)fr.handbrake.ghb.json -PKG.cli.flathub.manifest = $(PKG.out.flatpak/)/fr.handbrake.HandBrakeCLI.json -PKG.gui.manifest.flatpak = $(PKG.flatpak/)fr.handbrake.ghb.json -PKG.cli.manifest.flatpak = $(PKG.flatpak/)fr.handbrake.HandBrakeCLI.json -PKG.gui.build.flatpak = $(STAGE.out.flatpak/)$(HB.name)-$(HB.version)-$(BUILD.machine).build -PKG.cli.build.flatpak = $(STAGE.out.flatpak/)$(HB.name)CLI-$(HB.version)-$(BUILD.machine).build -PKG.repo.flatpak = $(PKG.out.flatpak/)$(HB.name)-Flatpak.repo -PKG.cli.flatpak = $(PKG.out.flatpak/)$(HB.name)CLI-$(HB.version)-$(BUILD.machine).flatpak -PKG.gui.flatpak = $(PKG.out.flatpak/)$(HB.name)-$(HB.version)-$(BUILD.machine).flatpak - PKG.gui.native.rpm = $(RPM.out/)RPMS/$(PKG.rpm.machine)/$(HB.name.lower)-gui-$(PKG.rpm.hb.version)-$(PKG.release)$(PKG.rpm.dist).$(PKG.rpm.machine).rpm PKG.cli.native.rpm = $(RPM.out/)RPMS/$(PKG.rpm.machine)/$(HB.name.lower)-cli-$(PKG.rpm.hb.version)-$(PKG.release)$(PKG.rpm.dist).$(PKG.rpm.machine).rpm @@ -91,6 +59,66 @@ RPM.out/ = $(RPM.out)/ RPMROOT.out = $(STAGE.out.abs/)rpmroot RPMROOT.out/ = $(RPMROOT.out)/ +############################################################################### +# Flatpak +############################################################################### + +ifeq (1,$(FEATURE.qsv)) + FPQSV = -q +endif + +ifneq ($(FP_RUNTIME),) + FPRUNTIME = -r $(FP_RUNTIME) +endif + +ifeq ($(HB.repo.type),release) + PKG.branch.flatpak = stable +else + PKG.branch.flatpak = development +endif +PKG.plugin.version.flatpak = 1 + +PKG.flatpak/ = $(PKG.in.abs/)linux/flatpak/ + +PKG.out.flatpak/ = $(PKG.out.abs/)flatpak/ +STAGE.out.flatpak/ = $(STAGE.out.abs/)flatpak/ + +PKG.repo.flatpak = $(PKG.out.flatpak/)$(HB.name)-Flatpak.repo + +PKG.gui.name.flatpak = fr.handbrake.ghb +PKG.gui.manifest.flathub = $(PKG.out.flatpak/)$(PKG.gui.name.flatpak).json +PKG.gui.template.flatpak = $(PKG.flatpak/)$(PKG.gui.name.flatpak).json +PKG.gui.manifest.flatpak = $(STAGE.out.flatpak/)$(PKG.gui.name.flatpak).json +PKG.gui.build.flatpak = $(STAGE.out.flatpak/)$(PKG.gui.name.flatpak)-$(HB.version)-$(BUILD.machine).build +PKG.gui.flatpak = $(PKG.out.flatpak/)$(PKG.gui.name.flatpak)-$(HB.version)-$(BUILD.machine).flatpak + +PKG.cli.name.flatpak = fr.handbrake.HandBrakeCLI +PKG.cli.manifest.flathub = $(PKG.out.flatpak/)$(PKG.cli.name.flatpak).json +PKG.cli.template.flatpak = $(PKG.flatpak/)$(PKG.cli.name.flatpak).json +PKG.cli.manifest.flatpak = $(STAGE.out.flatpak/)$(PKG.cli.name.flatpak).json +PKG.cli.build.flatpak = $(STAGE.out.flatpak/)$(PKG.cli.name.flatpak)-$(HB.version)-$(BUILD.machine).build +PKG.cli.flatpak = $(PKG.out.flatpak/)$(PKG.cli.name.flatpak)-$(HB.version)-$(BUILD.machine).flatpak + +PKG.mediasdk.name.flatpak = fr.handbrake.plugin.IntelMediaSDK +PKG.mediasdk.manifest.flathub = $(PKG.out.flatpak/)$(PKG.mediasdk.name.flatpak).json +PKG.mediasdk.template.flatpak = $(PKG.flatpak/)$(PKG.mediasdk.name.flatpak).json +PKG.mediasdk.manifest.flatpak = $(STAGE.out.flatpak/)$(PKG.mediasdk.name.flatpak).json +PKG.mediasdk.build.flatpak = $(STAGE.out.flatpak/)$(PKG.mediasdk.name.flatpak)-$(HB.version)-$(BUILD.machine).build +PKG.mediasdk.flatpak = $(PKG.out.flatpak/)$(PKG.mediasdk.name.flatpak)-$(HB.version)-$(BUILD.machine).flatpak + +PKG.all.flatpak = $(PKG.gui.flatpak) $(PKG.cli.flatpak) +ifeq (1,$(FEATURE.qsv)) + PKG.all.flatpak += $(PKG.mediasdk.flatpak) +endif + +PKG.plugins.flatpak = $(PKG.mediasdk.flatpak) + +ifneq ($(HB_URL),) +ifneq ($(HB_SHA256),) + FLATHUB_MANIFEST = $(PKG.gui.manifest.flathub) $(PKG.cli.manifest.flathub) +endif +endif + ############################################################################### BUILD.out += $(PKG.src.tar) diff --git a/pkg/linux/module.rules b/pkg/linux/module.rules index 11b536c8a..3fbbbe60c 100644 --- a/pkg/linux/module.rules +++ b/pkg/linux/module.rules @@ -1,4 +1,5 @@ -pkg.create.flatpak:: contrib.fetch $(PKG.gui.flatpak) $(PKG.cli.flatpak) $(FLATHUB_MANIFEST) +pkg.create.flatpak:: contrib.fetch $(PKG.all.flatpak) +pkg.create.plugins.flatpak:: $(PKG.plugins.flatpak) pkg.create.flathub:: $(FLATHUB_MANIFEST) pkg.create.deb:: $(PKG.gui.deb) $(PKG.cli.deb) pkg.create.rpm:: $(PKG.rpm.stamp) @@ -61,27 +62,37 @@ $(PKG.rpm.stamp): $(PKG.native.rpm.stamp) # # Flatpak binary package rules # -$(PKG.gui.flathub.manifest): +$(PKG.gui.manifest.flathub): $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(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) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.gui.manifset.flathub) -$(PKG.cli.flathub.manifest): +$(PKG.cli.manifest.flathub): $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(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) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.cli.manifest.flathub) -$(PKG.gui.flatpak): GNUmakefile $(PKG.src.tar.bz2) +$(PKG.gui.flatpak): GNUmakefile $(PKG.gui.template.flatpak) $(PKG.src.tar.bz2) $(MKDIR.exe) -p $(STAGE.out.flatpak/) $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(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) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.gui.manifest.flatpak) + flatpak-builder --default-branch=$(PKG.branch.flatpak) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.gui.build.flatpak) $(PKG.gui.manifest.flatpak) + flatpak build-bundle $(PKG.repo.flatpak) $(PKG.gui.flatpak) $(PKG.gui.name.flatpak) $(PKG.branch.flatpak) -$(PKG.cli.flatpak): GNUmakefile $(PKG.src.tar.bz2) +$(PKG.cli.flatpak): GNUmakefile $(PKG.cli.template.flatpak) $(PKG.src.tar.bz2) $(MKDIR.exe) -p $(STAGE.out.flatpak/) $(MKDIR.exe) -p $(PKG.out.flatpak/) - $(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) + $(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.cli.manifest.flatpak) + flatpak-builder --default-branch=$(PKG.branch.flatpak) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.cli.build.flatpak) $(PKG.cli.manifest.flatpak) + flatpak build-bundle $(PKG.repo.flatpak) $(PKG.cli.flatpak) $(PKG.cli.name.flatpak) $(PKG.branch.flatpak) + +$(PKG.mediasdk.flatpak): GNUmakefile $(PKG.mediasdk.template.flatpak) $(PKG.gui.flatpak) + $(MKDIR.exe) -p $(STAGE.out.flatpak/) + $(MKDIR.exe) -p $(PKG.out.flatpak/) + $(SRC/)scripts/create_flatpak_manifest.py -p -r $(PKG.branch.flatpak) -t $(PKG.mediasdk.template.flatpak) $(PKG.mediasdk.manifest.flatpak) + -flatpak --user remove --noninteractive $(PKG.gui.name.flatpak)//$(PKG.branch.flatpak) + flatpak --user install --noninteractive $(PKG.gui.flatpak) + flatpak-builder --default-branch=$(PKG.branch.flatpak) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.mediasdk.build.flatpak) $(PKG.mediasdk.manifest.flatpak) + flatpak build-bundle --runtime $(PKG.repo.flatpak) $(PKG.mediasdk.flatpak) $(PKG.mediasdk.name.flatpak) $(PKG.plugin.version.flatpak) + -flatpak --user remove --noninteractive $(PKG.gui.name.flatpak)//$(PKG.branch.flatpak) # # Debian binary package rules -- cgit v1.2.3