From patchwork Fri Sep 29 09:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 54394 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 A2E7027BBEA; Fri, 29 Sep 2023 10:18:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 967E727BBE2 for ; Fri, 29 Sep 2023 10:18:43 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9dO-0005bJ-2I; Fri, 29 Sep 2023 05:18:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm9dC-0005Ti-20 for guix-patches@gnu.org; Fri, 29 Sep 2023 05:17:56 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm9d7-0003uF-Q8 for guix-patches@gnu.org; Fri, 29 Sep 2023 05:17:50 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9dM-0004lm-Ex; Fri, 29 Sep 2023 05:18:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH 01/23] gnu: cross-libc: Return #f if no libc available. References: <20230929091333.7623-1-jean@foundationdevices.com> In-Reply-To: <20230929091333.7623-1-jean@foundationdevices.com> Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:18:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66263 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ , efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com X-Debbugs-Original-Xcc: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com Received: via spool by 66263-submit@debbugs.gnu.org id=B66263.169597904818108 (code B ref 66263); Fri, 29 Sep 2023 09:18:04 +0000 Received: (at 66263) by debbugs.gnu.org; 29 Sep 2023 09:17:28 +0000 Received: from localhost ([127.0.0.1]:55195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9cl-0004hu-LY for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:17:28 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:44199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9cI-0004di-EB for 66263@debbugs.gnu.org; Fri, 29 Sep 2023 05:17:10 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-406618d0992so275975e9.0 for <66263@debbugs.gnu.org>; Fri, 29 Sep 2023 02:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1695978994; x=1696583794; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cOG/pzxU5SmzmUxtbGMIzsmMxINxsxe9+XUTkU4nf4U=; b=L4tUPnE77I3fsClL05bn+jUOE/dAXMF1usMHGOpOSBtHK34mUxrKNH5Mnpime7HoWr e2wrJHXqadRNZMrhXdK35zIkDWJArD9KVAuYgyBR4kiM/wDmMyQyGvOjsx8Aw4wdmMlp Rb2uNOJ84RGnw7UomZlo93bvYt5HFCybBhbgwOvk5XTS7zoTT8tdq+HE0/d+ABgxQFpu +goUP9Ed0nmtXUoGQlc2NxMoMQxsbrNdaPx9xj+Ysgtj2o1kTbjiRYWWa472UdTsxVmu XHVNhjtBTU2efSZsg21XqbYXpeNrit6asMapp6tv0x/X56hvtKC0q4yKK5xllLcBooNY 4sYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695978994; x=1696583794; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cOG/pzxU5SmzmUxtbGMIzsmMxINxsxe9+XUTkU4nf4U=; b=KlRbSry71cD+FBiPjp9EXUe+DX24uoepbGc5ToPL7oXfSw9yxbx//vHwfwJHfHUNj8 zczVWko2i95XtLxp+KMj1Cv2yqV6nTZKV/ZA2+aBKuMlUau9+EKUWRMmoG4yM6HFFJ4q RHCCOzXOis6GpHMguaCAHLZt/XlfDpBhed3SO8wzvUIxhRCLVLbFxaDQyKwC9zxXCKoj ZHkL0HWz6pBvoPfO6NkSOP5z7IY6PjdeskA7pAkcVK2VXMOn4+Z4pXFgVy4W+0zqxZZC LhWQGPk39N1Q/vuItoltYtxvmM7fDxCtt+vdDiuZDUlaxYvaqWq0ifgF6U1SOIK0H8i4 Vf/g== X-Gm-Message-State: AOJu0YzQi9qYW1B8IigRBgEMXIk+l003l0Zs2I9iWOwMrPudNpunmdSw rt+MH5nTLtq2k0af5E2mUfg/SUueJ8q0vmHm7NR6GQ== X-Google-Smtp-Source: AGHT+IGwcsjncPfF1pwtI6aEzGF2yeLBGdeD+n0IJviI66cGeColvzoeXoP2EKKI75amneQXAktjmA== X-Received: by 2002:a05:600c:2058:b0:405:95c3:e79d with SMTP id p24-20020a05600c205800b0040595c3e79dmr3499708wmg.40.1695978993583; Fri, 29 Sep 2023 02:16:33 -0700 (PDT) Received: from omen15.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id k15-20020a7bc40f000000b004013797efb6sm1020933wmi.9.2023.09.29.02.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 02:16:33 -0700 (PDT) Date: Fri, 29 Sep 2023 11:16:05 +0200 Message-Id: <20230929091627.7820-1-jean@foundationdevices.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jean-Pierre De Jesus DIAZ X-ACL-Warn: , Jean-Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean-Pierre De Jesus DIAZ via Guix-patches via From: Jean-Pierre De Jesus DIAZ Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/cross-base.scm (cross-libc): Return #f if platform does not have a libc available. --- gnu/packages/cross-base.scm | 138 +++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 67 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 14cb365099..f55765f1b0 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2020 Mathieu Othacehe ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Josselin Poiret +;;; Copyright © 2023 Foundation Devices, Inc. ;;; ;;; This file is part of GNU Guix. ;;; @@ -611,73 +612,76 @@ (define* (cross-libc* target (xheaders (cross-kernel-headers target))) "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS and the cross tool chain." - (if (target-mingw? target) - (let ((machine (substring target 0 (string-index target #\-)))) - (make-mingw-w64 machine - #:xgcc xgcc - #:xbinutils xbinutils)) - (package - (inherit libc) - (name (string-append "glibc-cross-" target)) - (arguments - (substitute-keyword-arguments - `( ;; Disable stripping (see above.) - #:strip-binaries? #f - - ;; This package is used as a target input, but it should not have - ;; the usual cross-compilation inputs since that would include - ;; itself. - #:implicit-cross-inputs? #f - - ;; We need SRFI 26. - #:modules ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-26)) - - ,@(package-arguments libc)) - ((#:configure-flags flags) - `(cons ,(string-append "--host=" target) - ,(if (target-hurd? target) - `(append (list "--disable-werror" - ,@%glibc/hurd-configure-flags) - ,flags) - flags))) - ((#:phases phases) - `(modify-phases ,phases - (add-before 'configure 'set-cross-kernel-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((kernel (assoc-ref inputs "kernel-headers")) - (cpath (string-append kernel "/include"))) - (for-each (cut setenv <> cpath) - ',%gcc-cross-include-paths) - (setenv "CROSS_LIBRARY_PATH" - (string-append kernel "/lib")) ; for Hurd's libihash - #t))) - ,@(if (target-hurd? target) - '((add-after 'install 'augment-libc.so - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (substitute* (string-append out "/lib/libc.so") - (("/[^ ]+/lib/libc.so.0.3") - (string-append out "/lib/libc.so.0.3" - " libmachuser.so libhurduser.so")))) - #t))) - '()))))) - - ;; Shadow the native "kernel-headers" because glibc's recipe expects the - ;; "kernel-headers" input to point to the right thing. - (propagated-inputs `(("kernel-headers" ,xheaders))) - - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ,@(if (target-hurd? target) - `(("cross-mig" - ,(cross-mig target - #:xgcc xgcc - #:xbinutils xbinutils))) - '()) - ,@(package-inputs libc) ;FIXME: static-bash - ,@(package-native-inputs libc)))))) + (match target + ((? target-mingw?) + (let ((machine (substring target 0 (string-index target #\-)))) + (make-mingw-w64 machine + #:xgcc xgcc + #:xbinutils xbinutils))) + ((or (? target-linux?) (? target-hurd?)) + (package + (inherit libc) + (name (string-append "glibc-cross-" target)) + (arguments + (substitute-keyword-arguments + `( ;; Disable stripping (see above.) + #:strip-binaries? #f + + ;; This package is used as a target input, but it should not have + ;; the usual cross-compilation inputs since that would include + ;; itself. + #:implicit-cross-inputs? #f + + ;; We need SRFI 26. + #:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26)) + + ,@(package-arguments libc)) + ((#:configure-flags flags) + `(cons ,(string-append "--host=" target) + ,(if (target-hurd? target) + `(append (list "--disable-werror" + ,@%glibc/hurd-configure-flags) + ,flags) + flags))) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'configure 'set-cross-kernel-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((kernel (assoc-ref inputs "kernel-headers")) + (cpath (string-append kernel "/include"))) + (for-each (cut setenv <> cpath) + ',%gcc-cross-include-paths) + (setenv "CROSS_LIBRARY_PATH" + (string-append kernel "/lib")) ; for Hurd's libihash + #t))) + ,@(if (target-hurd? target) + '((add-after 'install 'augment-libc.so + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/lib/libc.so") + (("/[^ ]+/lib/libc.so.0.3") + (string-append out "/lib/libc.so.0.3" + " libmachuser.so libhurduser.so")))) + #t))) + '()))))) + + ;; Shadow the native "kernel-headers" because glibc's recipe expects the + ;; "kernel-headers" input to point to the right thing. + (propagated-inputs `(("kernel-headers" ,xheaders))) + + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(if (target-hurd? target) + `(("cross-mig" + ,(cross-mig target + #:xgcc xgcc + #:xbinutils xbinutils))) + '()) + ,@(package-inputs libc) ;FIXME: static-bash + ,@(package-native-inputs libc))))) + (else #f))) ;;; Concrete cross tool chains are instantiated like this: