[bug#36477,v3,03/48] gnu: texinfo: Fix cross-compilation.
diff mbox series

Message ID 20190902153333.11190-4-m.othacehe@gmail.com
State New
Headers show
Series
  • Add --target support to guix system
Related show

Commit Message

Mathieu Othacehe Sept. 2, 2019, 3:32 p.m. UTC
* gnu/packages/texinfo.scm (texinfo)[arguments]: Do not reset environment
before running configure with the native compiler, in a cross-compilation
context,
[inputs]: move perl from here ...
[native-inputs]: ... to here. Also add ncurses that is needed in a
cross-compilation context to build texinfo native tools.
---
 gnu/packages/texinfo.scm | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Comments

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

> * gnu/packages/texinfo.scm (texinfo)[arguments]: Do not reset environment
> before running configure with the native compiler, in a cross-compilation
> context,
> [inputs]: move perl from here ...
> [native-inputs]: ... to here. Also add ncurses that is needed in a
> cross-compilation context to build texinfo native tools.

[...]

> +    (arguments
> +     ;; When cross-compiling, the package is configured twice: once with the
> +     ;; native compiler and once with the cross-compiler. During the configure
> +     ;; with the native compiler, the environment is reset. This leads to
> +     ;; multiple environment variables missing. Do not reset the environment
> +     ;; to prevent that.
> +     `(,@(if (%current-target-system)

Simply: (arguments (if (%current-target-system) …)).

> +    ;; When cross-compiling, texinfo will build some of it's own binaries with

s/it’s/its/

> +    ;; the native compiler. This means ncurses is needed both in both inputs
> +    ;; and native-inputs.
> +    (native-inputs `(("perl" ,perl)
> +                     ("ncurses" ,ncurses)))

Could you check whether that triggers a full rebuild?  If it doesn’t,
you can push to master.

Ludo’.
Mathieu Othacehe Sept. 4, 2019, 4:28 p.m. UTC | #2
> Could you check whether that triggers a full rebuild?  If it doesn’t,
> you can push to master.

No mass-rebuild :) Fixed and pushed.

Thanks,

Mathieu
Marius Bakke Sept. 4, 2019, 9:21 p.m. UTC | #3
Mathieu Othacehe <m.othacehe@gmail.com> writes:

>> Could you check whether that triggers a full rebuild?  If it doesn’t,
>> you can push to master.
>
> No mass-rebuild :) Fixed and pushed.

This did cause a mass-rebuild, and Cuirass is currently chugging away at
commit 210b641:

https://ci.guix.gnu.org/jobset/guix-master
https://ci.guix.gnu.org/jobset/guix-modular-master

I reverted it in 4ab97ef, but don't know how to stop the Cuirass
evaluations.
Pierre Neidhardt Sept. 5, 2019, 7:45 a.m. UTC | #4
Thanks Marius!
Mathieu Othacehe Sept. 5, 2019, 7:53 a.m. UTC | #5
Hello Marius,

I'm surprised because the derivation was unchanged with this patch
when I tested it locally. Sorry, I must have made a mistake.
Thanks for taking care of this. I applied this patch on core-updates-next.

Mathieu

Le mer. 4 sept. 2019 à 23:21, Marius Bakke <mbakke@fastmail.com> a écrit :
>
> Mathieu Othacehe <m.othacehe@gmail.com> writes:
>
> >> Could you check whether that triggers a full rebuild?  If it doesn’t,
> >> you can push to master.
> >
> > No mass-rebuild :) Fixed and pushed.
>
> This did cause a mass-rebuild, and Cuirass is currently chugging away at
> commit 210b641:
>
> https://ci.guix.gnu.org/jobset/guix-master
> https://ci.guix.gnu.org/jobset/guix-modular-master
>
> I reverted it in 4ab97ef, but don't know how to stop the Cuirass
> evaluations.
Ludovic Courtès Sept. 5, 2019, 8:47 a.m. UTC | #6
Mathieu Othacehe <m.othacehe@gmail.com> skribis:

>> Could you check whether that triggers a full rebuild?  If it doesn’t,
>> you can push to master.
>
> No mass-rebuild :) Fixed and pushed.

Apparently it did cause a mass rebuild but Marius reverted it, so we’re
fine.

The way I check for a mass rebuild is either by running “guix build
libreoffice -n” after the change :-), or (better) by comparing the
output of:

  ./pre-inst-env guix build texinfo -nd

before and after the change.

Thanks,
Ludo’.

Patch
diff mbox series

diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm
index befdd78551..c93c7fc353 100644
--- a/gnu/packages/texinfo.scm
+++ b/gnu/packages/texinfo.scm
@@ -41,8 +41,28 @@ 
                (base32
                 "0rixv4c301djr0d0cnsxs8c1wjndi6bf9vi5axz6mwjkv80cmfcv"))))
     (build-system gnu-build-system)
-    (inputs `(("ncurses" ,ncurses)
-              ("perl" ,perl)))
+    (arguments
+     ;; When cross-compiling, the package is configured twice: once with the
+     ;; native compiler and once with the cross-compiler. During the configure
+     ;; with the native compiler, the environment is reset. This leads to
+     ;; multiple environment variables missing. Do not reset the environment
+     ;; to prevent that.
+     `(,@(if (%current-target-system)
+             '(#:phases
+               (modify-phases %standard-phases
+                 (add-before 'configure 'fix-cross-configure
+                   (lambda _
+                     (substitute* "configure"
+                       (("env -i")
+                        "env "))
+                     #t))))
+             '())))
+    (inputs `(("ncurses" ,ncurses)))
+    ;; When cross-compiling, texinfo will build some of it's own binaries with
+    ;; the native compiler. This means ncurses is needed both in both inputs
+    ;; and native-inputs.
+    (native-inputs `(("perl" ,perl)
+                     ("ncurses" ,ncurses)))
 
     (native-search-paths
      ;; This is the variable used by the standalone Info reader.