From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:51366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqOu-0006YT-BM for guix-patches@gnu.org; Sat, 18 Apr 2020 12:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqOs-0005ow-M3 for guix-patches@gnu.org; Sat, 18 Apr 2020 12:33:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqOs-0005oR-IC for guix-patches@gnu.org; Sat, 18 Apr 2020 12:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jPqOs-0005fD-8g for guix-patches@gnu.org; Sat, 18 Apr 2020 12:33:02 -0400 Subject: [bug#40698] [core-updates]: [PATCH] gnu: perl: Actually produce a host perl when cross-compiling. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:51177) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqNw-0005T8-VZ for guix-patches@gnu.org; Sat, 18 Apr 2020 12:32:06 -0400 From: Jan Nieuwenhuizen Date: Sat, 18 Apr 2020 18:31:59 +0200 Message-ID: <87r1wku54w.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 40698@debbugs.gnu.org Cc: Marius Bakke --=-=-= Content-Type: text/plain Hi! As discussed on IRC, I tried to apply perl-cross (https://github.com/arsv/perl-cross) to make perl actually cross build for our Hurd VM. There's some weirdness wrt some pod scripts; no idea. I haven't gotten round to test the package itself yet on the Hurd. Also, first tests on the Hurd show a possible problem with Perl's system or shell -- no idea. I get things like Can't exec "": No such file or directory at /gnu/store/dd5a35aca6411w5l29ask7pl626v8j4r-perl-5.30.2/lib/perl5/5.30.2/i586-/Cwd.pm line 204. Can't exec "": No such file or directory at /gnu/store/mfnmg1m37kyrb65alnj6jn2fzw7zkapw-autoconf-cross-2.69/share/autoconf/Autom4te/FileUtils.pm line 345. to me that's just as cryptic as Perl code itself. I'll have a look into that later tonight. Greetings, janneke --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-perl-Actually-produce-a-host-perl-when-cross-com.patch Content-Transfer-Encoding: quoted-printable >From b96825876eea5c0dff9414d88a8dc3302b2d2f7f Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sat, 18 Apr 2020 17:05:48 +0200 Subject: [PATCH] gnu: perl: Actually produce a host perl when cross-compili= ng. * gnu/packages/perl.scm (perl)[native-inputs]: When cross-compiling, add `perl-cross' input. [arguments]: When cross-compiling, use it to produce binary for host. --- gnu/packages/perl.scm | 85 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm index d6a75506ec..67f4cb969c 100644 --- a/gnu/packages/perl.scm +++ b/gnu/packages/perl.scm @@ -11,7 +11,7 @@ ;;; Copyright =C2=A9 2016 Alex Sassmannshausen ;;; Copyright =C2=A9 2016, 2018, 2020 Roel Janssen ;;; Copyright =C2=A9 2016 Ben Woodcroft -;;; Copyright =C2=A9 2016 Jan Nieuwenhuizen +;;; Copyright =C2=A9 2016, 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright =C2=A9 2017 Raoul J.P. Bonnal ;;; Copyright =C2=A9 2017, 2018 Marius Bakke ;;; Copyright =C2=A9 2017 Adriano Peluso @@ -48,6 +48,7 @@ #:use-module (gnu packages) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system perl) @@ -120,10 +121,72 @@ (("-std=3Dc89") "-std=3Dgnu89")) #t)) - (replace 'configure - (lambda* (#:key configure-flags #:allow-other-keys) - (format #t "Perl configure flags: ~s~%" configure-flags) - (apply invoke "./Configure" configure-flags))) + ,@(if (%current-target-system) + `((add-after 'unpack 'unpack-cross + (lambda* (#:key inputs #:allow-other-keys) + (let ((cross-checkout (assoc-ref %build-inputs "perl-= cross"))) + (invoke "chmod" "-R" "+w" ".") + (copy-recursively cross-checkout ".")) + (let ((bash (assoc-ref %build-inputs "bash"))) + (substitute* '("Makefile.config.SH" + "cnf/config.guess" + "cnf/config.sub" + "cnf/configure" + "cnf/configure_misc.sh" + "miniperl_top") + (("! */bin/sh") (string-append "! " bash "/bin/ba= sh")) + ((" /bin/sh") (string-append bash "/bin/bash"))) + (substitute* '("cnf/configure_tool.sh") + (( "[\t ]*result \"BSD\".*") + "\ + result \"BSD\" + ;; + *-gnu) + result \"GNU\" +")) + (substitute* '("ext/Errno/Errno_pm.PL") + (( "\\$cpp < errno.c") "gcc -E errno.c"))) + #t)) + (replace 'configure + (lambda* (#:key configure-flags outputs #:allow-other-k= eys) + (let* ((out (assoc-ref outputs "out")) + (configure-flags + (cons* + ;; `perl-cross' confuses target and host + (string-append "--target=3D" ,(%current-targ= et-system)) + (string-append "--prefix=3D" out) + "-Dbyteorder=3D1234" + (filter (negate + (lambda (x) (or (string-prefix? "-d= " x) + (string-prefix? "-D= cc=3D" x)))) + configure-flags)))) + (format (current-error-port) + "running ./configure ~a\n" (string-join con= figure-flags)) + (apply invoke (cons "./configure" configure-flags)) + (substitute* "config.sh" + (("^libs=3D.*") "libs=3D'-ldl -lpthread -lm'\n") + (("^perllibs=3D.*") "perllibs=3D'-ldl -lpthread -= lm'\n")) + (substitute* "config.h" + (("^# HAS_NANOSLEEP") "/* #undef HAS_NANOSLEEP */= ")) + #t))) + (add-after 'build 'touch-non-built-files-for-install + (lambda _ + ;; `make install' wants to install this; it wasn't bu= ilt... + (mkdir-p "cpan/Pod-Usage/blib/script") + (with-output-to-file "cpan/Pod-Usage/blib/script/pod2= text" + (lambda _ (display ""))) + (with-output-to-file "cpan/Pod-Usage/blib/script/pod2= usage" + (lambda _ (display ""))) + (with-output-to-file "cpan/Pod-Checker/blib/script/po= dchecker" + (lambda _ (display ""))) + (mkdir-p "cpan/Pod-Parser/blib/script") + (with-output-to-file "cpan/Pod-Parser/blib/script/pod= select" + (lambda _ (display ""))) + #t))) + `((replace 'configure + (lambda* (#:key configure-flags #:allow-other-keys) + (format #t "Perl configure flags: ~s~%" configure-fla= gs) + (apply invoke "./Configure" configure-flags))))) (add-after 'install 'remove-extra-references (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -152,6 +215,18 @@ "/lib',\n")))) config2) #t)))))) + (native-inputs + (if (%current-target-system) + `(("perl-cross" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/arsv/perl-cross") + (commit "1.3.3"))) + (file-name (git-file-name "perl-cross" "1.3.3")) + (sha256 + (base32 "065qbl1x44maykaj8p8za0b6qxj74bz7fi2zsrlydir1mqb1j= s3d"))))) + '())) (native-search-paths (list (search-path-specification (variable "PERL5LIB") (files '("lib/perl5/site_perl"))))) --=20 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 --=-=-=--