diff options
author | Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | 2020-04-18 19:50:06 +0200 |
---|---|---|
committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2020-04-23 07:28:02 +0200 |
commit | d64a6d267db7643edb6c9a76a830be08e147127b (patch) | |
tree | 6d8c771915f49b0edd9d14c8913d5540b290ba25 /gnu/packages | |
parent | b085d43633d28b1810b7bc74f8dff25717056420 (diff) | |
download | guix-d64a6d267db7643edb6c9a76a830be08e147127b.tar guix-d64a6d267db7643edb6c9a76a830be08e147127b.tar.gz |
gnu: automake: Support cross-build.
Automake does not cross-built properly: it lacks the concept of
<tool>-for-build. It runs the host `autoconf' during build.
* gnu/packages/autotools.scm (automake)[inputs]: Add autoconf, bash-minimal
and perl. To avoid triggering a rebuild, do this while cross-compiling only.
[arguments]: When cross-building, add `patch-non-shebang-references' phase to
substitute autoconf and perl.
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/autotools.scm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm index 26acfad95f..657d4d3cb9 100644 --- a/gnu/packages/autotools.scm +++ b/gnu/packages/autotools.scm @@ -293,6 +293,13 @@ output is indexed in many ways to simplify browsing.") (patches (search-patches "automake-skip-amhello-tests.patch")))) (build-system gnu-build-system) + (inputs + ;; TODO: remove `if' in the next rebuild cycle. + (if (%current-target-system) + `(("autoconf" ,autoconf-wrapper) + ("bash" ,bash-minimal) + ("perl" ,perl)) + '())) (native-inputs `(("autoconf" ,autoconf-wrapper) ("perl" ,perl))) @@ -301,7 +308,7 @@ output is indexed in many ways to simplify browsing.") (variable "ACLOCAL_PATH") (files '("share/aclocal"))))) (arguments - '(#:modules ((guix build gnu-build-system) + `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) (srfi srfi-26) @@ -330,6 +337,28 @@ output is indexed in many ways to simplify browsing.") (string-append "exit 77\n" all "\n"))) #t)) + ,@(if (%current-target-system) + `((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, AUTOCONF and BASH store + ;; references hide in the scripts. + (let ((autoconf (assoc-ref inputs "autoconf")) + (bash (assoc-ref inputs "bash")) + (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 "/[^/]*-autoconf-[^/]*")) + autoconf) + (((string-append store-directory "/[^/]*-bash-[^/]*")) + bash) + (((string-append store-directory "/[^/]*-perl-[^/]*")) + perl)) + #t)))) + '()) + ;; Files like `install-sh', `mdate.sh', etc. must use ;; #!/bin/sh, otherwise users could leak erroneous shebangs ;; in the wild. See <http://bugs.gnu.org/14201> for an |