unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: guix-devel@gnu.org, Jan Nieuwenhuizen <janneke@gnu.org>
Subject: Re: 04/05: gnu: autoconf: Support cross-build.
Date: Tue, 21 Apr 2020 18:01:19 +0200	[thread overview]
Message-ID: <87tv1cx1yo.fsf@gnu.org> (raw)
In-Reply-To: <20200419090523.C255A2049B@vcs0.savannah.gnu.org> (guix-commits@gnu.org's message of "Sun, 19 Apr 2020 05:05:23 -0400 (EDT)")

Hi!

guix-commits@gnu.org skribis:

> commit 6833403fb393a513c77aa3cb8fca7d57b87befe1
> Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
> AuthorDate: Sat Apr 18 19:49:54 2020 +0200
>
>     gnu: autoconf: Support cross-build.
>     
>     Autoconf cannot be 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]: When cross-building, add perl
>     and m4.
>     [native-inputs]: when cross-building, use -for-build names.
>     [arguments]: When cross-building, add `fake-cross-build' phase to substitute
>     m4 and perl.

Thanks for fixing it!  Some comments:

> +    (inputs
> +     (if (%current-target-system)
> +         `(("perl" ,perl)
> +           ("m4" ,m4))
> +         '()))
>      (native-inputs
> -     `(("perl" ,perl)
> -       ("m4" ,m4)))
> +     (if (%current-target-system)
> +         `(("perl-for-build" ,perl)
> +           ("m4-for-build" ,m4))
> +         `(("perl" ,perl)
> +           ("m4" ,m4))))

You can remove the ‘if’ in both cases: we always need Perl/M4 both as a
native input and as an input in both cases.

However, that might trigger a rebuild, so perhaps you’ll have to leave
the ifs, but with a TODO telling to remove it on the next rebuild or
Marius will be mad at us.

> +    (arguments
> +     `(#:tests? #f

Nope.  :-)

> +       ,@(if (%current-target-system)
> +             `(#:phases
> +               (modify-phases %standard-phases
> +                 ;; Autoconf cannot be cross-built properly: it lacks the
> +                 ;; concept of <tool>-for-build.  It even runs the host
> +                 ;; `autom4te' (a perl script) during build.
> +                 (add-after 'install 'fake-cross-build
> +                   (lambda* (#:key build inputs outputs #:allow-other-keys)
> +                     (let ((m4 (assoc-ref inputs "m4"))
> +                           (perl (assoc-ref inputs "perl"))
> +                           (out  (assoc-ref outputs "out")))
> +                      (substitute* (find-files (string-append out "/bin"))
> +                        (("/gnu/store/[^/]*-m4-[^/]*") m4)
> +                        (("/gnu/store/[^/]*-perl-[^/]*") perl))
> +                      #t)))))

Why is this needed?  The ‘patch-shebangs’ phase normally takes the
inputs, not the native inputs, when changing shebangs.

(You previously found that something’s wrong there, but I forgot what…)

Thanks,
Ludo’.

       reply	other threads:[~2020-04-21 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200419090521.13083.63849@vcs0.savannah.gnu.org>
     [not found] ` <20200419090523.C255A2049B@vcs0.savannah.gnu.org>
2020-04-21 16:01   ` Ludovic Courtès [this message]
2020-04-21 18:12     ` 04/05: gnu: autoconf: Support cross-build Jan Nieuwenhuizen
2020-04-21 18:23       ` Jan Nieuwenhuizen
2020-04-22 21:00       ` Ludovic Courtès
2020-04-23  5:45         ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tv1cx1yo.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=janneke@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).