From 8d20a23e38883f45c78f48c8574ac93945b4cb03 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Tue, 24 Dec 2024 07:33:28 +0100 Subject: [PATCH] xpadneo, installer: Support installing documentation Signed-off-by: Kai Krakow --- Makefile | 15 ++++++++++----- docs/PACKAGING.md | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c7e01e2f..e21aa1f7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ ETC_PREFIX ?= /etc +DOC_PREFIX ?= /usr/share/doc/xpadneo MODPROBE_CONFS := xpadneo.conf UDEV_RULES := 60-xpadneo.rules 70-xpadneo-disable-hidraw.rules +DOC_SRCS := NEWS.md $(wildcard docs/[0-9A-Z]*.md) +DOCS := $(notdir $(DOC_SRCS)) ifeq ($(PREFIX),) DKMS ?= dkms @@ -16,11 +19,12 @@ help: @echo "Targets:" @echo "help This help" @echo "build Prepare the package for DKMS deployment" - @echo "install Install the package and DKMS source code" - @echo "uninstall Uninstall the package and DKMS source code" + @echo "install Install the package, documentation and DKMS source code" + @echo "uninstall Uninstall the package, documentation and DKMS source code" @echo @echo "Variables:" @echo "PREFIX Install files into this prefix" + @echo "DOC_PREFIX Install doc files relative to the prefix (defaults to /usr/share/doc/xpadneo)" @echo "ETC_PREFIX Install etc files relative to the prefix (defaults to /etc)" @echo @echo "Using PREFIX requires handling dkms commands in your package script." @@ -36,15 +40,16 @@ build: VERSION $(MAKE) VERSION="$(shell cat VERSION)" -C hid-xpadneo dkms.conf install: build - mkdir -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d + mkdir -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(PREFIX)$(DOC_PREFIX) install -D -m 0644 -t $(PREFIX)$(ETC_PREFIX)/modprobe.d $(MODPROBE_CONFS:%=hid-xpadneo/etc-modprobe.d/%) install -D -m 0644 -t $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(UDEV_RULES:%=hid-xpadneo/etc-udev-rules.d/%) + install -D -m 0644 -t $(PREFIX)$(DOC_PREFIX) $(DOC_SRCS) $(DKMS) add hid-xpadneo uninstall: VERSION $(DKMS) remove "hid-xpadneo/$(shell cat VERSION)" --all rm -Rf "$(PREFIX)/usr/src/hid-xpadneo-$(shell cat VERSION)" - rm -f $(PREFIX)$(UDEV_RULES:%=$(ETC_PREFIX)/udev/rules.d/%) + rm -f $(DOCS:%=$(PREFIX)$(DOC_PREFIX)/%) rm -f $(UDEV_RULES:%=$(PREFIX)$(ETC_PREFIX)/udev/rules.d/%) rm -f $(MODPROBE_CONFS:%=$(PREFIX)$(ETC_PREFIX)/modprobe.d/%) - rmdir --ignore-fail-on-non-empty -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d + rmdir --ignore-fail-on-non-empty -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(PREFIX)$(DOC_PREFIX) diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index 7fdf414c..3efcc314 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -85,6 +85,10 @@ Makefile:7: Installing to prefix, dkms commands will not be run! : SKIPPING dkms add hid-xpadneo ``` +Documentation will be installed to `DOC_PREFIX` and follows the same rules as +above. Default location is `/usr/share/doc/xpadneo`. Some distributions may +want to override this with a versioned path. + ### Uninstallation