diff mbox series

[bug#36477,v3,16/48] gnu: eudev: Fix cross-compilation.

Message ID 20190902153333.11190-17-m.othacehe@gmail.com
State Accepted
Headers show
Series Add --target support to guix system | expand

Commit Message

Mathieu Othacehe Sept. 2, 2019, 3:33 p.m. UTC
* gnu/packages/linux.scm (eudev)[arguments]: Look for xsltproc in both
native-inputs and inputs. Also, do not run udevadm when cross-compiling.

We need to find another way to generate hwdb.bin file for cross-built systems.
---
 gnu/packages/linux.scm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Ludovic Courtès Sept. 4, 2019, 1:12 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> skribis:

> * gnu/packages/linux.scm (eudev)[arguments]: Look for xsltproc in both
> native-inputs and inputs. Also, do not run udevadm when cross-compiling.
>
> We need to find another way to generate hwdb.bin file for cross-built systems.

[...]

>           (add-before 'bootstrap 'patch-file-names
> -           (lambda* (#:key inputs #:allow-other-keys)
> +           (lambda* (#:key inputs native-inputs #:allow-other-keys)
>              (substitute* "man/make.sh"
>                (("/usr/bin/xsltproc")
> -                (string-append (assoc-ref inputs "xsltproc")
> +               (string-append (assoc-ref
> +                               (or native-inputs inputs) "xsltproc")
>                                 "/bin/xsltproc")))

Put this way this leads to a rebuild.  If you want to have it on master,
you’ll have to use ,@ tricks.  (And ‘core-updates’ is frozen.)

>           (add-after 'install 'build-hwdb
>             (lambda* (#:key outputs #:allow-other-keys)
>               ;; 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.
>               (let ((out (assoc-ref outputs "out")))
> -               (invoke (string-append out "/bin/udevadm")
> -                       "hwdb" "--update")))))

I guess we’d need to add ‘this-package’ to ‘native-inputs’ to do that,
right?

Ludo’.
Mathieu Othacehe Oct. 2, 2019, 9:38 a.m. UTC | #2
Hey,

>>               (let ((out (assoc-ref outputs "out")))
>> -               (invoke (string-append out "/bin/udevadm")
>> -                       "hwdb" "--update")))))
>
> I guess we’d need to add ‘this-package’ to ‘native-inputs’ to do that,
> right?

Yes but as this commands produces a binary and there is no "target"
option, some portability issues could arise.

Mathieu
diff mbox series

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bf1e00421f..0225f8c376 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2564,7 +2564,7 @@  from the module-init-tools project.")
               (patches (search-patches "eudev-rules-directory.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'make-source-writable
            (lambda _
@@ -2573,19 +2573,25 @@  from the module-init-tools project.")
              (for-each make-file-writable (find-files "."))
              #t))
          (add-before 'bootstrap 'patch-file-names
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
             (substitute* "man/make.sh"
               (("/usr/bin/xsltproc")
-                (string-append (assoc-ref inputs "xsltproc")
+               (string-append (assoc-ref
+                               (or native-inputs inputs) "xsltproc")
                                "/bin/xsltproc")))
             #t))
          (add-after 'install 'build-hwdb
            (lambda* (#:key outputs #:allow-other-keys)
              ;; 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.
              (let ((out (assoc-ref outputs "out")))
-               (invoke (string-append out "/bin/udevadm")
-                       "hwdb" "--update")))))
+               ,@(if (%current-target-system)
+                     '(#t)
+                     '((invoke (string-append out "/bin/udevadm")
+                               "hwdb" "--update")))))))
        #:configure-flags (list "--enable-manpages")))
     (native-inputs
      `(("autoconf" ,autoconf)