Add Makefile with install target for distro packaging

Adds build, install, and uninstall targets with standard PREFIX/DESTDIR
support. Installs binary, desktop file, metainfo, GSettings schema,
app icons, scalable action icons (outlay + tabler), and bundled fonts.
This allows distro packagers (Nix, Arch, Debian, etc.) to properly
install icons alongside the binary so GTK can find them at runtime.
This commit is contained in:
2026-03-04 23:44:00 +02:00
parent bdf200211b
commit 1849537c0c

58
Makefile Normal file
View File

@@ -0,0 +1,58 @@
PREFIX ?= /usr/local
DESTDIR ?=
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share
ICON_DATA = outlay-gtk/data/icons
DESKTOP_FILE = outlay-gtk/data/com.outlay.app.desktop
METAINFO_FILE = outlay-gtk/data/com.outlay.app.metainfo.xml
SCHEMA_FILE = outlay-gtk/data/com.outlay.app.gschema.xml
.PHONY: build install uninstall
build:
cargo build --release -p outlay-gtk
install: build
install -Dm755 target/release/outlay-gtk $(DESTDIR)$(BINDIR)/outlay-gtk
# Desktop file
install -Dm644 $(DESKTOP_FILE) $(DESTDIR)$(DATADIR)/applications/com.outlay.app.desktop
# AppStream metainfo
install -Dm644 $(METAINFO_FILE) $(DESTDIR)$(DATADIR)/metainfo/com.outlay.app.metainfo.xml
# GSettings schema
install -Dm644 $(SCHEMA_FILE) $(DESTDIR)$(DATADIR)/glib-2.0/schemas/com.outlay.app.gschema.xml
# App icons (raster sizes)
for size_dir in $(ICON_DATA)/hicolor/*/apps; do \
size=$$(basename "$$(dirname "$$size_dir")"); \
for icon in "$$size_dir"/com.outlay.app.*; do \
[ -f "$$icon" ] || continue; \
install -Dm644 "$$icon" $(DESTDIR)$(DATADIR)/icons/hicolor/$$size/apps/$$(basename "$$icon"); \
done; \
done
# Scalable action icons (outlay custom + tabler)
for svg in $(ICON_DATA)/hicolor/scalable/actions/outlay-*.svg \
$(ICON_DATA)/hicolor/scalable/actions/tabler-*.svg; do \
[ -f "$$svg" ] || continue; \
install -Dm644 "$$svg" $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/$$(basename "$$svg"); \
done
# Bundled fonts
for ttf in outlay-gtk/data/fonts/*.ttf; do \
[ -f "$$ttf" ] || continue; \
install -Dm644 "$$ttf" $(DESTDIR)$(DATADIR)/fonts/outlay/$$(basename "$$ttf"); \
done
uninstall:
rm -f $(DESTDIR)$(BINDIR)/outlay-gtk
rm -f $(DESTDIR)$(DATADIR)/applications/com.outlay.app.desktop
rm -f $(DESTDIR)$(DATADIR)/metainfo/com.outlay.app.metainfo.xml
rm -f $(DESTDIR)$(DATADIR)/glib-2.0/schemas/com.outlay.app.gschema.xml
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/*/apps/com.outlay.app.*
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/outlay-*.svg
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/tabler-*.svg
rm -rf $(DESTDIR)$(DATADIR)/fonts/outlay