From patchwork Mon May 22 09:04:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 50225 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 D07C227BBE9; Mon, 22 May 2023 10:06:08 +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=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 6CA5627BBE2 for ; Mon, 22 May 2023 10:06:07 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q11Tz-0001ig-D2; Mon, 22 May 2023 05:05:35 -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 1q11TV-0001cZ-Jk for guix-patches@gnu.org; Mon, 22 May 2023 05:05:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q11TV-0004J5-8z for guix-patches@gnu.org; Mon, 22 May 2023 05:05:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q11TV-00078A-48 for guix-patches@gnu.org; Mon, 22 May 2023 05:05:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63641] [PATCH 5/8] gnu: Add libc-for-target and glibc/hurd. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 22 May 2023 09:05:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63641 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63641@debbugs.gnu.org Cc: Josselin Poiret Received: via spool by 63641-submit@debbugs.gnu.org id=B63641.168474627627310 (code B ref 63641); Mon, 22 May 2023 09:05:05 +0000 Received: (at 63641) by debbugs.gnu.org; 22 May 2023 09:04:36 +0000 Received: from localhost ([127.0.0.1]:33554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q11T1-00076J-RN for submit@debbugs.gnu.org; Mon, 22 May 2023 05:04:36 -0400 Received: from jpoiret.xyz ([206.189.101.64]:39448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q11Sv-00075O-Sf for 63641@debbugs.gnu.org; Mon, 22 May 2023 05:04:34 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id B2B39185310; Mon, 22 May 2023 09:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1684746268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZpshIGAUVRqKI2x1Bq0FwKrewa4fP6B931pUaNGpwfc=; b=T+564JN2viLP+V9TF4MGlaw4LwcuV21/FfaGNJu+swBapTTyRAJi7gvAUY9Q0RsBiKJ+DR QkIy+Jfl1cEUARHRwgk1rIggxo98STVBak8lREY1hHqoiFbzMLheImTw+R14Px4nL/Tzx3 /ppQYJrrt6T9v6pUOai/t6rLBlCj85q15wHcfTXgalhx8ccqpIU+cb+b+iwCKfLjyG7Rb9 qFfM1Lo9jMGdvHp6ZC3ni3PcbAo+XjEsgHlmHr6HOFHjxhDaYOIY6Qxe9JGXcl7Hl/GAh8 3B96m4vEU54SyPYZQzSSbDBnEdeCX8QsxHTywRTy4F/Tm93qNN5YzPriQrksKA== Date: Mon, 22 May 2023 11:04:15 +0200 Message-Id: <6159809904a724d5db977063feb0bb6c260063d1.1684745752.git.dev@jpoiret.xyz> In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz 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: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret 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 From: Josselin Poiret * gnu/packages/base.scm (glibc/hurd, libc-for-target): New variables. (glibc/hurd-headers): Use glibc/hurd. * gnu/packages/commencement.scm (glibc-final-with-bootstrap-bash, glibc-final): Use libc-for-target. * gnu/packages/cross-base.scm (cross-libc/deprecated, cross-libc*): Use libc-for-target. --- gnu/packages/base.scm | 38 ++++++++++++++++++-- gnu/packages/commencement.scm | 66 +++++++++++++++++------------------ gnu/packages/cross-base.scm | 4 +-- 3 files changed, 70 insertions(+), 38 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index f944ab5d47..59c9632551 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -75,6 +75,7 @@ (define-module (gnu packages base) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (glibc + libc-for-target make-ld-wrapper libiconv-if-needed)) @@ -1415,20 +1416,42 @@ (define-public which command.") (license gpl3+))) ; some files are under GPLv2+ +(define-public glibc/hurd + (package/inherit glibc + (name "glibc-hurd") + (version "2.37") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz")) + (sha256 + (base32 + "0hqsp4dzrjx0iga6jv0magjw26dh82pxlmk8yis5v0d127qyymr2")) + (patches (search-patches "glibc-ldd-powerpc.patch" + "glibc-2.37-ldd-x86_64.patch" + "glibc-dl-cache.patch" + "glibc-2.37-versioned-locpath.patch" + "glibc-reinstate-prlimit64-fallback.patch" + "glibc-supported-locales.patch" + "glibc-2.37-hurd-clock_t_centiseconds.patch" + "glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch" + "glibc-hurd-mach-print.patch" + "glibc-hurd-gettyent.patch")))) + (supported-systems %hurd-systems))) + (define-public glibc/hurd-headers - (package (inherit glibc) + (package/inherit glibc/hurd (name "glibc-hurd-headers") (outputs '("out")) (propagated-inputs (list gnumach-headers hurd-headers)) (native-inputs - (modify-inputs (package-native-inputs glibc) + (modify-inputs (package-native-inputs glibc/hurd) (prepend (if (%current-target-system) (let* ((cross-base (resolve-interface '(gnu packages cross-base))) (cross-mig (module-ref cross-base 'cross-mig))) (cross-mig (%current-target-system))) mig)))) (arguments - (substitute-keyword-arguments (package-arguments glibc) + (substitute-keyword-arguments (package-arguments glibc/hurd) ;; We just pass the flags really needed to build the headers. ((#:configure-flags flags) `(list "--enable-add-ons" @@ -1449,6 +1472,15 @@ (define-public glibc/hurd-headers (delete 'build))))) ; nothing to build (supported-systems %hurd-systems))) +(define* (libc-for-target #:optional + (target (or (%current-target-system) + (%current-system)))) + (match target + ((? target-hurd?) + glibc/hurd) + (_ + glibc))) + (define-public tzdata (package (name "tzdata") diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index ab07fb37ab..a24c60ebf8 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -2816,13 +2816,13 @@ (define (%boot1-inputs) ("binutils-cross" ,binutils-boot0) ,@(alist-delete "binutils" (%boot0-inputs)))) -(define glibc-final-with-bootstrap-bash +(define/system-dependent glibc-final-with-bootstrap-bash ;; The final libc, "cross-built". If everything went well, the resulting ;; store path has no dependencies. Actually, the really-final libc is ;; built just below; the only difference is that this one uses the ;; bootstrap Bash. (package - (inherit glibc) + (inherit (libc-for-target)) (name "glibc-intermediate") (outputs (delete "debug" (package-outputs glibc))) (source (bootstrap-origin (package-source glibc))) @@ -2991,39 +2991,39 @@ (define gettext-boot0 (("^PROGRAMS =.*$") "PROGRAMS =\n"))))))))) -(define glibc-final +(define/system-dependent glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any. - (package/inherit - glibc - (name "glibc") - (source (bootstrap-origin (package-source glibc))) - (inputs `(("static-bash" ,static-bash-for-glibc) - ,@(alist-delete - "static-bash" - (package-inputs glibc-final-with-bootstrap-bash)))) - - ;; This time we need 'msgfmt' to install all the libc.mo files. - (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash) - ("gettext" ,gettext-boot0))) - - (propagated-inputs - (package-propagated-inputs glibc-final-with-bootstrap-bash)) - - ;; The final libc only refers to itself, but the 'debug' output contains - ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great - ;; if 'allowed-references' were per-output. - (arguments - `(#:allowed-references - (,(gexp-input gcc-boot0 "lib") - ,(kernel-headers-boot0) - ,static-bash-for-glibc - ,@(if (hurd-system?) - `(,gnumach-headers-boot0 - ,hurd-headers-boot0) - '()) - ,@(package-outputs glibc-final-with-bootstrap-bash)) - ,@(package-arguments glibc-final-with-bootstrap-bash))))) + (let ((libc (libc-for-target))) + (package/inherit libc + (name "glibc") + (source (bootstrap-origin (package-source glibc))) + (inputs `(("static-bash" ,static-bash-for-glibc) + ,@(alist-delete + "static-bash" + (package-inputs glibc-final-with-bootstrap-bash)))) + + ;; This time we need 'msgfmt' to install all the libc.mo files. + (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash) + ("gettext" ,gettext-boot0))) + + (propagated-inputs + (package-propagated-inputs glibc-final-with-bootstrap-bash)) + + ;; The final libc only refers to itself, but the 'debug' output contains + ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great + ;; if 'allowed-references' were per-output. + (arguments + `(#:allowed-references + (,(gexp-input gcc-boot0 "lib") + ,(kernel-headers-boot0) + ,static-bash-for-glibc + ,@(if (hurd-system?) + `(,gnumach-headers-boot0 + ,hurd-headers-boot0) + '()) + ,@(package-outputs glibc-final-with-bootstrap-bash)) + ,@(package-arguments glibc-final-with-bootstrap-bash)))))) (define/system-dependent gcc-boot0-wrapped ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 01c2295853..b2823c73c5 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -577,7 +577,7 @@ (define* (cross-libc . args) (define* (cross-libc/deprecated target #:optional - (libc glibc) + (libc (libc-for-target target)) (xgcc (cross-gcc target)) (xbinutils (cross-binutils target)) (xheaders (cross-kernel-headers target))) @@ -590,7 +590,7 @@ (define* (cross-libc/deprecated target (define* (cross-libc* target #:key - (libc glibc) + (libc (libc-for-target target)) (xgcc (cross-gcc target)) (xbinutils (cross-binutils target)) (xheaders (cross-kernel-headers target)))