From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: 04/05: gnu: autoconf: Support cross-build. Date: Tue, 21 Apr 2020 18:01:19 +0200 Message-ID: <87tv1cx1yo.fsf@gnu.org> References: <20200419090521.13083.63849@vcs0.savannah.gnu.org> <20200419090523.C255A2049B@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50362) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQvKs-0003GH-NR for guix-devel@gnu.org; Tue, 21 Apr 2020 12:01:23 -0400 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)") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org, Jan Nieuwenhuizen Hi! guix-commits@gnu.org skribis: > commit 6833403fb393a513c77aa3cb8fca7d57b87befe1 > Author: Jan (janneke) Nieuwenhuizen > AuthorDate: Sat Apr 18 19:49:54 2020 +0200 > > gnu: autoconf: Support cross-build. >=20=20=20=20=20 > Autoconf cannot be cross-built properly: it lacks the concept of > -for-build. It runs the host `autom4te' (a perl script) during= build. >=20=20=20=20=20 > * 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 sub= stitute > 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 =E2=80=98if=E2=80=99 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=E2=80=99ll have to le= ave 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 -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-ke= ys) > + (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 =E2=80=98patch-shebangs=E2=80=99 phase normally ta= kes the inputs, not the native inputs, when changing shebangs. (You previously found that something=E2=80=99s wrong there, but I forgot wh= at=E2=80=A6) Thanks, Ludo=E2=80=99.