From a464833a790f44f061f9de42a88f64e49156d422 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Tue, 30 Aug 2016 09:51:05 -0700 Subject: LinGui: Add flatpak support (#231) * LinGui: add --flatpak configure option For building a linux flatpak bundle * LinGui: add rules to build flatpak repo and bundles * LinGui: add flatpak compatible icon * LinGui: add flatpak compatible desktop file * LinGui: add flatpak appdata xml * pkg: disable building LinGui when creating cli flatpak * pkg: clean flatpak build cache when updating source package * pkg: fix source package build dependencies Fixes errors when the git ref being packaged changes and you have not manually deleted stage and pkg build directories. --- pkg/linux/flatpak/fr.handbrake.HandBrakeCLI.json | 35 ++++++++++++++++++++ pkg/linux/flatpak/fr.handbrake.ghb.json | 42 ++++++++++++++++++++++++ pkg/linux/module.defs | 15 +++++++++ pkg/linux/module.rules | 34 +++++++++++++++++++ pkg/module.defs | 5 +-- pkg/module.rules | 10 +++--- 6 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 pkg/linux/flatpak/fr.handbrake.HandBrakeCLI.json create mode 100644 pkg/linux/flatpak/fr.handbrake.ghb.json (limited to 'pkg') diff --git a/pkg/linux/flatpak/fr.handbrake.HandBrakeCLI.json b/pkg/linux/flatpak/fr.handbrake.HandBrakeCLI.json new file mode 100644 index 000000000..c006549b7 --- /dev/null +++ b/pkg/linux/flatpak/fr.handbrake.HandBrakeCLI.json @@ -0,0 +1,35 @@ +{ + "app-id": "fr.handbrake.HandBrakeCLI", + "runtime": "org.gnome.Platform", + "runtime-version": "3.20", + "sdk": "org.gnome.Sdk", + "command": "HandBrakeCLI", + "finish-args": [ + /* Needs video */ + "--filesystem=xdg-videos", + /* Home */ + "--filesystem=home" + ], + "modules": [ + { + "name": "handbrake", + "no-autogen": true, + "config-opts": ["--flatpak", "--disable-gtk"], + "builddir": true, + "post-install": ["rm -rf /app/share"], + "sources": [ + { + "type": "archive", + "path": "handbrake.tar.bz2", + "strip-components": 1 + }, + { + "type": "archive", + "path": "download.tgz", + "strip-components": 0 + } + ] + } + ] +} + diff --git a/pkg/linux/flatpak/fr.handbrake.ghb.json b/pkg/linux/flatpak/fr.handbrake.ghb.json new file mode 100644 index 000000000..34f578350 --- /dev/null +++ b/pkg/linux/flatpak/fr.handbrake.ghb.json @@ -0,0 +1,42 @@ +{ + "app-id": "fr.handbrake.ghb", + "runtime": "org.gnome.Platform", + "runtime-version": "3.20", + "sdk": "org.gnome.Sdk", + "command": "ghb", + "finish-args": [ + /* X11 + XShm access */ + "--share=ipc", "--socket=x11", + /* Wayland access */ + "--socket=wayland", + /* Needed for dconf to work */ + "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro", + "--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf", + /* Needs video */ + "--filesystem=xdg-videos", + /* Home */ + "--filesystem=home" + ], + "modules": [ + { + "name": "handbrake", + "no-autogen": true, + "config-opts": ["--flatpak"], + "builddir": true, + "post-install": ["rm /app/bin/HandBrakeCLI"], + "sources": [ + { + "type": "archive", + "path": "handbrake.tar.bz2", + "strip-components": 1 + }, + { + "type": "archive", + "path": "download.tgz", + "strip-components": 0 + } + ] + } + ] +} + diff --git a/pkg/linux/module.defs b/pkg/linux/module.defs index 2eea7feb9..16a1baebc 100644 --- a/pkg/linux/module.defs +++ b/pkg/linux/module.defs @@ -28,6 +28,7 @@ PKG.rpm.src.tar.bz2 = $(STAGE.out.src/)rpm/$(PKG.rpm.basename).tar.bz2 STAGE.out.rpm.src/ = $(STAGE.out.src/)rpm/ PKG.debian = $(PKG.in/)linux/debian +PKG.flatpak/ = $(PKG.in/)linux/flatpak/ PKG.cli.deb = $(PKG.out/)$(HB.name)-$(HB.debversion)-Ubuntu_CLI_$(BUILD.machine).deb PKG.gui.deb = $(PKG.out/)$(HB.name)-$(HB.debversion)-Ubuntu_GUI_$(BUILD.machine).deb PKG.deb.basename = $(HB.name.lower)-$(HB.debversion) @@ -41,6 +42,18 @@ PKG.gui.tmp.deb = $(PKG.out/)$(HB.name.lower)-gtk_$(HB.debversion)_$(PKG.deb.mac PKG.native.rpm.stamp = $(RPM.out/).rpm.stamp PKG.rpm.stamp = $(PKG.out/).rpm.stamp +PKG.out.flatpak/ = $(PKG.out/)flatpak/ +STAGE.out.flatpak/ = $(STAGE.out/)flatpak/ +PKG.src.flatpak = $(STAGE.out.flatpak/)handbrake.tar.bz2 +PKG.contrib.flatpak = $(STAGE.out.flatpak/)download.tgz +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)-Flatpak_GUI_$(BUILD.machine).build +PKG.cli.build.flatpak = $(STAGE.out.flatpak/)$(HB.name)-Flatpak_CLI_$(BUILD.machine).build +PKG.repo.flatpak = $(PKG.out.flatpak/)$(HB.name)-Flatpak.repo +PKG.cli.flatpak = $(PKG.out.flatpak/)$(HB.name)-$(HB.version)-Flatpak_CLI_$(BUILD.machine).flatpak +PKG.gui.flatpak = $(PKG.out.flatpak/)$(HB.name)-$(HB.version)-Flatpak_GUI_$(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 @@ -54,6 +67,8 @@ RPMROOT.out/ = $(PWD)/$(STAGE.out/)rpmroot/ ############################################################################### BUILD.out += $(PKG.src.tar) +BUILD.out += $(PKG.cli.flatpak) +BUILD.out += $(PKG.gui.flatpak) BUILD.out += $(PKG.cli.deb) BUILD.out += $(PKG.gui.deb) BUILD.out += $(PKG.cli.rpm) diff --git a/pkg/linux/module.rules b/pkg/linux/module.rules index 7054dee6e..e43906a9a 100644 --- a/pkg/linux/module.rules +++ b/pkg/linux/module.rules @@ -1,3 +1,4 @@ +pkg.create.flatpak:: $(PKG.gui.flatpak) $(PKG.cli.flatpak) pkg.create.deb:: $(PKG.gui.deb) $(PKG.cli.deb) pkg.create.rpm:: $(PKG.rpm.stamp) pkg.create.src.deb:: $(PKG.src.deb.stamp) @@ -55,6 +56,38 @@ $(PKG.rpm.stamp): $(PKG.native.rpm.stamp) $(CP.exe) $(PKG.cli.native.rpm) $(PKG.cli.rpm) $(TOUCH.exe) $(PKG.rpm.stamp) +# +# Flatpak binary package rules +# +$(PKG.src.flatpak): $(PKG.src.tar.bz2) + $(MKDIR.exe) -p $(STAGE.out.flatpak/) + -$(RM.exe) -rf $(STAGE.out.flatpak/).flatpak-builder + $(CP.exe) $(PKG.src.tar.bz2) $(PKG.src.flatpak) + +$(PKG.contrib.flatpak): + $(MKDIR.exe) -p $(STAGE.out.flatpak/) + $(TAR.exe) -C $(SRC/) -czf $(PWD)/$(PKG.contrib.flatpak) download + +$(PKG.gui.flatpak): GNUmakefile $(PKG.src.flatpak) $(PKG.contrib.flatpak) + make contrib.fetch + $(MKDIR.exe) -p $(PKG.out.flatpak/) + # Relative paths in the manifest are relative to the location + # of the manifest. So put it where we have staged the files that + # it needs. + $(CP.exe) $(PKG.gui.manifest.flatpak) $(STAGE.out.flatpak/)fr.handbrake.gui.json + flatpak-builder --force-clean --gpg-sign=608AD8F6 --repo=$(PKG.repo.flatpak) $(PKG.gui.build.flatpak) $(STAGE.out.flatpak/)fr.handbrake.gui.json + flatpak build-bundle $(PKG.repo.flatpak) $(PKG.gui.flatpak) fr.handbrake.ghb + +$(PKG.cli.flatpak): GNUmakefile $(PKG.src.flatpak) $(PKG.contrib.flatpak) + make contrib.fetch + $(MKDIR.exe) -p $(PKG.out.flatpak/) + # Relative paths in the manifest are relative to the location + # of the manifest. So put it where we have staged the files that + # it needs. + $(CP.exe) $(PKG.cli.manifest.flatpak) $(STAGE.out.flatpak/)fr.handbrake.HandBrakeCLI.json + flatpak-builder --force-clean --gpg-sign=608AD8F6 --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 + # # Debian binary package rules # @@ -67,6 +100,7 @@ $(PKG.gui.tmp.deb): GNUmakefile echo $(PKG.out/) fakeroot $(MAKE) FORCEVERSION="-- -v$(HB.debversion)" BUILDDIR=$(PWD)/$(BUILD) CONFIGURE=configure PKGDESTDIR=$(PWD)/$(PKG.out/) -C $(SRC/) -f debian/rules binary + $(PKG.gui.deb): | $(dir $(PKG.gui.deb)) $(PKG.gui.deb): $(PKG.gui.tmp.deb) $(MV.exe) $(PKG.gui.tmp.deb) $(PKG.gui.deb) diff --git a/pkg/module.defs b/pkg/module.defs index 67e2b14a3..9ab47ac0c 100644 --- a/pkg/module.defs +++ b/pkg/module.defs @@ -7,8 +7,9 @@ PKG.basename = $(HB.name)-$(HB.version) PKG.src.tar.bz2 = $(PKG.out/)$(PKG.basename)-source.tar.bz2 PKG.src-contrib.tar.bz2 = $(PKG.out/)$(PKG.basename)-contrib.tar.bz2 -STAGE.out/ = $(BUILD/)stage/ -STAGE.out.src/ = $(STAGE.out/)src/ +STAGE.out/ = $(BUILD/)stage/ +STAGE.out.src/ = $(STAGE.out/)src/ +STAGE.out.src.dist/ = $(STAGE.out.src/)$(PKG.basename) ############################################################################### diff --git a/pkg/module.rules b/pkg/module.rules index 5ec109fd3..8bb7a81e5 100644 --- a/pkg/module.rules +++ b/pkg/module.rules @@ -13,13 +13,13 @@ pkg.clean: $(RM.exe) -fr $(PKG.out/) $(PKG.src.tar.bz2): | $(dir $(PKG.src.tar.bz2)) -$(PKG.src.tar.bz2): | $(STAGE.out.src/) +$(PKG.src.tar.bz2): $(STAGE.out.src.dist/) $(TAR.exe) cjf $@ -C $(STAGE.out.src/) $(PKG.basename) -$(STAGE.out.src/): - $(MKDIR.exe) -p $@ - $(GIT.exe) -C $(SRC/) archive --format=tar --prefix=$(PKG.basename)/ $(HB.repo.shorthash) | $(TAR.exe) -xC $@ - $(SRC/)scripts/repo-info.sh $(SRC/) $(GIT.exe) > $@/$(PKG.basename)/version.txt +$(STAGE.out.src.dist/): + $(MKDIR.exe) -p $(STAGE.out.src/) + $(GIT.exe) -C $(SRC/) archive --format=tar --prefix=$(PKG.basename)/ $(HB.repo.shorthash) | $(TAR.exe) -xC $(STAGE.out.src/) + $(SRC/)scripts/repo-info.sh $(SRC/) $(GIT.exe) > $@/version.txt $(PKG.src-contrib.tar.bz2): $(TAR.exe) cjf $@ -C $(CONTRIB.download/) \ -- cgit v1.2.3