diff mbox series

[bug#36477,26/31] gnu: tcsh: Fix cross-compilation.

Message ID 20190708095913.3460-27-m.othacehe@gmail.com
State Accepted
Headers show
Series Fix cross-compilation issues | expand

Commit Message

Mathieu Othacehe July 8, 2019, 9:59 a.m. UTC
* gnu/packages/shells.scm (tcsh)[arguments]: Replace "cc" by "gcc" as
native gethost compiler when cross-compiling.
---
 gnu/packages/shells.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Marius Bakke July 8, 2019, 6:25 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * gnu/packages/shells.scm (tcsh)[arguments]: Replace "cc" by "gcc" as
> native gethost compiler when cross-compiling.

LGTM.
Marius Bakke July 8, 2019, 6:26 p.m. UTC | #2
Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * gnu/packages/shells.scm (tcsh)[arguments]: Replace "cc" by "gcc" as
> native gethost compiler when cross-compiling.
> ---
>  gnu/packages/shells.scm | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
> index f8c0fdf71f..6eed89396e 100644
> --- a/gnu/packages/shells.scm
> +++ b/gnu/packages/shells.scm
> @@ -11,6 +11,7 @@
>  ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
>  ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
>  ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
> +;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -356,6 +357,14 @@ written by Paul Haahr and Byron Rakitzis.")
>      (arguments
>       `(#:phases
>          (modify-phases %standard-phases
> +          ,@(if (%current-target-system)
> +                '((add-before 'configure 'set-cross-cc
> +                     (lambda _
> +                       (substitute* "configure"
> +                         (("CC_FOR_GETHOST=\"cc\"")
> +                          "CC_FOR_GETHOST=\"gcc\""))
> +                       #t)))
> +                '())

Actually, can we pass this in #:configure-flags instead?  Maybe even
also for the native build?
Mathieu Othacehe July 25, 2019, 3:23 p.m. UTC | #3
>> @@ -356,6 +357,14 @@ written by Paul Haahr and Byron Rakitzis.")
>>      (arguments
>>       `(#:phases
>>          (modify-phases %standard-phases
>> +          ,@(if (%current-target-system)
>> +                '((add-before 'configure 'set-cross-cc
>> +                     (lambda _
>> +                       (substitute* "configure"
>> +                         (("CC_FOR_GETHOST=\"cc\"")
>> +                          "CC_FOR_GETHOST=\"gcc\""))
>> +                       #t)))
>> +                '())
>
> Actually, can we pass this in #:configure-flags instead?  Maybe even
> also for the native build?

Sadly I think we cannot. The problematic piece is:

--8<---------------cut here---------------start------------->8---
dnl Require build CC to create gethost helper when cross building
if test "x${cross_compiling}" = xyes ; then
  CC_FOR_GETHOST="cc"
else
  CC_FOR_GETHOST="\$(CC)"
fi
AC_SUBST(CC_FOR_GETHOST)
--8<---------------cut here---------------end--------------->8---

CC_FOR_GETHOST cannot be overwritten by a configure-flag.

Mathieu
diff mbox series

Patch

diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index f8c0fdf71f..6eed89396e 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -11,6 +11,7 @@ 
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -356,6 +357,14 @@  written by Paul Haahr and Byron Rakitzis.")
     (arguments
      `(#:phases
         (modify-phases %standard-phases
+          ,@(if (%current-target-system)
+                '((add-before 'configure 'set-cross-cc
+                     (lambda _
+                       (substitute* "configure"
+                         (("CC_FOR_GETHOST=\"cc\"")
+                          "CC_FOR_GETHOST=\"gcc\""))
+                       #t)))
+                '())
           (add-before 'check 'patch-test-scripts
             (lambda _
               ;; Take care of pwd