aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile147
1 files changed, 27 insertions, 120 deletions
diff --git a/Makefile b/Makefile
index 91db49a..d3be667 100644
--- a/Makefile
+++ b/Makefile
@@ -42,35 +42,6 @@ define sign_and_deploy
rsync -avz $(1).minisig $(deploy_host):$(deploy_path)
endef
-default: build
-
-set_rust:
- rustup default stable
-
-prepare:
-ifneq ($(skip_prepare),1)
- rustup target add $(target)
-endif
-
-# Build ########################################################################
-
-build: compile_translations prepare
- cargo build --profile $(profile) --target $(target)
-
-# Code Quality #################################################################
-
-test:
- cargo test
-
-coverage:
- cargo tarpaulin
-
-format:
- cargo fmt && cargo clippy --fix
-
-lint:
- cargo fmt -- --check && cargo clippy
-
# Container Images #############################################################
build-container-%:
@@ -90,135 +61,74 @@ build-containers: $(addprefix build-container-,$(all_containers))
# 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
-
-package-tar: build
- @$(eval staging := $(shell mktemp -d))
- @install -Dm0755 target/$(target)/$(output_dir)/$(app_name) $(staging)/usr/bin/$(app_name)
- @install -Dm0644 resources/logo.svg $(staging)/usr/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg
- @install -Dm0644 resources/systems.tranquil.Map.desktop $(staging)/usr/share/applications/systems.tranquil.Map.desktop
- @install -Dm0644 resources/systems.tranquil.Map.metainfo.xml $(staging)/usr/share/metainfo/systems.tranquil.Map.metainfo.xml
- @install -Dm0644 resources/systems.tranquil.Map.service $(staging)/usr/share/dbus-1/services/systems.tranquil.Map.service
- @install -Dm0644 resources/wmap.lang $(staging)/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 $(staging)/usr/share/locale/$$locale/LC_MESSAGES/systems.tranquil.Map.mo; \
- done
- tar -czvf $(filename).tar.gz -C $(staging) usr
- @rm -rf $(staging)
+ cd $(flatpak_cargo_generator) && `poetry env activate` && python3 flatpak-cargo-generator.py $(CURDIR)/Cargo.lock -o $(CURDIR)/build-aux/flatpak/cargo-sources.json && deactivate
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
+ flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir ./build-aux/flatpak/systems.tranquil.Map.yml
+ flatpak build-bundle repo dist/$(filename).flatpak systems.tranquil.Map
$(linuxdeploy):
@mkdir -p .cache
curl -L -o $(linuxdeploy) $(linuxdeploy_url)
chmod +x $(linuxdeploy)
-package-appimage: build $(linuxdeploy)
+package-appimage: $(linuxdeploy)
ifeq ($(findstring linux,$(target)),linux)
- @rm -f *.AppImage
- @$(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)
+ $(MAKE) build-container-trixie
+ @echo "=== Building AppImage ==="
+ ./scripts/build_appimage.sh $(container_image_prefix) trixie $(app_name) $(arch) $(channel) $(linuxdeploy)
+ifeq ($(clean_images),1)
+ podman rmi $(container_image_prefix):trixie
+endif
endif
# 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:
- @$(eval staging := $(shell mktemp -d))
- rsync -a --filter=':- .gitignore' --exclude='.git' . $(staging)/src
- cp build-aux/arch/PKGBUILD $(staging)/
- 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)
-
-# Internal target: runs inside fedora container
-package-rpm: build
-ifeq ($(findstring linux,$(target)),linux)
- cargo generate-rpm --profile $(profile) --target $(target)
- mv target/$(target)/generate-rpm/*.rpm $(filename)-$(distro).rpm
-endif
-
-# Internal target: runs inside debian container
-package-deb: build
-ifeq ($(findstring linux,$(target)),linux)
- cargo deb --profile $(profile) --target $(target)
- mv target/$(target)/debian/*.deb $(filename)-$(distro).deb
-endif
-
-#
-# Podman wrappers for distro-specific builds
-#
-
-package-pacman-podman: build-container-arch
+package-arch: build-container-arch
@echo "=== Building Arch package for $(arch) ==="
- 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/'
+ ./scripts/build_arch.sh $(container_image_prefix) arch $(app_name) $(arch) $(channel)
ifeq ($(clean_images),1)
podman rmi $(container_image_prefix):arch
endif
-package-rpm-podman:
+package-rpm:
ifndef distro
- $(error distro is required, e.g., make package-rpm-podman distro=fedora43)
+ $(error distro is required, e.g., make package-rpm distro=fedora43)
endif
$(MAKE) build-container-$(distro)
@echo "=== Building RPM for $(distro) ($(arch)) ==="
- podman run --rm -v $(CURDIR):/src:Z -w /src $(container_image_prefix):$(distro) \
- make profile=$(profile) channel=$(channel) target=$(target) distro=$(distro) package-rpm
+ ./scripts/build_rpm.sh $(container_image_prefix) $(distro) $(app_name) $(arch) $(channel)
ifeq ($(clean_images),1)
podman rmi $(container_image_prefix):$(distro)
endif
-package-deb-podman:
+package-deb:
ifndef distro
- $(error distro is required, e.g., make package-deb-podman distro=bookworm)
+ $(error distro is required, e.g., make package-deb distro=trixie)
endif
$(MAKE) build-container-$(distro)
@echo "=== Building DEB for $(distro) ($(arch)) ==="
- podman run --rm -v $(CURDIR):/src:Z -w /src $(container_image_prefix):$(distro) \
- make profile=$(profile) channel=$(channel) target=$(target) distro=$(distro) package-deb
+ ./scripts/build_deb.sh $(container_image_prefix) $(distro) $(app_name) $(arch) $(channel)
ifeq ($(clean_images),1)
podman rmi $(container_image_prefix):$(distro)
endif
package-rpm-all:
@for v in $(fedora_versions); do \
- $(MAKE) distro=$$v package-rpm-podman; \
+ $(MAKE) distro=$$v package-rpm; \
done
package-deb-all:
@for v in $(debian_versions); do \
- $(MAKE) distro=$$v package-deb-podman; \
+ $(MAKE) distro=$$v package-deb; \
done
-package: package-tar package-flatpak package-appimage package-pacman-podman package-rpm-all package-deb-all
+package: package-tar package-flatpak package-appimage package-arch package-rpm-all package-deb-all
# Distribution #################################################################
-distribute-tar:
- @$(call sign_and_deploy,$(filename).tar.gz)
-
distribute-flatpak:
@$(call sign_and_deploy,$(filename).flatpak)
@@ -242,7 +152,7 @@ distribute-deb:
rsync -avz $(filename)-$$v.deb.minisig $(deploy_host):$(deploy_path); \
done
-distribute: distribute-tar distribute-flatpak distribute-appimage distribute-pacman distribute-rpm distribute-deb
+distribute: distribute-tar distribute-flatpak distribute-appimage distribute-arch distribute-rpm distribute-deb
# Release ######################################################################
@@ -276,7 +186,6 @@ uninstall:
done
ci: lint
-# Installation #################################################################
ifeq ($(GIT_REF),refs/heads/main)
$(MAKE) -e channel=unstable release
else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
@@ -285,13 +194,11 @@ else
@echo "Not in CI environment."
endif
-.PHONY: default build test coverage format lint \
- find_translatable_files extract_strings compile_translations \
+.PHONY: default \
update_flatpak_dependencies \
- package-tar package-flatpak package-appimage \
- package-pacman package-rpm package-deb \
- package-pacman-podman package-rpm-podman package-deb-podman \
+ package-flatpak package-appimage \
+ package-arch package-rpm package-deb \
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 \
+ distribute-flatpak distribute-appimage distribute-arch distribute-rpm distribute-deb distribute \
+ release install uninstall \
build-containers