From 8f17d6026b3da5b3266d2cad4cf4eecde7557f86 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Thu, 21 Dec 2017 18:25:13 +0100 Subject: [PATCH] Add configurable path variables for services Setting PREFIX to a location different to /usr, the install routine fails to install the systemd and dbus service files. These are installed, but in the PREFIX directory and not /usr. DBus and systemd usually only read their files from /usr/ and ignore files in /usr/local. Now by default, we're asking pkg-config, where to install it. Mostly, this will be /usr and this conflicts the FHS. But it's the user's intent to install dunst and (possibly) override the package manager's files belonging to dunst. At the current point, even DBus ignores the PREFIX and installs its systemd service file to the location specified by pkg-config. --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c9bd3e9..9567d47 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,18 @@ ifneq ($(wildcard ./.git/.),) VERSION := $(shell git describe --tags) endif +SERVICEDIR_DBUS ?= $(shell pkg-config dbus-1 --variable=session_bus_services_dir) +SERVICEDIR_DBUS := ${SERVICEDIR_DBUS} +ifeq (,${SERVICEDIR_DBUS}) +$(error "Failed to query pkg-config for package 'dbus-1'!") +endif + +SERVICEDIR_SYSTEMD ?= $(shell pkg-config systemd --variable=systemduserunitdir) +SERVICEDIR_SYSTEMD := ${SERVICEDIR_SYSTEMD} +ifeq (,${SERVICEDIR_SYSTEMD}) +$(error "Failed to query pkg-config for package 'systemd'!") +endif + LIBS := $(shell pkg-config --libs ${pkg_config_packs}) INCS := $(shell pkg-config --cflags ${pkg_config_packs}) @@ -103,13 +115,12 @@ install-doc: install -m644 dunstrc ${DESTDIR}${PREFIX}/share/dunst install-service: service - mkdir -p ${DESTDIR}${PREFIX}/share/dbus-1/services/ - install -m644 org.knopwob.dunst.service ${DESTDIR}${PREFIX}/share/dbus-1/services - install -Dm644 dunst.systemd.service ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service + install -Dm644 org.knopwob.dunst.service ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service + install -Dm644 dunst.systemd.service ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dunst rm -f ${DESTDIR}${MANPREFIX}/man1/dunst.1 - rm -f ${DESTDIR}${PREFIX}/share/dbus-1/services/org.knopwob.dunst.service - rm -f ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service + rm -f ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service + rm -f ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service rm -rf ${DESTDIR}${PREFIX}/share/dunst