From patchwork Tue Nov 28 11:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 56888 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 96D6027BBE9; Tue, 28 Nov 2023 11:36:20 +0000 (GMT) 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=unavailable 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 1250927BBE2 for ; Tue, 28 Nov 2023 11:36:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7wNh-0005Yc-Ks; Tue, 28 Nov 2023 06:35:57 -0500 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 1r7wNf-0005Xy-D0 for guix-patches@gnu.org; Tue, 28 Nov 2023 06:35:55 -0500 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 1r7wNf-00080I-4z for guix-patches@gnu.org; Tue, 28 Nov 2023 06:35:55 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7wNl-0003Hf-Vu for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH v1 01/22] 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: guix-patches@gnu.org Resent-Date: Tue, 28 Nov 2023 11:36:01 +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: moreinfo patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ Received: via spool by 66263-submit@debbugs.gnu.org id=B66263.170117134012554 (code B ref 66263); Tue, 28 Nov 2023 11:36:01 +0000 Received: (at 66263) by debbugs.gnu.org; 28 Nov 2023 11:35:40 +0000 Received: from localhost ([127.0.0.1]:45574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wNP-0003GL-9K for submit@debbugs.gnu.org; Tue, 28 Nov 2023 06:35:40 -0500 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:49468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wNL-0003G3-Rd for 66263@debbugs.gnu.org; Tue, 28 Nov 2023 06:35:37 -0500 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2c6b30aca06so65984211fa.3 for <66263@debbugs.gnu.org>; Tue, 28 Nov 2023 03:35:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1701171323; x=1701776123; 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=lpsOqZj/TlHClhJSRKVkgDyQ/P7dWiPn/PGMJov/ZrI=; b=Az11n4KfMGYR8q0IYFQoK/KJFS5hTtLM5GSKSjYy2BqtoBnkg4AmTvD4h0o+Nm7D6Z prE7GtpUYG3YGKPMevHsezEgxxfVCswOye3hMlKRsLthoIC/gOB7c7fVkVBHDIJl5FxM ZZ8V41HdfMGeRifvByjkpJEyhDEm6NBAUueBlV60FqvEvLIl/zi4J8MOJlFONJqLRDAH KwpI2FjTOboYXksg4ryQipe+rDXWPRxeVHmIzoOTO/lcPnSaHEHq5o8xDWZrfX2ylzTy fyea45G7LljvHkKUlBuc9YKwAuScx9UetK3bwtxHvg+qto2D4ny9S+fMxSzeQPGJ0Q0J msjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701171323; x=1701776123; 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=lpsOqZj/TlHClhJSRKVkgDyQ/P7dWiPn/PGMJov/ZrI=; b=GiXds6coSFcO0A9ZTMvQhHgfEiebIfZxR1OrZd+hg5ABxNNqQoGdSpgVF7CmNLQP6M 04F8Tq+CA+4D5QDUXiu5z7ZFgWjXbSMi6kuy29AZVe3uSrJJNTBmsyKbWdrxrVX6XfZh CWWUjU02u+sBlqg2m/R4XoIidCiDlDdv8Om5qgk7nTfCU4kGN2nacSnRvLFBn1balUIx MsP3/qeVdR71z8zBqGcX+tJZMcw0nKiLrP5BR75z3gzbwXBKtCExTfz3Czdrqx658NkL 9es5q7WGQw+cQlEkneXXRmdYv9Vey+IjclpcG3gkr5EIthLxK4Zm5uTAqME2zVEKupzU t9hQ== X-Gm-Message-State: AOJu0YwBEs+c+KCw794srgoYa8VnSb0+hN6OZLPrDnpodWoQfZ2qtkhc CH4tmfhJQQ71nnP8GZWsEIfByMa7jNZjeG36WYI= X-Google-Smtp-Source: AGHT+IFTGIcFBvika7v9l/lBYqmCvjhaZfpwbqS5tk/4i1vD8YIQIHS2BGLcNWnESOglSYB5rCTqgQ== X-Received: by 2002:a05:651c:210f:b0:2c9:98b5:c285 with SMTP id a15-20020a05651c210f00b002c998b5c285mr7026386ljq.19.1701171322554; Tue, 28 Nov 2023 03:35:22 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b0040b4cb14d40sm1848769wmg.19.2023.11.28.03.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:35:22 -0800 (PST) Date: Tue, 28 Nov 2023 12:34:44 +0100 Message-ID: <20231128113510.11214-1-jean@foundationdevices.com> X-Mailer: git-send-email 2.41.0 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 no libc is available for the given TARGET. Change-Id: I17d19716373dd5704bb70d805437738fd29bd96b --- gnu/packages/cross-base.scm | 140 ++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 14cb365099..4b7c4b6cbe 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -610,74 +610,78 @@ (define* (cross-libc* target (xbinutils (cross-binutils 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)))))) +and the cross tool chain. If TARGET doesn't have a standard C library #f is +returned." + (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: