guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/04: perl-file-mimeinfo: Fix cross-compilation.


From: guix-commits
Subject: 03/04: perl-file-mimeinfo: Fix cross-compilation.
Date: Sat, 6 Aug 2022 12:24:12 -0400 (EDT)

mothacehe pushed a commit to branch master
in repository guix.

commit b914ccc91525d847683b79f482b9d318b7f94aec
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Tue Aug 2 14:13:28 2022 +0200

    perl-file-mimeinfo: Fix cross-compilation.
    
    * gnu/packages/freedesktop.scm
    (perl-file-mimeinfo)[arguments]<#:phases>: Make it a G-exp to avoid messy 
nested
    quasiquotation.
    {wrap-programs}: When cross-compiling, don't use the PELRL5LIB environment
    variable, instead use 'search-path-as-list'.
    
    Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
 gnu/packages/freedesktop.scm | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 8816ef5542..6713e449e6 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -1948,19 +1948,31 @@ applications define in those files.")
     (arguments
      ;; Some tests fail due to requiring the mimetype of perl files to be
      ;; text/plain when they are actually application/x-perl.
-     `(#:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'wrap-programs
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (for-each (lambda (prog)
-                           (wrap-program (string-append out "/bin/" prog)
-                             `("PERL5LIB" ":" prefix
-                               (,(string-append (getenv "PERL5LIB") ":" out
-                                                "/lib/perl5/site_perl")))))
-                         '("mimeopen" "mimetype")))
-             #t)))))
+     (list #:tests? #f
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'install 'wrap-programs
+                 ;; TODO(staging): Make unconditional.
+                 (lambda* (#:key #$@(if (%current-target-system)
+                                        #~(inputs)
+                                        #~()) outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     (for-each
+                      (lambda (prog)
+                        (wrap-program (string-append out "/bin/" prog)
+                          `("PERL5LIB" ":" prefix
+                            ;; PERL5LIB looks in 'native-inputs', not 'inputs',
+                            ;; whereas the latter is required for
+                            ;; cross-compilation.
+                            #$(if (%current-target-system)
+                                  #~,(search-path-as-list
+                                      '("lib/perl5/site_perl")
+                                      (map cdr (append inputs outputs)))
+                                  #~(,(string-append
+                                       (getenv "PERL5LIB")
+                                       ":" out "/lib/perl5/site_perl"))))))
+                      '("mimeopen" "mimetype")))
+                   #t)))))
     (home-page "https://metacpan.org/release/File-MimeInfo";)
     (synopsis "Determine file type from the file name")
     (description



reply via email to

[Prev in Thread] Current Thread [Next in Thread]