guix-commits
[Top][All Lists]
Advanced

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

01/03: gnu: autoconf: Support cross-build.


From: guix-commits
Subject: 01/03: gnu: autoconf: Support cross-build.
Date: Thu, 23 Apr 2020 01:34:45 -0400 (EDT)

janneke pushed a commit to branch core-updates
in repository guix.

commit b085d43633d28b1810b7bc74f8dff25717056420
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Sat Apr 18 19:49:54 2020 +0200

    gnu: autoconf: Support cross-build.
    
    Autoconf does not cross-built properly: it lacks the concept of
    <tool>-for-build.  It runs the host `autom4te' (a perl script) during build.
    
    * gnu/packages/autotools.scm (autoconf)[inputs]: Add bash-minimal, perl, and
    m4.  To avoid triggering a rebuild, do this while cross-compiling only.
    [arguments]: When cross-building, add `patch-non-shebang-references' phase 
to
    substitute the host bash, m4 and perl.
---
 gnu/packages/autotools.scm | 38 +++++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index 99ca527..26acfad 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2018 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2019 Pierre-Moana Levesque <address@hidden>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,12 +56,43 @@
        (base32
         "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
     (build-system gnu-build-system)
+    (inputs
+     ;; TODO: remove `if' in the next rebuild cycle.
+     (if (%current-target-system)
+         `(("bash" ,bash-minimal)
+           ("perl" ,perl)
+           ("m4" ,m4))
+         '()))
     (native-inputs
      `(("perl" ,perl)
        ("m4" ,m4)))
-    ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
-    ;; should use our own "cpp" instead of "/lib/cpp".
-    (arguments `(#:tests? #f))
+    (arguments
+     `(;; XXX: testsuite: 209 and 279 failed.  The latter is an impurity.  It
+       ;; should use our own "cpp" instead of "/lib/cpp".
+       #:tests? #f
+       ,@(if (%current-target-system)
+             `(#:phases
+               (modify-phases %standard-phases
+                 (add-after 'install 'patch-non-shebang-references
+                   (lambda* (#:key build inputs outputs #:allow-other-keys)
+                     ;; `patch-shebangs' patches shebangs only, and the Perl
+                     ;; scripts use a re-exec feature that references the
+                     ;; build hosts' perl.  Also, BASH and M4 store references
+                     ;; hide in the scripts.
+                     (let ((bash (assoc-ref inputs "bash"))
+                           (m4 (assoc-ref inputs "m4"))
+                           (perl (assoc-ref inputs "perl"))
+                           (out  (assoc-ref outputs "out"))
+                           (store-directory (%store-directory)))
+                      (substitute* (find-files (string-append out "/bin"))
+                        (((string-append store-directory "/[^/]*-bash-[^/]*"))
+                         bash)
+                        (((string-append store-directory "/[^/]*-m4-[^/]*"))
+                         m4)
+                        (((string-append store-directory "/[^/]*-perl-[^/]*"))
+                         perl))
+                      #t)))))
+             '())))
     (home-page "https://www.gnu.org/software/autoconf/";)
     (synopsis "Create source code configuration scripts")
     (description



reply via email to

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