From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Nieuwenhuizen Subject: Re: 04/05: gnu: autoconf: Support cross-build. Date: Tue, 21 Apr 2020 20:23:35 +0200 Message-ID: <87mu748zq0.fsf@gnu.org> References: <20200419090521.13083.63849@vcs0.savannah.gnu.org> <20200419090523.C255A2049B@vcs0.savannah.gnu.org> <87tv1cx1yo.fsf@gnu.org> <87r1wg908o.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQxYa-00051w-LO for guix-devel@gnu.org; Tue, 21 Apr 2020 14:23:41 -0400 In-Reply-To: <87r1wg908o.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Tue, 21 Apr 2020 20:12:23 +0200") 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Jan Nieuwenhuizen writes: (fix typo/update renamed phase in commit message) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-autoconf-Support-cross-build.patch >From 2b7ae7542fd77b35d7a143c90556cf32a7f9ae48 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sat, 18 Apr 2020 19:49:54 +0200 Subject: [PATCH] gnu: autoconf: Support cross-build. Autoconf cannot be cross-built properly: it lacks the concept of -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 `patch-non-shebang-references' phase to substitute m4 and perl. --- gnu/packages/autotools.scm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm index 99ca52730e..fa3ced182f 100644 --- a/gnu/packages/autotools.scm +++ b/gnu/packages/autotools.scm @@ -55,12 +55,38 @@ (base32 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4")))) (build-system gnu-build-system) + (inputs + ;; TODO: remove `if' in the next rebuild cycle. + (if (%current-target-system) + `(("perl" ,perl) + ("m4" ,m4)) + '())) (native-inputs `(("perl" ,perl) ("m4" ,m4))) ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It ;; should use our own "cpp" instead of "/lib/cpp". - (arguments `(#:tests? #f)) + (arguments + `(#:tests? #f + ,@(if (%current-target-system) + `(#:phases + (modify-phases %standard-phases + ;; `patch-shebangs' patches shebangs only, and the Perl + ;; scripts use a re-exec feature that references the build + ;; hosts' perl. Also, M4 store references hide in the + ;; scripts. + (add-after 'install 'patch-non-shebang-references + (lambda* (#:key build inputs outputs #:allow-other-keys) + (let ((m4 (assoc-ref inputs "m4")) + (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 "/[^/]*-m4-[^/]*")) m4) + (((string-append store-directory "/[^/]*-perl-[^/]*")) + perl)) + #t))))) + '()))) (home-page "https://www.gnu.org/software/autoconf/") (synopsis "Create source code configuration scripts") (description -- 2.26.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=--