Subject: [bug#68656] [PATCH core-updates 6/7] gnu: lvm2-static: Properly handle eudev dependency in pkg-config.

From: Josselin Poiret <[email-masked]>
Date: Mon, 22 Jan 2024 14:36:22 +0100

From: Josselin Poiret <[email-masked]>

* gnu/packages/linux.scm (lvm2-static): Add linking flags for the static eudev
output.

Change-Id: Ic43be600f0569a8ffa69544cbf661f05d82e2084
---
 gnu/packages/linux.scm | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 2977b8f88e..38a7caf71b 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4596,8 +4596,8 @@ (define-public lvm2-static
     (inherit lvm2)
     (name "lvm2-static")
 
-    ;; Propagate udev because libdevmapper.a depends on libudev.
-    (propagated-inputs `(("udev:static" ,eudev "static")))
+    (inputs `(,@(package-inputs lvm2)
+              ("udev:static" ,eudev "static")))
 
     (arguments
      (substitute-keyword-arguments (package-arguments lvm2)
@@ -4611,19 +4611,28 @@ (define-public lvm2-static
                  ;; it until the situation improves.
                  (delete "--enable-dmeventd" ,flags)))
        ((#:phases phases)
-        `(modify-phases ,phases
-           (add-before 'configure 'adjust-Makefile
-             (lambda _
-               ;; These fixes are related to the upstream libdm->device_mapper
-               ;; migration and will hopefully be fixed upstream in due time.
-               (substitute* "tools/Makefile.in"
-                 ;; This variable is empty in a static configuration and causes
-                 ;; an erroneous GCC command line.
-                 (("-L\\$\\(interfacebuilddir\\)") "")
-                 ;; Remove obsolete reference to libdevmapper.a.
-                 (("-ldevmapper") ""))
-               #t))))))
-    (synopsis "Logical volume management for Linux (statically linked)")))
+        #~(modify-phases #$phases
+            (add-before 'configure 'adjust-Makefile
+              (lambda _
+                ;; These fixes are related to the upstream libdm->device_mapper
+                ;; migration and will hopefully be fixed upstream in due time.
+                (substitute* "tools/Makefile.in"
+                  ;; This variable is empty in a static configuration and causes
+                  ;; an erroneous GCC command line.
+                  (("-L\\$\\(interfacebuilddir\\)") "")
+                  ;; Remove obsolete reference to libdevmapper.a.
+                  (("-ldevmapper") ""))
+                #t))
+            (add-after 'install 'adjust-pkgconfig
+              ;; The static eudev is missing its pkg config file, and I am not
+              ;; rebuilding it at this point.
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* (string-append #$output "/lib/pkgconfig/devmapper.pc")
+                  (("Requires.private: .*") "")
+                  (("Libs.private:")
+                   (format #f "Libs.private: -L~a -ludev"
+                           (dirname (search-input-file inputs "lib/libudev.a")))))))))))
+  (synopsis "Logical volume management for Linux (statically linked)")))
 
 (define-public thin-provisioning-tools
   (package
-- 
2.41.0