summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2024-03-09 16:01:51 +0100
committerJosselin Poiret <dev@jpoiret.xyz>2024-03-09 16:03:25 +0100
commit3ecb04aaa2954f0da8191e337605b38eff4c6e9b (patch)
tree1952350ed04afa98ef32ec888624c523b0e5c3f6
parentde3a26ef8f4be727f4c189f1e3c3f9f940328deb (diff)
gnu: eudev: Separate hardware database generation.
Eudev now has a hardware database /etc/udev/hwdb.bin made up of descriptions installed in the /lib/udev/hwdb.d directory of each package, and more generally, UDEV_HWDB_PATH. This database index is compiled with udevadm hwdb --update. The udev-service-type collects the files and compiles the index. Previously, the hardware description files provided by eudev would be compiled into $prefix/etc/udev/hwdb.bin in the eudev output. * gnu/packages/linux.scm (eudev) [#:phases] <allow-eudev-hwdb>: New phase. <install-in-lib>: New phase. <build-hwdb>: Remove phase. [#:configure-flags]: Set sysconfdir to avoid a prefix. [native-search-paths]: Add UDEV_HWDB_PATH. * gnu/packages/patches/eudev-rules-directory.patch: Rebase it. Change-Id: I2eabde9fa18d783b2c19230749e33c4ba0c5933d
-rw-r--r--gnu/packages/linux.scm49
1 files changed, 36 insertions, 13 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index a0b37183d3..6324650f6d 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4329,6 +4329,31 @@ to the in-kernel OOM killer.")
(substitute* "man/make.sh"
(("/usr/bin/xsltproc")
(search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+ (add-before 'bootstrap 'install-in-lib
+ (lambda _
+ ;; When the udev-service-type instantiates /etc, it collects
+ ;; hardware files from the <package>/lib/udev/hwdb.d directories
+ ;; of different packages. Since we set sysconfdir to /etc, the
+ ;; only package-dependent location we can install hwdb files is
+ ;; in <package>/lib/udev/hwdb.d. Eudev is configured to install
+ ;; these files in sysconfdir, but they should be placed into
+ ;; udevlibexecdir.
+ (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+ (call-with-output-file "hwdb/Makefile.am"
+ (lambda (port)
+ (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
+ (format port "include ./files.am")))
+ (substitute* "hwdb/files.am"
+ (("dist_udevhwdb_DATA =")
+ "dist_hardwarelib_DATA ="))
+ ;; Do not install the empty udev.conf template.
+ (substitute* "src/udev/Makefile.am"
+ (("dist_udevconf_DATA =")
+ "dist_noinst_DATA ="))
+ ;; Do not ensure that /etc/udev/rules.d exists.
+ (substitute* "rules/Makefile.am"
+ (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+ "true"))))
(add-after 'install 'move-static-library
(lambda _
(let ((source (string-append #$output "/lib/libudev.a"))
@@ -4340,19 +4365,17 @@ to the in-kernel OOM killer.")
;; such that Libtool looks for it in the usual places.
(substitute* (string-append #$output "/lib/libudev.la")
(("old_library=.*")
- "old_library=''\n")))))
- (add-after 'install 'build-hwdb
- (lambda _
- ;; Build OUT/etc/udev/hwdb.bin. This allows 'lsusb' and
- ;; similar tools to display product names.
- ;;
- ;; XXX: This can't be done when cross-compiling. Find another way
- ;; to generate hwdb.bin for cross-built systems.
- #$@(if (%current-target-system)
- #~(#t)
- #~((invoke (string-append #$output "/bin/udevadm")
- "hwdb" "--update" "--root" #$output))))))
- #:configure-flags #~(list "--enable-manpages")))
+ "old_library=''\n"))))))
+ #:configure-flags
+ #~(list "--enable-manpages"
+ ;; By default, autoconf uses $prefix/etc. The udev-service-type
+ ;; makes sure /etc is set up with rules and hardware file
+ ;; descriptions.
+ "--sysconfdir=/etc")))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "UDEV_HWDB_PATH")
+ (files '("lib/udev/hwdb.d")))))
(native-inputs
(list autoconf
automake