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.
This commit is contained in:
Benedikt Heine 2017-12-21 18:25:13 +01:00
parent 4908a75a89
commit 8f17d6026b

View File

@ -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