Skip to content

Commit

Permalink
xpadneo, installer: Support installing documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Dec 24, 2024
1 parent b37301e commit 8d20a23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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."
Expand All @@ -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)
4 changes: 4 additions & 0 deletions docs/PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8d20a23

Please sign in to comment.