From 61f9ea495472186ba3d15506fa5525a60f61cc25 Mon Sep 17 00:00:00 2001 From: Evan Maddock <5157277+EbonJaeger@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:39:06 -0400 Subject: [PATCH] build: Add support for DESTDIR (#2783) This makes it easier for distros to use the Makefile when creating packages. It enables us to specify a base destination directory to install the project files to. E.g., on Solus, when creating eopkgs, files must be installed to a special directory path, which becomes the package files. I believe Fedora packages, and others, are the same. Signed-off-by: Evan Maddock (cherry picked from commit 45f6232e320dfedc5c1339b4aba37a3c2ec5604b) --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fa2d4f042..e3ea3707c 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ BINARY_NAME=dms CORE_DIR=core BUILD_DIR=$(CORE_DIR)/bin PREFIX ?= /usr/local -INSTALL_DIR=$(PREFIX)/bin -DATA_DIR=$(PREFIX)/share +INSTALL_DIR=$(DESTDIR)$(PREFIX)/bin +DATA_DIR=$(DESTDIR)$(PREFIX)/share ICON_DIR=$(DATA_DIR)/icons/hicolor/scalable/apps USER_HOME := $(if $(SUDO_USER),$(shell getent passwd $(SUDO_USER) | cut -d: -f6),$(HOME)) @@ -62,7 +62,7 @@ install-systemd: @echo "Installing systemd user service..." @mkdir -p $(SYSTEMD_USER_DIR) @if [ -n "$(SUDO_USER)" ]; then chown -R $(SUDO_USER):"$(id -gn $SUDO_USER)" $(SYSTEMD_USER_DIR); fi - @sed 's|/usr/bin/dms|$(INSTALL_DIR)/dms|g' $(ASSETS_DIR)/systemd/dms.service > $(SYSTEMD_USER_DIR)/dms.service + @sed 's|/usr/bin/dms|$(PREFIX)/bin/dms|g' $(ASSETS_DIR)/systemd/dms.service > $(SYSTEMD_USER_DIR)/dms.service @chmod 644 $(SYSTEMD_USER_DIR)/dms.service @if [ -n "$(SUDO_USER)" ]; then chown $(SUDO_USER):"$(id -gn $SUDO_USER)" $(SYSTEMD_USER_DIR)/dms.service; fi @echo "Systemd service installed to $(SYSTEMD_USER_DIR)/dms.service"