diff options
| -rw-r--r-- | Makefile | 101 | ||||
| -rw-r--r-- | build-containers/arch/Containerfile | 21 | ||||
| -rw-r--r-- | build-containers/bookworm/Containerfile | 26 | ||||
| -rw-r--r-- | build-containers/fedora-rawhide/Containerfile | 23 | ||||
| -rw-r--r-- | build-containers/fedora42/Containerfile | 23 | ||||
| -rw-r--r-- | build-containers/fedora43/Containerfile | 23 | ||||
| -rw-r--r-- | build-containers/forky/Containerfile | 26 | ||||
| -rw-r--r-- | build-containers/trixie/Containerfile | 26 |
8 files changed, 222 insertions, 47 deletions
@@ -2,40 +2,40 @@ profile := release target = $(shell rustc -vV | grep host | awk '{print $$2}') channel := unstable +# Config: Directories & Locations ############################################## # Cargo outputs dev profile to 'debug' directory, not 'dev' +prefix := /usr/local ifeq ($(profile),dev) output_dir := debug else output_dir := $(profile) endif - -# 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 -prefix := /usr/local flatpak_cargo_generator := $(HOME)/projects/vendor/flatpak-builder-tools/cargo + +# Config: Packaging Config ##################################################### 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) -# Podman images for distro-specific 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 -# lopsided/archlinux provides multi-arch images (amd64, arm64, etc.) -arch_image := lopsided/archlinux:latest - # Filename format: map-aarch64-unstable.flatpak or map-aarch64-unstable-fedora43.rpm filename = $(app_name)-$(arch)-$(channel) +# Config: Naming ############################################################### +arch = $(firstword $(subst -, ,$(target))) +app_name := map + +# Config: Container Images ##################################################### +fedora_versions := fedora42 fedora43 fedora-rawhide +# Note: bullseye excluded - no GTK4/libadwaita packages available +debian_versions := bookworm trixie forky +all_containers := arch $(fedora_versions) $(debian_versions) +container_image_prefix := map-build + +# Config: Release Location ##################################################### +deploy_host := deploy@build.r.bdr.sh +deploy_path := /srv/http/build.r.bdr.sh/$(app_name)-linux + define sign_and_deploy @./scripts/sign.sh "$(1)" "$(channel)" "$(arch)" rsync -avz $(1) $(deploy_host):$(deploy_path) @@ -88,10 +88,20 @@ po/%/LC_MESSAGES/systems.tranquil.Map.mo: po/%.po @mkdir -p $(dir $@) msgfmt $< -o $@ +# Container Images ############################################################# + +build-container-%: + @echo "=== Building container image: $(container_image_prefix):$* ===" + podman build -t $(container_image_prefix):$* build-containers/$* + +build-containers: $(addprefix build-container-,$(all_containers)) + # Packaging #################################################################### -# -# Generic packages (run on bare metal) -# + + +# Generic packages +# These run directly on the host machine, since the assumption is that it +# shouldn't affect the outcome. 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 @@ -139,9 +149,9 @@ ifeq ($(findstring linux,$(target)),linux) @rm -rf $(appdir) endif -# -# Distro-specific packages (run inside podman containers) -# +# Distro-specific packages +# These run inside containers, as we want to make sure they're built with the +# libraries available in that particular distribution. # Internal target: runs inside arch container package-pacman: @@ -172,36 +182,28 @@ endif package-pacman-podman: @echo "=== Building Arch package for $(arch) ===" - podman run --rm --userns=keep-id -v $(CURDIR):/src:Z -w /src $(arch_image) bash -c '\ - pacman -Syu --noconfirm make clang lld curl tar gzip gettext gtk4 libadwaita gtksourceview5 fakeroot rsync rust && \ - make -e profile=$(profile) -e channel=$(channel) -e target=$(target) package-pacman' + podman run --rm -v $(CURDIR):/src:Z -w /src $(container_image_prefix):arch bash -c '\ + staging=$$(mktemp -d) && \ + cp -r /src/. $$staging/ && \ + chown -R builder:builder $$staging && \ + su builder -c "cd $$staging && make -e profile=$(profile) -e channel=$(channel) -e target=$(target) package-pacman" && \ + cp $$staging/$(app_name)-$(arch)-$(channel)-arch.pkg.tar.gz /src/' package-rpm-podman: ifndef distro $(error distro is required, e.g., make package-rpm-podman distro=fedora43) endif @echo "=== Building RPM for $(distro) ($(arch)) ===" - podman run --rm --userns=keep-id -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=$(profile) -e channel=$(channel) -e target=$(target) -e distro=$(distro) package-rpm' + podman run --rm -v $(CURDIR):/src:Z -w /src $(container_image_prefix):$(distro) \ + make -e profile=$(profile) -e channel=$(channel) -e target=$(target) -e distro=$(distro) package-rpm package-deb-podman: ifndef distro $(error distro is required, e.g., make package-deb-podman distro=bookworm) endif @echo "=== Building DEB for $(distro) ($(arch)) ===" - podman run --rm --userns=keep-id -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=$(profile) -e channel=$(channel) -e target=$(target) -e distro=$(distro) package-deb' + podman run --rm -v $(CURDIR):/src:Z -w /src $(container_image_prefix):$(distro) \ + make -e profile=$(profile) -e channel=$(channel) -e target=$(target) -e distro=$(distro) package-deb package-rpm-all: @for v in $(fedora_versions); do \ @@ -231,19 +233,23 @@ distribute-pacman: distribute-rpm: @for v in $(fedora_versions); do \ - $(call sign_and_deploy,$(filename)-$$v.rpm); \ + ./scripts/sign.sh "$(filename)-$$v.rpm" "$(channel)" "$(arch)" && \ + rsync -avz $(filename)-$$v.rpm $(deploy_host):$(deploy_path) && \ + rsync -avz $(filename)-$$v.rpm.minisig $(deploy_host):$(deploy_path); \ done distribute-deb: @for v in $(debian_versions); do \ - $(call sign_and_deploy,$(filename)-$$v.deb); \ + ./scripts/sign.sh "$(filename)-$$v.deb" "$(channel)" "$(arch)" && \ + rsync -avz $(filename)-$$v.deb $(deploy_host):$(deploy_path) && \ + rsync -avz $(filename)-$$v.deb.minisig $(deploy_host):$(deploy_path); \ done distribute: distribute-tar distribute-flatpak distribute-appimage distribute-pacman distribute-rpm distribute-deb # Release ###################################################################### -release: lint package distribute +release: lint build-containers package distribute # Installation ################################################################# @@ -279,4 +285,5 @@ uninstall: package-pacman-podman package-rpm-podman package-deb-podman \ package-rpm-all package-deb-all package \ distribute-tar distribute-flatpak distribute-appimage distribute-pacman distribute-rpm distribute-deb distribute \ - release install uninstall set_rust prepare + release install uninstall set_rust prepare \ + build-containers diff --git a/build-containers/arch/Containerfile b/build-containers/arch/Containerfile new file mode 100644 index 0000000..aacf2a2 --- /dev/null +++ b/build-containers/arch/Containerfile @@ -0,0 +1,21 @@ +FROM ogarcia/archlinux:latest + +RUN pacman -Syu --noconfirm \ + make \ + clang \ + lld \ + curl \ + tar \ + gzip \ + gettext \ + gtk4 \ + libadwaita \ + gtksourceview5 \ + fakeroot \ + rsync \ + rust \ + pkgconf \ + && pacman -Scc --noconfirm + +# Create builder user for makepkg (can't run as root) +RUN useradd -m builder diff --git a/build-containers/bookworm/Containerfile b/build-containers/bookworm/Containerfile new file mode 100644 index 0000000..dd3596d --- /dev/null +++ b/build-containers/bookworm/Containerfile @@ -0,0 +1,26 @@ +FROM debian:bookworm + +ENV DEBIAN_FRONTEND=noninteractive + +RUN 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 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-deb +RUN 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 diff --git a/build-containers/fedora-rawhide/Containerfile b/build-containers/fedora-rawhide/Containerfile new file mode 100644 index 0000000..261a219 --- /dev/null +++ b/build-containers/fedora-rawhide/Containerfile @@ -0,0 +1,23 @@ +FROM fedora:rawhide + +RUN dnf install -y \ + make \ + clang \ + lld \ + curl \ + tar \ + gzip \ + gettext \ + gtk4-devel \ + libadwaita-devel \ + gtksourceview5-devel \ + pkg-config \ + && dnf clean all + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-generate-rpm +RUN 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 diff --git a/build-containers/fedora42/Containerfile b/build-containers/fedora42/Containerfile new file mode 100644 index 0000000..a47d1eb --- /dev/null +++ b/build-containers/fedora42/Containerfile @@ -0,0 +1,23 @@ +FROM fedora:42 + +RUN dnf install -y \ + make \ + clang \ + lld \ + curl \ + tar \ + gzip \ + gettext \ + gtk4-devel \ + libadwaita-devel \ + gtksourceview5-devel \ + pkg-config \ + && dnf clean all + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-generate-rpm +RUN 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 diff --git a/build-containers/fedora43/Containerfile b/build-containers/fedora43/Containerfile new file mode 100644 index 0000000..55f8329 --- /dev/null +++ b/build-containers/fedora43/Containerfile @@ -0,0 +1,23 @@ +FROM fedora:43 + +RUN dnf install -y \ + make \ + clang \ + lld \ + curl \ + tar \ + gzip \ + gettext \ + gtk4-devel \ + libadwaita-devel \ + gtksourceview5-devel \ + pkg-config \ + && dnf clean all + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-generate-rpm +RUN 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 diff --git a/build-containers/forky/Containerfile b/build-containers/forky/Containerfile new file mode 100644 index 0000000..2ee89c8 --- /dev/null +++ b/build-containers/forky/Containerfile @@ -0,0 +1,26 @@ +FROM debian:forky + +ENV DEBIAN_FRONTEND=noninteractive + +RUN 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 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-deb +RUN 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 diff --git a/build-containers/trixie/Containerfile b/build-containers/trixie/Containerfile new file mode 100644 index 0000000..4e4c10f --- /dev/null +++ b/build-containers/trixie/Containerfile @@ -0,0 +1,26 @@ +FROM debian:trixie + +ENV DEBIAN_FRONTEND=noninteractive + +RUN 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 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install cargo-deb +RUN 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 |