aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml2
-rw-r--r--.gitignore8
-rw-r--r--Makefile49
-rw-r--r--build-aux/PKGBUILD49
4 files changed, 103 insertions, 5 deletions
diff --git a/.build.yml b/.build.yml
index 46eac17..a5ba0c5 100644
--- a/.build.yml
+++ b/.build.yml
@@ -17,6 +17,7 @@ packages:
- gtk4
- libadwaita
- gtksourceview5
+ - fakeroot
sources:
- git@git.sr.ht:~rbdr/map-linux
- https://github.com/flatpak/flatpak-builder-tools
@@ -44,3 +45,4 @@ tasks:
- release: |
cd map-linux
make -e architectures=x86_64-unknown-linux-gnu -e flatpak_cargo_generator=/home/build/flatpak-builder-tools/cargo ci
+ make arch
diff --git a/.gitignore b/.gitignore
index 764e7f4..a78d59e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,14 @@
/target
/repo
+/.cache
*.mo
builddir
.flatpak-builder
-./*.minisign
-*.minisign
+./*.minisig
+*.minisig
*.rpm
*.deb
*.tar.gz
+*.pkg.tar.gz
+*.AppImage
+*.flatpak
diff --git a/Makefile b/Makefile
index aac7b92..4b56b7e 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,10 @@ deploy_host := deploy@build.r.bdr.sh
deploy_path := /srv/http/build.r.bdr.sh/$(app_name)-linux
prefix := /usr/local
flatpak_cargo_generator := $(HOME)/projects/vendor/flatpak-builder-tools/cargo
+linuxdeploy_url := https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(shell uname -m).AppImage
+linuxdeploy := .cache/linuxdeploy.AppImage
+pkgver := $(shell grep '^pkgver=' build-aux/PKGBUILD | cut -d= -f2)
+pkgrel := $(shell grep '^pkgrel=' build-aux/PKGBUILD | cut -d= -f2)
define sign_and_deploy
@./scripts/sign.sh "$(1)" "$(channel)" "$(architecture)"
@@ -104,7 +108,38 @@ package-flatpak: update_flatpak_dependencies
flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir ./build-aux/systems.tranquil.Map.yml
flatpak build-bundle repo $(filename).flatpak systems.tranquil.Map
-package: package-rpm package-deb package-tar package-flatpak
+package-pacman:
+ @$(eval staging := $(shell mktemp -d))
+ rsync -a --filter=':- .gitignore' --exclude='.git' . $(staging)/src
+ cp build-aux/PKGBUILD $(staging)/
+ cd $(staging) && PKGEXT='.pkg.tar.gz' makepkg -fd
+ mv $(staging)/$(app_name)-$(pkgver)-$(pkgrel)-$(firstword $(subst -, ,$(target))).pkg.tar.gz $(filename).pkg.tar.gz
+ @rm -rf $(staging)
+
+$(linuxdeploy):
+ @mkdir -p .cache
+ curl -L -o $(linuxdeploy) $(linuxdeploy_url)
+ chmod +x $(linuxdeploy)
+
+package-appimage: build $(linuxdeploy)
+ifeq ($(findstring linux,$(target)),linux)
+ @$(eval appdir := $(shell mktemp -d))
+ @install -Dm0755 target/$(target)/$(output_dir)/$(app_name) $(appdir)/usr/bin/$(app_name)
+ @install -Dm0644 resources/logo.svg $(appdir)/usr/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg
+ @install -Dm0644 resources/systems.tranquil.Map.desktop $(appdir)/usr/share/applications/systems.tranquil.Map.desktop
+ @install -Dm0644 resources/systems.tranquil.Map.metainfo.xml $(appdir)/usr/share/metainfo/systems.tranquil.Map.metainfo.xml
+ @install -Dm0644 resources/systems.tranquil.Map.service $(appdir)/usr/share/dbus-1/services/systems.tranquil.Map.service
+ @install -Dm0644 resources/wmap.lang $(appdir)/usr/share/gtksourceview-5/language-specs/wmap.lang
+ @for po_file in po/*.po; do \
+ locale=$$(basename "$$po_file" .po); \
+ install -Dm0644 po/$$locale/LC_MESSAGES/systems.tranquil.Map.mo $(appdir)/usr/share/locale/$$locale/LC_MESSAGES/systems.tranquil.Map.mo; \
+ done
+ APPIMAGE_EXTRACT_AND_RUN=1 NO_STRIP=true $(linuxdeploy) --appdir=$(appdir) --output=appimage --desktop-file=resources/systems.tranquil.Map.desktop --icon-file=resources/logo.svg
+ mv *.AppImage $(filename).AppImage
+ @rm -rf $(appdir)
+endif
+
+package: package-rpm package-deb package-tar package-flatpak package-appimage
# Distribution #################################################################
@@ -120,10 +155,18 @@ distribute-tar:
distribute-flatpak:
@$(call sign_and_deploy,$(filename).flatpak)
-distribute: distribute-rpm distribute-deb distribute-tar distribute-flatpak
+distribute-pacman:
+ @$(call sign_and_deploy,$(filename).pkg.tar.gz)
+
+distribute-appimage:
+ @$(call sign_and_deploy,$(filename).AppImage)
+
+distribute: distribute-rpm distribute-deb distribute-tar distribute-flatpak distribute-appimage
release: package distribute
+arch: package-pacman distribute-pacman
+
# We can't do cross compile, so for now let's just make it easy to release
# on arm here
arm:
@@ -183,4 +226,4 @@ endif
$(MAKE) -e profile=release $(architectures)
-.PHONY: default build $(architectures) package package-rpm package-deb package-tar package-flatpak distribute distribute-rpm distribute-deb distribute-tar distribute-flatpak prepare set_rust ci release release_all test coverage format update_flatpak_dependencies extract_strings find_translatable_files compile_translations install uninstall
+.PHONY: default build $(architectures) package package-rpm package-deb package-tar package-flatpak package-pacman package-appimage distribute distribute-rpm distribute-deb distribute-tar distribute-flatpak distribute-pacman distribute-appimage arch prepare set_rust ci release release_all test coverage format update_flatpak_dependencies extract_strings find_translatable_files compile_translations install uninstall
diff --git a/build-aux/PKGBUILD b/build-aux/PKGBUILD
new file mode 100644
index 0000000..d330a95
--- /dev/null
+++ b/build-aux/PKGBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Ruben Beltran del Rio <wmap@r.bdr.sh>
+pkgname=map
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="Wardley Map editor for Linux"
+arch=('x86_64' 'aarch64')
+url="https://map.tranquil.systems/map-for-linux"
+license=('AGPL-3.0-or-later')
+depends=('gtk4' 'gtksourceview5' 'cairo')
+makedepends=('cargo' 'gettext')
+source=()
+sha256sums=()
+
+prepare() {
+ cd "$startdir/src"
+ export RUSTUP_TOOLCHAIN=stable
+ cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
+}
+
+build() {
+ cd "$startdir/src"
+ export RUSTUP_TOOLCHAIN=stable
+ export CARGO_TARGET_DIR=target
+
+ # Compile translations
+ for po_file in po/*.po; do
+ locale=$(basename "$po_file" .po)
+ mkdir -p "po/$locale/LC_MESSAGES"
+ msgfmt "$po_file" -o "po/$locale/LC_MESSAGES/systems.tranquil.Map.mo"
+ done
+
+ cargo build --frozen --release
+}
+
+package() {
+ cd "$startdir/src"
+
+ install -Dm0755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
+ install -Dm0644 resources/logo.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg"
+ install -Dm0644 resources/systems.tranquil.Map.desktop "$pkgdir/usr/share/applications/systems.tranquil.Map.desktop"
+ install -Dm0644 resources/systems.tranquil.Map.metainfo.xml "$pkgdir/usr/share/metainfo/systems.tranquil.Map.metainfo.xml"
+ install -Dm0644 resources/systems.tranquil.Map.service "$pkgdir/usr/share/dbus-1/services/systems.tranquil.Map.service"
+ install -Dm0644 resources/wmap.lang "$pkgdir/usr/share/gtksourceview-5/language-specs/wmap.lang"
+
+ for po_file in po/*.po; do
+ locale=$(basename "$po_file" .po)
+ install -Dm0644 "po/$locale/LC_MESSAGES/systems.tranquil.Map.mo" "$pkgdir/usr/share/locale/$locale/LC_MESSAGES/systems.tranquil.Map.mo"
+ done
+}