build: package remus as a Flatpak for SteamOS

SteamOS has a read-only root filesystem, so a Flatpak is the way to
install it. The build is offline from vendored crates. make
flatpak-bundle writes one file to copy to a Steam machine, and
make sdk-check runs the checks inside the SDK for hosts without the
GStreamer development files.
This commit is contained in:
Ansho Rei
2026-11-04 02:19:07 +01:00
parent af307549a8
commit a74fd1bd5c
6 changed files with 139 additions and 1 deletions
+29 -1
View File
@@ -9,9 +9,14 @@ DEMO_PASS ?= demo
SHOTS_DIR := target/shots
SCRATCH := target/scratch
FLATPAK_ID := me.anshorei.Fettleshed.Remus
FLATPAK_DIR := target/flatpak
FLATPAK_SDK := org.freedesktop.Sdk//26.08
FLATPAK_BUILDER := $(shell command -v flatpak-builder 2>/dev/null || echo flatpak run org.flatpak.Builder)
.PHONY: help
help: ## List the targets
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Debug build
@@ -65,6 +70,29 @@ shots: ## Screenshot the main screens against the demo server into target/shots
REMUS_DEV_SCRIPT="wait:4000,shot:$(SHOTS_DIR)/home.png,right,activate,wait:3000,shot:$(SHOTS_DIR)/album.png,down,activate,wait:3000,now-playing,wait:2500,shot:$(SHOTS_DIR)/now-playing.png,play-pause,back,section-next,section-next,section-next,wait:3000,shot:$(SHOTS_DIR)/artists.png,quit" \
./target/debug/remus
.PHONY: sdk-check
sdk-check: ## make check inside the Flatpak SDK, which has the GStreamer dev files
flatpak run --share=network --filesystem=$(CURDIR) --command=sh $(FLATPAK_SDK) -c '\
export PATH=$$PATH:/usr/lib/sdk/rust-stable/bin CARGO_HOME=$(CURDIR)/target/sdk/cargo-home \
CARGO_TARGET_DIR=$(CURDIR)/target/sdk REMUS_AUDIO_SINK=fakesink && \
cd $(CURDIR) && cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test'
.PHONY: flatpak
flatpak: ## Build the Flatpak into target/flatpak/repo
cargo vendor --locked $(FLATPAK_DIR)/vendor > /dev/null
$(FLATPAK_BUILDER) --user --install-deps-from=flathub --force-clean --state-dir=$(FLATPAK_DIR)/state \
--repo=$(FLATPAK_DIR)/repo $(FLATPAK_DIR)/build flatpak/$(FLATPAK_ID).yml
.PHONY: flatpak-install
flatpak-install: flatpak ## Build the Flatpak and install it for this user
flatpak --user remote-add --if-not-exists --no-gpg-verify remus-local $(FLATPAK_DIR)/repo
flatpak --user install -y --reinstall remus-local $(FLATPAK_ID)
.PHONY: flatpak-bundle
flatpak-bundle: flatpak ## Build target/flatpak/remus.flatpak, a single file to copy to a Steam machine
flatpak build-bundle --runtime-repo=https://dl.flathub.org/repo/flathub.flatpakrepo \
$(FLATPAK_DIR)/repo $(FLATPAK_DIR)/remus.flatpak $(FLATPAK_ID)
.PHONY: clean
clean: ## Remove build output, screenshots and scratch config
cargo clean