From 09ca0ecdab2795aa03787849019d1b9cbcb91470 Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Mon, 24 Jun 2019 14:30:07 -0700 Subject: [PATCH] Flatpak building optimizations --- .gitignore | 4 +++ Makefile | 43 +++++++++++++++++++++++------ data/codes.nora.gdiceroller.json | 47 ++++++++++++++++++++++++++++++++ data/codes.nora.gdiceroller.xml | 47 ++++++++++++++++++++++++++++++++ debian/control | 12 ++++++++ 5 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 data/codes.nora.gdiceroller.json create mode 100644 data/codes.nora.gdiceroller.xml create mode 100644 debian/control diff --git a/.gitignore b/.gitignore index 1f24183..9a55158 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ Cargo.lock bin/ *.snap +# For the flatpak +.flatpak-builder/ +flatpak + diff --git a/Makefile b/Makefile index 364bda4..1a52274 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,18 @@ +# Install to /usr unless otherwise specified, such as `make PREFIX=/app` +PREFIX=/usr + +# What to run to install various files +INSTALL=install +# Run to install the actual binary +INSTALL_PROGRAM=$(INSTALL) +# Run to install application data, with differing permissions +INSTALL_DATA=$(INSTALL) -m 644 + +# Directories into which to install the various files +bindir=$(DESTDIR)$(PREFIX)/bin +sharedir=$(DESTDIR)$(PREFIX)/share + +# These targets have no associated build files. .PHONY : clean clean-all install uninstall # Build the application @@ -6,16 +21,27 @@ target/release/gdiceroller : src # Install onto the system install : target/release/gdiceroller - cp data/codes.nora.gdiceroller.desktop /usr/share/applications/codes.nora.gdiceroller.desktop - mkdir -p /usr/share/icons/hicolor/codes.nora.gdiceroller/scalable/ - cp data/codes.nora.gdiceroller.svg /usr/share/icons/hicolor/scalable/apps/codes.nora.gdiceroller.svg - cp target/release/gdiceroller /usr/bin/codes.nora.gdiceroller + # Install binary + $(INSTALL_PROGRAM) target/release/gdiceroller $(bindir)/codes.nora.gdiceroller + # Install icon + $(INSTALL_DATA) data/codes.nora.gdiceroller.svg $(sharedir)/icons/hicolor/scalable/apps/codes.nora.gdiceroller.svg + touch $(sharedir)/icons/hicolor + # Install desktop file + $(INSTALL_DATA) data/codes.nora.gdiceroller.desktop $(sharedir)/applications/codes.nora.gdiceroller.desktop # Remove an existing install from the system uninstall : - rm -f /usr/share/applications/codes.nora.gdiceroller.desktop - rm -f /usr/share/icons/hicolor/scalable/apps/codes.nora.gdiceroller.svg - rm -f /usr/bin/codes.nora.gdiceroller + # Remove the desktop file + rm -f $(sharedir)/applications/codes.nora.gdiceroller.desktop + # Remove the icon + rm -f $(sharedir)/icons/hicolor/scalable/apps/codes.nora.gdiceroller.svg + # Remove the binary + rm -f $(bindir)/bin/codes.nora.gdiceroller + +# Build a Flatpak package +flatpak : target/release/gdiceroller + mkdir -p flatpak + flatpak-builder flatpak data/codes.nora.gdiceroller.json # Remove all files clean-all : clean @@ -23,5 +49,6 @@ clean-all : clean # Remove supplemental build files clean : - rm -rf snap/ + rm -rf flatpak/ + rm -rf snap/ *.snap diff --git a/data/codes.nora.gdiceroller.json b/data/codes.nora.gdiceroller.json new file mode 100644 index 0000000..733bc2a --- /dev/null +++ b/data/codes.nora.gdiceroller.json @@ -0,0 +1,47 @@ +{ + "app-id" : "codes.nora.gdiceroller", + "runtime" : "org.gnome.Platform", + "runtime-version" : "master", + "sdk" : "org.gnome.Sdk", + "sdk-extensions" : [ + "org.freedesktop.Sdk.Extension.rust-stable" + ], + "command" : "gdiceroller", + "tags" : [ + "nightly" + ], + "desktop-file-name-suffix" : " ☢️", + "finish-args" : [ + "--socket=x11", + "--socket=wayland", + "--socket=pulseaudio", + "--device=dri" + ], + "build-options" : { + "append-path" : "/usr/lib/sdk/rust-stable/bin", + "build-args" : [ + "--share=network" + ], + "env" : { + "CARGO_HOME" : "/run/build/gdiceroller/cargo", + "RUSTFLAGS" : "--error-format=short --remap-path-prefix =../", + "RUST_BACKTRACE" : "1" + } + }, + "modules" : [ + { + "name" : "gdiceroller", + "buildsystem" : "simple", + "build-commands": [ + "make", + "make install PREFIX=/app" + ], + "sources" : [ + { + "type" : "git", + "url" : "https://gitlab.gnome.org/NoraCodes/gdiceroller.git" + } + ] + } + ] +} diff --git a/data/codes.nora.gdiceroller.xml b/data/codes.nora.gdiceroller.xml new file mode 100644 index 0000000..4db88b3 --- /dev/null +++ b/data/codes.nora.gdiceroller.xml @@ -0,0 +1,47 @@ + + + sm.puri.hellorustgtk.desktop + HelloRustGTK + GPL-3.0 + CC0-1.0 + Thomas Markiewicz + Rust GTK flatpak template app + https://source.puri.sm/ThomasMarkiewicz/HelloRustGTK + +

+ Rust GTK flatpak template app +

+
+ + + + + thomas.markiewicz@puri.sm + + + none + none + none + none + none + none + none + none + none + none + none + none + none + intense + none + moderate + none + none + none + none + +
diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..55a19f5 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: codes.nora.gdiceroller +Section: web +Priority: important +Maintainer: Leonora Tindall +Build-Depends: +Standards-Version: 3.8.4 +Homepage: http://www.gnu.org/software/wget/ +Package: wget +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: retrieves files from the web + Wget is a network utility to retrieve files from the Web -- GitLab