From patchwork Sun Apr 19 08:54:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 21359 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3D87727BBE1; Sun, 19 Apr 2020 09:56:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 9CE3427BBE4 for ; Sun, 19 Apr 2020 09:56:09 +0100 (BST) Received: from localhost ([::1]:39346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ5kH-0006zC-42 for patchwork@mira.cbaines.net; Sun, 19 Apr 2020 04:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40198) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ5kB-0006z0-Ez for guix-patches@gnu.org; Sun, 19 Apr 2020 04:56:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQ5kA-0004Rb-I8 for guix-patches@gnu.org; Sun, 19 Apr 2020 04:56:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQ5kA-0004RN-5A for guix-patches@gnu.org; Sun, 19 Apr 2020 04:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jQ5kA-0005ck-3y for guix-patches@gnu.org; Sun, 19 Apr 2020 04:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40698] [core-updates]: [PATCH v2] gnu: perl: Actually produce a host perl when cross-compiling. Resent-From: Jan Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 19 Apr 2020 08:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40698 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40698@debbugs.gnu.org Cc: Marius Bakke Received: via spool by 40698-submit@debbugs.gnu.org id=B40698.158728652421556 (code B ref 40698); Sun, 19 Apr 2020 08:56:02 +0000 Received: (at 40698) by debbugs.gnu.org; 19 Apr 2020 08:55:24 +0000 Received: from localhost ([127.0.0.1]:44024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQ5jO-0005bS-6y for submit@debbugs.gnu.org; Sun, 19 Apr 2020 04:55:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQ5jG-0005ag-M1 for 40698@debbugs.gnu.org; Sun, 19 Apr 2020 04:55:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49220) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ5jB-0002pl-9M; Sun, 19 Apr 2020 04:55:01 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=45028 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jQ5jA-0006jr-QG; Sun, 19 Apr 2020 04:55:01 -0400 From: Jan Nieuwenhuizen References: <87r1wku54w.fsf@gnu.org> Date: Sun, 19 Apr 2020 10:54:58 +0200 In-Reply-To: <87r1wku54w.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sat, 18 Apr 2020 18:31:59 +0200") Message-ID: <87lfmrua71.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Jan Nieuwenhuizen writes: > 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. Find an improved patch below. It fixes > 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. which was due to having #define SH_PATH "" in config.h. It also fixes "cwd" in perl, that was caused by this (substitute* "dist/PathTools/Cwd.pm" (("/bin/pwd") - (which "pwd"))) + (which "pwd"))) ;TODO: fix cross-compile next rebuild cycle and now fixed lateron + ;;TODO: fix this in setup-configure next rebuild cycle + (substitute* "dist/PathTools/Cwd.pm" + (("/gnu/store/[^/]*-coreutils-[^/]*") coreutils)) Using this, I can cross-build perl and which allows me to ceate patches to cross build, autoconf and automake that work to configure Guix git on the Hurd. Greetings, janneke From b10ca56254cd1b1f8ec4b222ad27cb02ce59316c 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-compiling. * 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 | 106 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm index d6a75506ec..c8332ecead 100644 --- a/gnu/packages/perl.scm +++ b/gnu/packages/perl.scm @@ -11,7 +11,7 @@ ;;; Copyright © 2016 Alex Sassmannshausen ;;; Copyright © 2016, 2018, 2020 Roel Janssen ;;; Copyright © 2016 Ben Woodcroft -;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2017 Raoul J.P. Bonnal ;;; Copyright © 2017, 2018 Marius Bakke ;;; Copyright © 2017 Adriano Peluso @@ -48,14 +48,17 @@ #: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) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages databases) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gd) + #:use-module (gnu packages hurd) #:use-module (gnu packages less) #:use-module (gnu packages ncurses) #:use-module (gnu packages perl-check) @@ -112,7 +115,7 @@ ;; Use the right path for `pwd'. (substitute* "dist/PathTools/Cwd.pm" (("/bin/pwd") - (which "pwd"))) + (which "pwd"))) ;TODO: fix cross-compile next rebuild cycle ;; Build in GNU89 mode to tolerate C++-style comment in libc's ;; . @@ -120,10 +123,84 @@ (("-std=c89") "-std=gnu89")) #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/bash")) + ((" /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 inputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (configure-flags + (cons* + ;; `perl-cross' confuses target and host + (string-append "--target=" ,(%current-target-system)) + (string-append "--prefix=" out) + "-Dbyteorder=1234" + (filter (negate + (lambda (x) (or (string-prefix? "-d" x) + (string-prefix? "-Dcc=" x)))) + configure-flags))) + (bash (assoc-ref inputs "bash")) + (coreutils (assoc-ref inputs "coreutils"))) + (format (current-error-port) + "running ./configure ~a\n" (string-join configure-flags)) + (apply invoke (cons "./configure" configure-flags)) + (substitute* "config.sh" + (("^libs=.*") "libs='-ldl -lpthread -lm'\n") + (("^perllibs=.*") "perllibs='-ldl -lpthread -lm'\n") + (("/gnu/store/[^/]*-bash-[^/]*") bash)) + (substitute* '("config.h") + (("^#define OSNAME .*") + (string-append "#define OSNAME \"" + ,(if (hurd-target?) "GNU" "Linux") + "\"\n")) + (("^# HAS_NANOSLEEP") "/* #undef HAS_NANOSLEEP */") + (("^#define SH_PATH .*") + (string-append "#define SH_PATH \"" bash "/bin/bash\"\n"))) + ;;TODO: fix this in setup-configure next rebuild cycle + (substitute* "dist/PathTools/Cwd.pm" + (("/gnu/store/[^/]*-coreutils-[^/]*") coreutils)) + #t))) + (add-after 'build 'touch-non-built-files-for-install + (lambda _ + ;; `make install' wants to install this; it wasn't built... + (mkdir-p "cpan/Pod-Usage/blib/script") + (with-output-to-file "cpan/Pod-Usage/blib/script/pod2text" + (lambda _ (display ""))) + (with-output-to-file "cpan/Pod-Usage/blib/script/pod2usage" + (lambda _ (display ""))) + (with-output-to-file "cpan/Pod-Checker/blib/script/podchecker" + (lambda _ (display ""))) + (mkdir-p "cpan/Pod-Parser/blib/script") + (with-output-to-file "cpan/Pod-Parser/blib/script/podselect" + (lambda _ (display ""))) + #t))) + `((replace 'configure + (lambda* (#:key configure-flags #:allow-other-keys) + (format #t "Perl configure flags: ~s~%" configure-flags) + (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 +229,23 @@ "/lib',\n")))) config2) #t)))))) + (inputs + (if (%current-target-system) + `(("bash" ,bash-minimal) + ("coreutils" ,coreutils)) + '())) + (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 "065qbl1x44maykaj8p8za0b6qxj74bz7fi2zsrlydir1mqb1js3d"))))) + '())) (native-search-paths (list (search-path-specification (variable "PERL5LIB") (files '("lib/perl5/site_perl"))))) -- 2.26.0