aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml16
-rw-r--r--Makefile95
-rw-r--r--README.md39
-rw-r--r--build-aux/systems.tranquil.Map.yml2
-rw-r--r--resources/systems.tranquil.Map.service2
-rwxr-xr-xscripts/sign.sh18
6 files changed, 135 insertions, 37 deletions
diff --git a/Cargo.toml b/Cargo.toml
index df3b9fe..b441a2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,13 +29,23 @@ panic = "abort"
[package.metadata.generate-rpm]
assets = [
{ source = "target/release/map", dest = "/usr/bin/map", mode = "755" },
- # missing all the other files in resources
+ { source = "resources/logo.svg", dest = "/usr/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg", mode = "644" },
+ { source = "resources/systems.tranquil.Map.desktop", dest = "/usr/share/applications/systems.tranquil.Map.desktop", mode = "644" },
+ { source = "resources/systems.tranquil.Map.metainfo.xml", dest = "/usr/share/metainfo/systems.tranquil.Map.metainfo.xml", mode = "644" },
+ { source = "resources/systems.tranquil.Map.service", dest = "/usr/share/dbus-1/services/systems.tranquil.Map.service", mode = "644" },
+ { source = "resources/wmap.lang", dest = "/usr/share/gtksourceview-5/language-specs/wmap.lang", mode = "644" },
+ { source = "po/en_US/LC_MESSAGES/systems.tranquil.Map.mo", dest = "/usr/share/locale/en_US/LC_MESSAGES/systems.tranquil.Map.mo", mode = "644" },
]
[package.metadata.deb]
assets = [
- ["target/release/map", "/usr/bin/map", "755" ],
- # missing all the other files in resources
+ ["target/release/map", "/usr/bin/map", "755"],
+ ["resources/logo.svg", "/usr/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg", "644"],
+ ["resources/systems.tranquil.Map.desktop", "/usr/share/applications/systems.tranquil.Map.desktop", "644"],
+ ["resources/systems.tranquil.Map.metainfo.xml", "/usr/share/metainfo/systems.tranquil.Map.metainfo.xml", "644"],
+ ["resources/systems.tranquil.Map.service", "/usr/share/dbus-1/services/systems.tranquil.Map.service", "644"],
+ ["resources/wmap.lang", "/usr/share/gtksourceview-5/language-specs/wmap.lang", "644"],
+ ["po/en_US/LC_MESSAGES/systems.tranquil.Map.mo", "/usr/share/locale/en_US/LC_MESSAGES/systems.tranquil.Map.mo", "644"],
]
[lints.clippy]
diff --git a/Makefile b/Makefile
index e0533ff..5992396 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
profile := dev
target = $(shell rustc -vV | grep host | awk '{print $$2}')
-architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
+architectures := aarch64-unknown-linux-gnu
app_name := map
deploy_host := deploy@build.r.bdr.sh
deploy_path := /srv/http/build.r.bdr.sh/$(app_name)-linux
-install_path := /usr/local/bin/$(app_name)
+prefix := /usr/local
flatpak_cargo_generator := $(HOME)/projects/vendor/flatpak-builder-tools/cargo
define sign_and_deploy
@@ -62,50 +62,95 @@ po/%/LC_MESSAGES/systems.tranquil.Map.mo: po/%.po
# Packaging ####################################################################
-package: $(architectures)
-
-release: rpm tar deb
- @$(eval filename := $(app_name)-$(target)-$(channel))
+filename = $(app_name)-$(target)-$(channel)
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
-flatpak: update_flatpak_dependencies
- @flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir ./build-aux/systems.tranquil.Map.yml
+package-rpm: build
+ifeq ($(findstring linux,$(target)),linux)
+ cargo generate-rpm --profile $(profile) --target $(target)
+ mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
+endif
-deb: build
+package-deb: build
ifeq ($(findstring linux,$(target)),linux)
- @$(eval filename := $(app_name)-$(target)-$(channel))
cargo deb --profile $(profile) --target $(target)
mv target/$(target)/debian/*.deb $(filename).deb
- @$(call sign_and_deploy,$(filename).deb)
endif
-rpm: build
-ifeq ($(findstring linux,$(target)),linux)
- @$(eval filename := $(app_name)-$(target)-$(channel))
- cargo generate-rpm --profile $(profile) --target $(target)
- mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
+package-tar: build
+ @$(eval staging := $(shell mktemp -d))
+ @install -Dm0755 target/$(target)/$(profile)/$(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)
+
+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
+
+# Distribution #################################################################
+
+distribute-rpm:
@$(call sign_and_deploy,$(filename).rpm)
-endif
-tar: build
- @$(eval filename := $(app_name)-$(target)-$(channel))
- tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
+distribute-deb:
+ @$(call sign_and_deploy,$(filename).deb)
+
+distribute-tar:
@$(call sign_and_deploy,$(filename).tar.gz)
-# Distribution #################################################################
+distribute-flatpak:
+ @$(call sign_and_deploy,$(filename).flatpak)
+
+distribute: distribute-rpm distribute-deb distribute-tar distribute-flatpak
+
+release: package distribute
+
+# Installation #################################################################
install: build
- @cp target/$(target)/$(profile)/ $(install_path)
+ install -Dm0755 target/$(target)/$(profile)/$(app_name) $(prefix)/bin/$(app_name)
+ install -Dm0644 resources/logo.svg $(prefix)/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg
+ install -Dm0644 resources/systems.tranquil.Map.desktop $(prefix)/share/applications/systems.tranquil.Map.desktop
+ install -Dm0644 resources/systems.tranquil.Map.metainfo.xml $(prefix)/share/metainfo/systems.tranquil.Map.metainfo.xml
+ install -Dm0644 resources/systems.tranquil.Map.service $(prefix)/share/dbus-1/services/systems.tranquil.Map.service
+ install -Dm0644 resources/wmap.lang $(prefix)/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 $(prefix)/share/locale/$$locale/LC_MESSAGES/systems.tranquil.Map.mo; \
+ done
+
+uninstall:
+ rm -f $(prefix)/bin/$(app_name)
+ rm -f $(prefix)/share/icons/hicolor/scalable/apps/systems.tranquil.Map.svg
+ rm -f $(prefix)/share/applications/systems.tranquil.Map.desktop
+ rm -f $(prefix)/share/metainfo/systems.tranquil.Map.metainfo.xml
+ rm -f $(prefix)/share/dbus-1/services/systems.tranquil.Map.service
+ rm -f $(prefix)/share/gtksourceview-5/language-specs/wmap.lang
+ @for po_file in po/*.po; do \
+ locale=$$(basename "$$po_file" .po); \
+ rm -f $(prefix)/share/locale/$$locale/LC_MESSAGES/systems.tranquil.Map.mo; \
+ done
# CI ###########################################################################
ci: lint coverage
ifeq ($(GIT_REF),refs/heads/main)
- $(MAKE) -e profile=release -e channel=unstable package
+ $(MAKE) -e profile=release -e channel=unstable $(architectures)
else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
- $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) $(architectures)
endif
$(architectures):
@@ -116,4 +161,4 @@ else
endif
-.PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format flatpak update_flatpak_dependencies extract_strings find_translatable_files compile_translations
+.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 test coverage format update_flatpak_dependencies extract_strings find_translatable_files compile_translations install uninstall
diff --git a/README.md b/README.md
index 34a5b68..d3818a8 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,15 @@ A wardley mapping tool: Write some text, get a diagram
Run `make build`
+## Installing
+
+For a quick local install without packaging:
+
+* `make install` - installs to `/usr/local` (may require sudo)
+* `make uninstall` - removes installed files
+
+To install to a different prefix: `make install prefix=/opt/map`
+
## Testing
Run `make test`
@@ -15,18 +24,34 @@ Run `make test`
* To format: `make format`
* To lint: `make lint`
-## Disributing
+## Distributing
+
+Available package formats: deb, rpm, tar.gz, flatpak
+
+### Main Targets
+
+* `make package` - creates all package types for the current architecture (no upload)
+* `make distribute` - signs and uploads existing packages
+* `make release` - full workflow (package + distribute)
+
+### Individual Targets
+
+For more control, use individual package or distribute targets:
-Not yet complete. The current `make distribute` will make a deb and rpm, but is
-missing desktop files and potentially more desktop friendly distributions like
-flatpak.
+* `make package-deb` - create .deb package
+* `make package-rpm` - create .rpm package
+* `make package-tar` - create .tar.gz archive
+* `make package-flatpak` - create .flatpak bundle
-### Flatpak
+* `make distribute-deb` - sign and upload .deb
+* `make distribute-rpm` - sign and upload .rpm
+* `make distribute-tar` - sign and upload .tar.gz
+* `make distribute-flatpak` - sign and upload .flatpak
-Build it with `make flatpak`
+### Flatpak Notes
Since flatpak expects offline building, we use `flatpak-cargo-generator` to
-generate the sources. This will be done every time you run `make flatpak`.
+generate the sources. This will be done every time you run `make package-flatpak`.
The project assumes `flatpak-cargo-generator.py` lives in
`~/projects/vendor/flatpak-builder-tools/cargo`, but you can override this with
diff --git a/build-aux/systems.tranquil.Map.yml b/build-aux/systems.tranquil.Map.yml
index a5becef..1dc6076 100644
--- a/build-aux/systems.tranquil.Map.yml
+++ b/build-aux/systems.tranquil.Map.yml
@@ -4,7 +4,7 @@ runtime-version: '48'
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
-command: systems.tranquil.Map
+command: map
finish-args:
- --device=dri
- --share=ipc
diff --git a/resources/systems.tranquil.Map.service b/resources/systems.tranquil.Map.service
index c113402..1c89966 100644
--- a/resources/systems.tranquil.Map.service
+++ b/resources/systems.tranquil.Map.service
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=systems.tranquil.Map
-Exec=/app/bin/systems.tranquil.Map --gapplication-service
+Exec=/app/bin/map --gapplication-service
diff --git a/scripts/sign.sh b/scripts/sign.sh
new file mode 100755
index 0000000..b3bfe47
--- /dev/null
+++ b/scripts/sign.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set +x
+if [ $# -ne 3 ]; then
+ echo "Usage: $0 <file> <channel> <architecture>"
+ exit 1
+fi
+
+FILE="$1"
+VERSION="$2"
+PLATFORM="$3"
+COMMENT="Version: ${VERSION}, File: $(basename ${FILE}) Built on: $(date +'%Y-%m-%d %H:%M'), Platform: ${PLATFORM}"
+
+if [ -f ~/.minisign/minisign.pass ]; then
+ cat ~/.minisign/minisign.pass | minisign -Sm "${FILE}" -t "${COMMENT}"
+else
+ minisign -Sm "${FILE}" -t "${COMMENT}"
+fi