aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRubén Beltrán del Río <jj@r.bdr.sh>2026-01-18 12:25:28 +0100
committerRubén Beltrán del Río <jj@r.bdr.sh>2026-01-18 12:25:35 +0100
commit87f291bd746a910655535204c9c9123e64a36fee (patch)
tree6f5f1927ff4250561829397c2bf81fe1fcc57e7f /Makefile
parentca780c35c2f6bb23788eefd53b7a7625d15d80d8 (diff)
Attempt to run individual builds per distribution
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile138
1 files changed, 110 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 9f103e3..ff49930 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,8 @@ output_dir := debug
else
output_dir := $(profile)
endif
-architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
+# Extract just the architecture (first component of target triple)
+arch = $(firstword $(subst -, ,$(target)))
app_name := map
deploy_host := deploy@build.r.bdr.sh
deploy_path := /srv/http/build.r.bdr.sh/$(app_name)-linux
@@ -17,10 +18,23 @@ linuxdeploy := .cache/linuxdeploy.AppImage
pkgver := $(shell grep '^pkgver=' build-aux/PKGBUILD | cut -d= -f2)
pkgrel := $(shell grep '^pkgrel=' build-aux/PKGBUILD | cut -d= -f2)
+# Distro-specific builds (set via: make -e distro=fedora43)
+distro :=
+
+# Podman images for arm builds
+fedora_versions := fedora42 fedora43 fedora-rawhide
+debian_versions := bookworm trixie bullseye
+fedora_image_fedora42 := fedora:42
+fedora_image_fedora43 := fedora:43
+fedora_image_fedora-rawhide := fedora:rawhide
+debian_image_bookworm := debian:bookworm
+debian_image_trixie := debian:trixie
+debian_image_bullseye := debian:bullseye
+
define sign_and_deploy
- @./scripts/sign.sh "$(1)" "$(channel)" "$(architecture)"
- rsync -avz $(1) $(deploy_host):$(deploy_path)
- rsync -avz $(1).minisig $(deploy_host):$(deploy_path)
+ @./scripts/sign.sh "$(1)" "$(channel)" "$(arch)"
+ rsync -avz $(1) $(deploy_host):$(deploy_path)
+ rsync -avz $(1).minisig $(deploy_host):$(deploy_path)
endef
default: build
@@ -72,7 +86,8 @@ po/%/LC_MESSAGES/systems.tranquil.Map.mo: po/%.po
# Packaging ####################################################################
-filename = $(app_name)-$(target)-$(channel)
+# Filename format: map-aarch64-unstable.flatpak or map-aarch64-unstable-fedora43.rpm
+filename = $(app_name)-$(arch)-$(channel)$(if $(distro),-$(distro),)
update_flatpak_dependencies:
cd $(flatpak_cargo_generator) && `poetry env activate` && python3 flatpak-cargo-generator.py $(CURDIR)/Cargo.lock -o $(CURDIR)/build-aux/cargo-sources.json && deactivate
@@ -112,8 +127,8 @@ 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
+ cd $(staging) && PKGEXT='.pkg.tar.gz' makepkg -f
+ mv $(staging)/$(app_name)-$(pkgver)-$(pkgrel)-$(arch).pkg.tar.gz $(app_name)-$(arch)-$(channel)-arch.pkg.tar.gz
@rm -rf $(staging)
$(linuxdeploy):
@@ -157,7 +172,7 @@ distribute-flatpak:
@$(call sign_and_deploy,$(filename).flatpak)
distribute-pacman:
- @$(call sign_and_deploy,$(filename).pkg.tar.gz)
+ @$(call sign_and_deploy,$(app_name)-$(arch)-$(channel)-arch.pkg.tar.gz)
distribute-appimage:
@$(call sign_and_deploy,$(filename).AppImage)
@@ -166,14 +181,65 @@ distribute: distribute-rpm distribute-deb distribute-tar distribute-pacman distr
release: package distribute
-# We can't do cross compile, so for now let's just make it easy to release
-# on arm here
+# ARM builds - run locally for universal formats, podman for distro-specific
arm:
-ifneq ($(channel),)
- $(MAKE) -e profile=release -e channel=$(channel) -e target=aarch64-unknown-linux-gnu release
-else
- $(MAKE) -e profile=release -e channel=unstable -e target=aarch64-unknown-linux-gnu release
+ifndef channel
+ $(eval channel := unstable)
+endif
+ @echo "=== Building ARM packages (channel: $(channel)) ==="
+ @# Build universal formats locally
+ $(MAKE) -e profile=release -e channel=$(channel) -e target=aarch64-unknown-linux-gnu package-tar package-flatpak package-appimage package-pacman
+ @# Build distro-specific packages via podman
+ $(MAKE) -e channel=$(channel) arm-rpm-all arm-deb-all
+ @# Sign and distribute everything
+ $(MAKE) -e profile=release -e channel=$(channel) -e target=aarch64-unknown-linux-gnu distribute-tar distribute-flatpak distribute-appimage distribute-pacman
+ @for v in $(fedora_versions); do \
+ $(MAKE) -e channel=$(channel) -e target=aarch64-unknown-linux-gnu -e distro=$$v distribute-rpm; \
+ done
+ @for v in $(debian_versions); do \
+ $(MAKE) -e channel=$(channel) -e target=aarch64-unknown-linux-gnu -e distro=$$v distribute-deb; \
+ done
+
+# Build all ARM RPMs via podman
+arm-rpm-all:
+ @for v in $(fedora_versions); do \
+ $(MAKE) -e channel=$(channel) -e distro=$$v arm-rpm; \
+ done
+
+# Build single ARM RPM via podman (requires distro= to be set)
+arm-rpm:
+ifndef distro
+ $(error distro is required, e.g., make arm-rpm distro=fedora43)
+endif
+ @echo "=== Building ARM RPM for $(distro) ==="
+ podman run --rm -v $(CURDIR):/src:Z -w /src $(fedora_image_$(distro)) bash -c '\
+ dnf install -y make clang lld curl tar gzip gettext gtk4-devel libadwaita-devel gtksourceview5-devel pkg-config && \
+ curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
+ source $$HOME/.cargo/env && \
+ curl -L --proto "=https" --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash && \
+ cargo binstall cargo-generate-rpm --no-confirm && \
+ make -e profile=release -e channel=$(channel) -e target=aarch64-unknown-linux-gnu -e distro=$(distro) package-rpm'
+
+# Build all ARM DEBs via podman
+arm-deb-all:
+ @for v in $(debian_versions); do \
+ $(MAKE) -e channel=$(channel) -e distro=$$v arm-deb; \
+ done
+
+# Build single ARM DEB via podman (requires distro= to be set)
+arm-deb:
+ifndef distro
+ $(error distro is required, e.g., make arm-deb distro=bookworm)
endif
+ @echo "=== Building ARM DEB for $(distro) ==="
+ podman run --rm -v $(CURDIR):/src:Z -w /src $(debian_image_$(distro)) bash -c '\
+ apt-get update && \
+ apt-get install -y make clang lld curl tar gzip gettext libgtk-4-dev libadwaita-1-dev libgtksourceview-5-dev pkg-config && \
+ curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
+ source $$HOME/.cargo/env && \
+ curl -L --proto "=https" --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash && \
+ cargo binstall cargo-deb --no-confirm && \
+ make -e profile=release -e channel=$(channel) -e target=aarch64-unknown-linux-gnu -e distro=$(distro) package-deb'
# Installation #################################################################
@@ -203,26 +269,42 @@ uninstall:
done
# CI ###########################################################################
-
-ci: lint
+#
+# CI target for generic builds (flatpak, appimage, tar)
+ci-generic: lint
ifeq ($(GIT_REF),refs/heads/main)
- $(MAKE) -e profile=release -e channel=unstable $(architectures)
+ $(MAKE) -e profile=release -e channel=unstable -e target=$(target) package-tar package-flatpak package-appimage distribute-tar distribute-flatpak distribute-appimage
else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
- $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) $(architectures)
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) -e target=$(target) package-tar package-flatpak package-appimage distribute-tar distribute-flatpak distribute-appimage
endif
-$(architectures):
-ifneq ($(channel),)
- $(MAKE) -e channel=$(channel) -e target=$@ release
-else
- $(MAKE) -e target=$@ build
+# CI target for .pkg.tar.gz builds (arch)
+ci-arch: lint
+ifeq ($(GIT_REF),refs/heads/main)
+ $(MAKE) -e profile=release -e channel=unstable -e target=$(target) package-pacman distribute-pacman
+else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) -e target=$(target) package-pacman distribute-pacman
endif
-release_all:
-ifndef channel
- $(error channel is required for release_all)
+# CI target for rpm builds (fedora)
+ci-rpm:
+ifeq ($(GIT_REF),refs/heads/main)
+ $(MAKE) -e profile=release -e channel=unstable -e target=$(target) -e distro=$(distro) package-rpm distribute-rpm
+else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) -e target=$(target) -e distro=$(distro) package-rpm distribute-rpm
endif
- $(MAKE) -e profile=release $(architectures)
+# CI target for deb builds (debian)
+ci-deb:
+ifeq ($(GIT_REF),refs/heads/main)
+ $(MAKE) -e profile=release -e channel=unstable -e target=$(target) -e distro=$(distro) package-deb distribute-deb
+else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) -e target=$(target) -e distro=$(distro) package-deb distribute-deb
+endif
-.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
+.PHONY: default build 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 \
+ arm arm-rpm arm-rpm-all arm-deb arm-deb-all \
+ prepare set_rust ci ci-arch ci-rpm ci-deb release test coverage format lint \
+ update_flatpak_dependencies extract_strings find_translatable_files \
+ ci-generic compile_translations install uninstall