From 7d4b32f480ea25aa0990b05df3dcc64aa9aacb29 Mon Sep 17 00:00:00 2001 From: wael <40663@proton.me> Date: Mon, 21 Nov 2022 09:05:19 +0300 Subject: [PATCH] make libnotify & dunstify optional --- Makefile | 10 ++++++++-- README.md | 3 ++- config.mk | 8 ++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38f27f6aa..843ba8d77 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ DEPS := ${SRC:.c=.d} ${TEST_SRC:.c=.d} .PHONY: all debug -all: doc dunst dunstify service +all: doc dunst service debug: CFLAGS += ${CPPFLAGS_DEBUG} ${CFLAGS_DEBUG} debug: LDFLAGS += ${LDFLAGS_DEBUG} @@ -64,8 +64,11 @@ ${OBJ} ${TEST_OBJ}: Makefile config.mk dunst: ${OBJ} main.o ${CC} -o ${@} ${OBJ} main.o ${CFLAGS} ${LDFLAGS} +ifneq (0,${DUNSTIFY}) +all: dunstify dunstify: dunstify.o ${CC} -o ${@} dunstify.o ${CFLAGS} ${LDFLAGS} +endif .PHONY: test test-valgrind test-coverage test: test/test clean-coverage-run @@ -181,7 +184,7 @@ clean-wayland-protocols: uninstall uninstall-dunstctl uninstall-dunstrc \ uninstall-service uninstall-service-dbus uninstall-service-systemd \ uninstall-keepconf uninstall-purge -install: install-dunst install-dunstctl install-dunstrc install-service install-dunstify +install: install-dunst install-dunstctl install-dunstrc install-service install-dunst: dunst doc install -Dm755 dunst ${DESTDIR}${BINDIR}/dunst @@ -206,8 +209,11 @@ install-service-systemd: service-systemd install -Dm644 dunst.systemd.service ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service endif +ifneq (0,${DUNSTIFY}) +install: install-dunstify install-dunstify: dunstify install -Dm755 dunstify ${DESTDIR}${BINDIR}/dunstify +endif uninstall: uninstall-keepconf uninstall-purge: uninstall-keepconf uninstall-dunstrc diff --git a/README.md b/README.md index 2b71402ef..4c83322f2 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ distro's repositories, don't worry, it's not hard to build it yourself. - libxss - glib - pango/cairo -- libnotify (optional, for dunstify) +- libnotify (can build without, for dunstify, see [make parameters](#make-parameters)) - wayland-client (can build without, see [make parameters](#make-parameters)) - wayland-protocols (optional, for recompiling protocols) - xdg-utils (optional, xdg-open is the default 'browser' for opening URLs) @@ -113,6 +113,7 @@ sudo make install - `MANDIR=`: Set the prefix of the manpage. (Default: `${DATADIR}/man`) - `SYSTEMD=(0|1)`: Disable/Enable the systemd unit. (Default: autodetect systemd) - `WAYLAND=(0|1)`: Disable/Enable wayland support. (Default: 1 (enabled)) +- `DUNSTIFY=(0|1)`: Disable/Enable the libnotify dunstctl utility. (Default: 1 (enabled)) - `SERVICEDIR_SYSTEMD=`: The path to put the systemd user service file. Unused, if `SYSTEMD=0`. (Default: `${PREFIX}/lib/systemd/user`) - `SERVICEDIR_DBUS=`: The path to put the dbus service file. (Default: `${DATADIR}/dbus-1/services`) - `EXTRA_CFLAGS=`: Additional flags for the compiler. diff --git a/config.mk b/config.mk index 753797946..031b6c548 100644 --- a/config.mk +++ b/config.mk @@ -30,6 +30,12 @@ VALGRIND ?= valgrind # You can also use "make WAYLAND=0" to build without wayland # WAYLAND ?= 0 +# Disable dependency on libnotify. this will remove the ability +# to easily send notifications using dunstify or notify-send via D-Bus. +# Do this if you have your own utility to send notifications. +# Other applications will continue to work, as they use direct D-Bus. +# DUNSTIFY ?=0 + ifneq (0, ${WAYLAND}) ENABLE_WAYLAND= -DENABLE_WAYLAND endif @@ -54,8 +60,10 @@ pkg_config_packs := gio-2.0 \ xscrnsaver \ +ifneq (0,${DUNSTIFY}) # dunstify also needs libnotify pkg_config_packs += libnotify +endif ifneq (0,${WAYLAND}) pkg_config_packs += wayland-client