From patchwork Fri Jan 5 16:40:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58382 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 E93B827BBEA; Fri, 5 Jan 2024 16:41:08 +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.9 required=5.0 tests=BAYES_00,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 E6DF727BBE2 for ; Fri, 5 Jan 2024 16:41:07 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnFk-0006nt-3x; Fri, 05 Jan 2024 11:41:00 -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 1rLnFi-0006nA-MZ for guix-patches@gnu.org; Fri, 05 Jan 2024 11:40:58 -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 1rLnFh-0002h4-OU; Fri, 05 Jan 2024 11:40:57 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnFm-0003tM-1d; Fri, 05 Jan 2024 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 1/7] gnu: Memozise make-ld-wrapper results. References: <87plyfrb2x.fsf@cbaines.net> In-Reply-To: <87plyfrb2x.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286014927 (code B ref 68266); Fri, 05 Jan 2024 16:41:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:00 +0000 Received: from localhost ([127.0.0.1]:57723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFj-0003sO-0f for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:00 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:50159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFg-0003rw-EA for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:57 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 2BEF927BBE2 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 019e4bde for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:50 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:43 +0000 Message-ID: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/base.scm (make-ld-wrapper): Move code to make-ld-wrapper/implementation and call it. (make-ld-wrapper/implementation) New procedure. Change-Id: Id6fc805a4a7ffbc5ff0a5174eafcdf2c7c46854d --- gnu/packages/base.scm | 126 ++++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 60 deletions(-) base-commit: 5279bd453f354cbbaafff44e46c6fa03a39bc10a diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 8b25af6a5e..929bf9f422 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -66,6 +66,7 @@ (define-module (gnu packages base) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix memoization) #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) @@ -715,68 +716,73 @@ (define* (make-ld-wrapper name #:key wrapper for the cross-linker for that target, called 'TARGET-ld'. To use a different linker than the default \"ld\", such as \"ld.gold\" the linker name can be provided via the LINKER argument." - ;; Note: #:system->target-triplet is a procedure so that the evaluation of - ;; its result can be delayed until the 'arguments' field is evaluated, thus - ;; in a context where '%current-system' is accurate. - (package - (name name) - (version "0") - (source #f) - (build-system trivial-build-system) - (inputs `(("binutils" ,binutils) - ("guile" ,guile) - ("bash" ,bash) - ("wrapper" ,(search-path %load-path - "gnu/packages/ld-wrapper.in")))) - (arguments - (let ((target (target (%current-system)))) - `(#:guile ,guile-for-build - #:modules ((guix build utils)) - #:builder (begin - (use-modules (guix build utils) - (system base compile)) - - (let* ((out (assoc-ref %outputs "out")) - (bin (string-append out "/bin")) - (ld ,(if target - `(string-append bin "/" ,target "-" - ,linker) - `(string-append bin "/" ,linker))) - (go (string-append ld ".go"))) - - (setvbuf (current-output-port) - (cond-expand (guile-2.0 _IOLBF) - (else 'line))) - (format #t "building ~s/bin/ld wrapper in ~s~%" - (assoc-ref %build-inputs "binutils") - out) - - (mkdir-p bin) - (copy-file (assoc-ref %build-inputs "wrapper") ld) - (substitute* ld - (("@SELF@") - ld) - (("@GUILE@") - (string-append (assoc-ref %build-inputs "guile") - "/bin/guile")) - (("@BASH@") - (string-append (assoc-ref %build-inputs "bash") - "/bin/bash")) - (("@LD@") - (string-append (assoc-ref %build-inputs "binutils") - ,(if target - (string-append "/bin/" - target "-" linker) - (string-append "/bin/" linker))))) - (chmod ld #o555) - (compile-file ld #:output-file go)))))) - (synopsis "The linker wrapper") - (description - "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any + (make-ld-wrapper/implementation name target binutils linker + guile bash guile-for-build)) + +(define make-ld-wrapper/implementation + (mlambda (name target binutils linker guile bash guile-for-build) + ;; Note: #:system->target-triplet is a procedure so that the evaluation of + ;; its result can be delayed until the 'arguments' field is evaluated, + ;; thus in a context where '%current-system' is accurate. + (package + (name name) + (version "0") + (source #f) + (build-system trivial-build-system) + (inputs `(("binutils" ,binutils) + ("guile" ,guile) + ("bash" ,bash) + ("wrapper" ,(search-path %load-path + "gnu/packages/ld-wrapper.in")))) + (arguments + (let ((target (target (%current-system)))) + `(#:guile ,guile-for-build + #:modules ((guix build utils)) + #:builder (begin + (use-modules (guix build utils) + (system base compile)) + + (let* ((out (assoc-ref %outputs "out")) + (bin (string-append out "/bin")) + (ld ,(if target + `(string-append bin "/" ,target "-" + ,linker) + `(string-append bin "/" ,linker))) + (go (string-append ld ".go"))) + + (setvbuf (current-output-port) + (cond-expand (guile-2.0 _IOLBF) + (else 'line))) + (format #t "building ~s/bin/ld wrapper in ~s~%" + (assoc-ref %build-inputs "binutils") + out) + + (mkdir-p bin) + (copy-file (assoc-ref %build-inputs "wrapper") ld) + (substitute* ld + (("@SELF@") + ld) + (("@GUILE@") + (string-append (assoc-ref %build-inputs "guile") + "/bin/guile")) + (("@BASH@") + (string-append (assoc-ref %build-inputs "bash") + "/bin/bash")) + (("@LD@") + (string-append (assoc-ref %build-inputs "binutils") + ,(if target + (string-append "/bin/" + target "-" linker) + (string-append "/bin/" linker))))) + (chmod ld #o555) + (compile-file ld #:output-file go)))))) + (synopsis "The linker wrapper") + (description + "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any missing @code{-rpath} flags, and to detect any misuse of libraries outside of the store.") - (home-page "https://www.gnu.org/software/guix//") - (license gpl3+))) + (home-page "https://www.gnu.org/software/guix//") + (license gpl3+)))) (define-public %glibc/hurd-configure-flags ;; 'configure' in glibc 2.35 omits to pass '-ffreestanding' when detecting From patchwork Fri Jan 5 16:40:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58384 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 9588527BBE9; Fri, 5 Jan 2024 16:41:27 +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.9 required=5.0 tests=BAYES_00,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 82E5F27BBE2 for ; Fri, 5 Jan 2024 16:41:26 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnFk-0006oW-C4; Fri, 05 Jan 2024 11:41:00 -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 1rLnFi-0006nD-ON for guix-patches@gnu.org; Fri, 05 Jan 2024 11:40:58 -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 1rLnFi-0002hE-49; Fri, 05 Jan 2024 11:40:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnFm-0003tT-FM; Fri, 05 Jan 2024 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 2/7] gnu: Memozise cross-binutils results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286114940 (code B ref 68266); Fri, 05 Jan 2024 16:41:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:01 +0000 Received: from localhost ([127.0.0.1]:57725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFk-0003si-64 for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:00 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:57531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFg-0003rx-EC for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:58 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 37E7C27BBE9 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8ed7c751 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:44 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-binutils*): Move code to cross-binutils/implementation and call it. (cross-binutils/implementation) New procedure. (cross-binutils/deprecated): Call cross-binutils/implementation. Change-Id: Ic7a493177026c7a699108ab6d75482ff3c189340 --- gnu/packages/cross-base.scm | 92 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6ee7b315d8..a04e4f9c9e 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -89,56 +89,60 @@ (define (contains-keyword? args) (find keyword? args)) (define* (cross-binutils . args) + "Return a cross-Binutils for TARGET using BINUTILS." (if (or (= (length args) 1) (contains-keyword? args)) (apply cross-binutils* args) (apply cross-binutils/deprecated args))) +(define* (cross-binutils* target #:key (binutils binutils)) + (cross-binutils/implementation target binutils)) + (define* (cross-binutils/deprecated target #:optional (binutils binutils)) (warning (G_ "'cross-binutils' must be used with keyword arguments~%")) - (cross-binutils* target #:binutils binutils)) - -(define* (cross-binutils* target #:key (binutils binutils)) - "Return a cross-Binutils for TARGET using BINUTILS." - (let ((binutils (package - (inherit binutils) - (arguments - (substitute-keyword-arguments (package-arguments - binutils) - ((#:configure-flags flags) - ;; Build with `--with-sysroot' so that ld honors - ;; DT_RUNPATH entries when searching for a needed - ;; library. This works because as a side effect - ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells - ;; elf32.em to use DT_RUNPATH in its search list. - ;; See . - ;; - ;; In theory choosing / as the sysroot could lead ld - ;; to pick up native libs instead of target ones. In - ;; practice the RUNPATH of target libs only refers to - ;; target libs, not native libs, so this is safe. - `(cons "--with-sysroot=/" ,flags))))))) - - ;; For Xtensa, apply Qualcomm's patch. - (cross (cond ((string-prefix? "xtensa-" target) - (package-with-patches binutils - (search-patches - "ath9k-htc-firmware-binutils.patch"))) - ((target-mingw? target) - (package-with-extra-patches - (package-with-extra-configure-variable - ;; mingw binutils does not work correctly when configured - ;; with `--enable-compressed-debug-sections`. An error - ;; like the following will occur whenever you try to link: - ;; - ;; x86_64-w64-mingw32-ld: final link failed: bad value - ;; - ;; TODO: This seems like a deeper problem that warrants - ;; deeper investigation. - binutils "--enable-compressed-debug-sections" "no") - (search-patches "binutils-mingw-w64-timestamp.patch" - "binutils-mingw-w64-deterministic.patch"))) - (else binutils)) - target))) + (cross-binutils/implementation target binutils)) + +(define cross-binutils/implementation + (mlambda (target binutils) + (let ((binutils (package + (inherit binutils) + (arguments + (substitute-keyword-arguments (package-arguments + binutils) + ((#:configure-flags flags) + ;; Build with `--with-sysroot' so that ld honors + ;; DT_RUNPATH entries when searching for a needed + ;; library. This works because as a side effect + ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells + ;; elf32.em to use DT_RUNPATH in its search list. + ;; See . + ;; + ;; In theory choosing / as the sysroot could lead ld + ;; to pick up native libs instead of target ones. In + ;; practice the RUNPATH of target libs only refers to + ;; target libs, not native libs, so this is safe. + `(cons "--with-sysroot=/" ,flags))))))) + + ;; For Xtensa, apply Qualcomm's patch. + (cross (cond ((string-prefix? "xtensa-" target) + (package-with-patches binutils + (search-patches + "ath9k-htc-firmware-binutils.patch"))) + ((target-mingw? target) + (package-with-extra-patches + (package-with-extra-configure-variable + ;; mingw binutils does not work correctly when configured + ;; with `--enable-compressed-debug-sections`. An error + ;; like the following will occur whenever you try to link: + ;; + ;; x86_64-w64-mingw32-ld: final link failed: bad value + ;; + ;; TODO: This seems like a deeper problem that warrants + ;; deeper investigation. + binutils "--enable-compressed-debug-sections" "no") + (search-patches "binutils-mingw-w64-timestamp.patch" + "binutils-mingw-w64-deterministic.patch"))) + (else binutils)) + target)))) (define (cross-gcc-arguments target xgcc libc) "Return build system arguments for a cross-gcc for TARGET, using XGCC as the From patchwork Fri Jan 5 16:40:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58383 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 4D92327BBE2; Fri, 5 Jan 2024 16:41:25 +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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 327FF27BBE9 for ; Fri, 5 Jan 2024 16:41:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnFl-0006p6-5x; Fri, 05 Jan 2024 11:41:01 -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 1rLnFj-0006nX-Q6 for guix-patches@gnu.org; Fri, 05 Jan 2024 11:40:59 -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 1rLnFi-0002hL-H9; Fri, 05 Jan 2024 11:40:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnFm-0003tb-RL; Fri, 05 Jan 2024 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 3/7] gnu: Memozise cross-gcc results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286114953 (code B ref 68266); Fri, 05 Jan 2024 16:41:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:01 +0000 Received: from localhost ([127.0.0.1]:57727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFk-0003sv-Tz for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:01 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFg-0003ry-Fo for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:58 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 4344327BBEA for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id e46cabc2 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:45 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-gcc): Move code to cross-gcc/implementation and call it. (cross-gcc/implementation) New procedure. Change-Id: Ibeafaa4d652fc1d6fd27870b82a309c177b66a05 --- gnu/packages/cross-base.scm | 183 +++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 88 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index a04e4f9c9e..a4e361b476 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -301,6 +301,97 @@ (define (cross-gcc-search-paths target) ,(string-append target "/include"))))))) %gcc-cross-include-paths))) +(define cross-gcc/implementation + (mlambda (target xgcc xbinutils libc) + (package + (inherit xgcc) + (name (string-append "gcc-cross-" + (if libc "" "sans-libc-") + target)) + (source + (origin + (inherit + (package-source xgcc)) + (patches + (append + (origin-patches (package-source xgcc)) + (append (cond + ((version>=? (package-version xgcc) "12.0") + (search-patches "gcc-12-cross-environment-variables.patch" + "gcc-cross-gxx-include-dir.patch")) + ((version>=? (package-version xgcc) "10.0") + (search-patches "gcc-10-cross-environment-variables.patch" + "gcc-cross-gxx-include-dir.patch")) + ((version>=? (package-version xgcc) "8.0") + (search-patches "gcc-8-cross-environment-variables.patch")) + ((version>=? (package-version xgcc) "6.0") + (search-patches "gcc-7-cross-toolexeclibdir.patch" + "gcc-6-cross-environment-variables.patch")) + (else + (search-patches "gcc-cross-environment-variables.patch"))) + (cross-gcc-patches xgcc target)))) + (modules '((guix build utils))) + (snippet + (cross-gcc-snippet target)))) + + (outputs '("out" "lib")) + + (arguments + `(#:implicit-inputs? #f + #:imported-modules ((gnu build cross-toolchain) + ,@%gnu-build-system-modules) + #:modules ((guix build gnu-build-system) + (guix build utils) + (gnu build cross-toolchain) + (srfi srfi-1) + (srfi srfi-26) + (ice-9 regex)) + + ,@(cross-gcc-arguments target xgcc libc))) + + (native-inputs + `(("ld-wrapper-cross" ,(make-ld-wrapper + (string-append "ld-wrapper-" target) + #:target (const target) + #:binutils xbinutils)) + ("binutils-cross" ,xbinutils) + + ,@(let ((inputs (append (package-inputs xgcc) + (fold alist-delete (%final-inputs) + '("libc" "libc:static")) + + ;; Call it differently so that the builder can + ;; check whether the "libc" input is #f. + `(("libc-native" + ,@(assoc-ref (%final-inputs) "libc")) + ("libc-native:static" + ,@(assoc-ref (%final-inputs) + "libc:static")))))) + (cond + ((target-mingw? target) + (if libc + `(,@inputs + ("libc" ,libc)) + `(,@inputs + ("mingw-source" ,(package-source mingw-w64))))) + ((and libc (target-avr? target)) + `(,@inputs + ("libc" ,libc))) + (libc + `(,@inputs + ("libc" ,libc) + ("libc:static" ,libc "static") + ("xkernel-headers" ;the target headers + ,@(assoc-ref (package-propagated-inputs libc) + "kernel-headers")))) + (else inputs))))) + + (inputs '()) + + ;; Only search target inputs, not host inputs. + (search-paths (cross-gcc-search-paths target)) + (native-search-paths '())))) + (define* (cross-gcc target #:key (xgcc %xgcc) @@ -310,94 +401,10 @@ (define* (cross-gcc target XGCC as the base compiler. Use XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a GCC that does not target a libc; otherwise, target that libc." - (package - (inherit xgcc) - (name (string-append "gcc-cross-" - (if libc "" "sans-libc-") - target)) - (source - (origin - (inherit - (package-source xgcc)) - (patches - (append - (origin-patches (package-source xgcc)) - (append (cond - ((version>=? (package-version xgcc) "12.0") - (search-patches "gcc-12-cross-environment-variables.patch" - "gcc-cross-gxx-include-dir.patch")) - ((version>=? (package-version xgcc) "10.0") - (search-patches "gcc-10-cross-environment-variables.patch" - "gcc-cross-gxx-include-dir.patch")) - ((version>=? (package-version xgcc) "8.0") - (search-patches "gcc-8-cross-environment-variables.patch")) - ((version>=? (package-version xgcc) "6.0") - (search-patches "gcc-7-cross-toolexeclibdir.patch" - "gcc-6-cross-environment-variables.patch")) - (else - (search-patches "gcc-cross-environment-variables.patch"))) - (cross-gcc-patches xgcc target)))) - (modules '((guix build utils))) - (snippet - (cross-gcc-snippet target)))) - - (outputs '("out" "lib")) - - (arguments - `(#:implicit-inputs? #f - #:imported-modules ((gnu build cross-toolchain) - ,@%gnu-build-system-modules) - #:modules ((guix build gnu-build-system) - (guix build utils) - (gnu build cross-toolchain) - (srfi srfi-1) - (srfi srfi-26) - (ice-9 regex)) - - ,@(cross-gcc-arguments target xgcc libc))) - - (native-inputs - `(("ld-wrapper-cross" ,(make-ld-wrapper - (string-append "ld-wrapper-" target) - #:target (const target) - #:binutils xbinutils)) - ("binutils-cross" ,xbinutils) - - ,@(let ((inputs (append (package-inputs xgcc) - (fold alist-delete (%final-inputs) - '("libc" "libc:static")) - - ;; Call it differently so that the builder can - ;; check whether the "libc" input is #f. - `(("libc-native" - ,@(assoc-ref (%final-inputs) "libc")) - ("libc-native:static" - ,@(assoc-ref (%final-inputs) - "libc:static")))))) - (cond - ((target-mingw? target) - (if libc - `(,@inputs - ("libc" ,libc)) - `(,@inputs - ("mingw-source" ,(package-source mingw-w64))))) - ((and libc (target-avr? target)) - `(,@inputs - ("libc" ,libc))) - (libc - `(,@inputs - ("libc" ,libc) - ("libc:static" ,libc "static") - ("xkernel-headers" ;the target headers - ,@(assoc-ref (package-propagated-inputs libc) - "kernel-headers")))) - (else inputs))))) - - (inputs '()) - - ;; Only search target inputs, not host inputs. - (search-paths (cross-gcc-search-paths target)) - (native-search-paths '()))) + (cross-gcc/implementation target + xgcc + xbinutils + libc)) (define* (cross-kernel-headers . args) (if (or (= (length args) 1) (contains-keyword? args)) From patchwork Fri Jan 5 16:40:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58388 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 7997B27BBE2; Fri, 5 Jan 2024 16:42:42 +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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 B91FA27BBE9 for ; Fri, 5 Jan 2024 16:42:40 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnGt-00088d-Sa; Fri, 05 Jan 2024 11:42:11 -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 1rLnGi-00082Q-J0 for guix-patches@gnu.org; Fri, 05 Jan 2024 11:42:03 -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 1rLnGg-00036V-UV; Fri, 05 Jan 2024 11:42:00 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnGl-0003vw-97; Fri, 05 Jan 2024 11:42:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 4/7] gnu: Memozise cross-kernel-headers results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:42:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286515023 (code B ref 68266); Fri, 05 Jan 2024 16:42:03 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:05 +0000 Received: from localhost ([127.0.0.1]:57738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFo-0003uA-7R for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:05 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:41563) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFh-0003s0-5T for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:00 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 501D827BBEB for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:52 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id badd81b3 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:46 +0000 Message-ID: <4c720cbfb79b514b7ebae3a2f29998f198aa845f.1704472849.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-kernel-headers*): Move code to cross-kernel-headers/implementation and call it. (cross-kernel-headers/implementation) New procedure. Change-Id: I345604c089e7a8a9884c07f39c95f960760e86db --- gnu/packages/cross-base.scm | 306 ++++++++++++++++++------------------ 1 file changed, 157 insertions(+), 149 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index a4e361b476..f966e2f5ac 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -407,10 +407,19 @@ (define* (cross-gcc target libc)) (define* (cross-kernel-headers . args) + "Return headers depending on TARGET." (if (or (= (length args) 1) (contains-keyword? args)) (apply cross-kernel-headers* args) (apply cross-kernel-headers/deprecated args))) +(define* (cross-kernel-headers* target + #:key + (linux-headers linux-libre-headers) + (xgcc (cross-gcc target)) + (xbinutils (cross-binutils target))) + (cross-kernel-headers/implementation target + linux-headers xgcc xbinutils)) + (define* (cross-kernel-headers/deprecated target #:optional (linux-headers linux-libre-headers) @@ -486,159 +495,158 @@ (define* (cross-mig target (modify-inputs (package-native-inputs mig) (prepend xgcc xbinutils))))) -(define* (cross-kernel-headers* target - #:key - (linux-headers linux-libre-headers) - (xgcc (cross-gcc target)) - (xbinutils (cross-binutils target))) - "Return headers depending on TARGET." - - (define xlinux-headers (package - (inherit linux-headers) - (name (string-append (package-name linux-headers) - "-cross-" target)) (arguments - (substitute-keyword-arguments - `(#:implicit-cross-inputs? #f - ,@(package-arguments linux-headers)) - ((#:phases phases) - `(modify-phases ,phases - (replace 'build - (lambda _ - (setenv "ARCH" ,(platform-linux-architecture - (lookup-platform-by-target target))) - (format #t "`ARCH' set to `~a' (cross compiling)~%" - (getenv "ARCH")) - - (invoke "make" ,(system->defconfig target)) - (invoke "make" "mrproper" - ,@(if (version>=? (package-version linux-headers) "5.3") - '("headers") - '("headers_check"))))))))) - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ,@(package-native-inputs linux-headers))))) - - (define xmig - (cross-mig target #:xgcc xgcc #:xbinutils xbinutils)) - - (define xgnumach-headers - (cross-gnumach-headers target #:xgcc xgcc #:xbinutils xbinutils)) - - (define xhurd-headers - (package - (inherit hurd-headers) - (name (string-append (package-name hurd-headers) - "-cross-" target)) - - (arguments - (substitute-keyword-arguments (package-arguments hurd-headers) - ((#:configure-flags flags) - `(cons* ,(string-append "--build=" (%current-system)) - ,(string-append "--host=" target) - ,flags)))) - - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ("cross-mig" ,xmig) - ,@(alist-delete "mig" (package-native-inputs hurd-headers)))))) - - (define xglibc/hurd-headers - (package - (inherit glibc/hurd-headers) - (name (string-append (package-name glibc/hurd-headers) - "-cross-" target)) - - (arguments - (substitute-keyword-arguments - `(#:modules ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-26)) - ,@(package-arguments glibc/hurd-headers)) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'set-cross-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((mach (assoc-ref inputs "gnumach-headers")) - (hurd (assoc-ref inputs "hurd-headers")) - (cpath (string-append mach "/include:" - hurd "/include"))) - (for-each (cut setenv <> cpath) - ',%gcc-cross-include-paths) - #t))))) - ((#:configure-flags flags) - `(cons* ,(string-append "--build=" (%current-system)) - ,(string-append "--host=" target) - ,flags)))) - - (propagated-inputs `(("gnumach-headers" ,xgnumach-headers) - ("hurd-headers" ,xhurd-headers))) - - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ("cross-mig" ,xmig) - ,@(alist-delete "mig"(package-native-inputs glibc/hurd-headers)))))) - - (define xhurd-minimal - (package - (inherit hurd-minimal) - (name (string-append (package-name hurd-minimal) - "-cross-" target)) - (arguments - (substitute-keyword-arguments - `(#:modules ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-26)) - ,@(package-arguments hurd-minimal)) - ((#:configure-flags flags) - `(cons* ,(string-append "--build=" (%current-system)) - ,(string-append "--host=" target) - ,flags)) - ((#:phases phases) #~(modify-phases #$phases - (add-after 'unpack 'delete-shared-target - ;; Cannot create shared libraries due to missing crt1.o - (lambda _ - (substitute* "Makeconf" - (("(targets := \\$\\(libname\\)\\.a) \\$\\(libname\\)\\.so" all static) - static) - (("\\$\\(DESTDIR\\)\\$\\(libdir\\)/\\$\\(libname\\)\\.so\\.\\$\\(hurd-version\\)") - "") - (("^libs: .*\\.so\\..*" all) - (string-append "# " all))))) - (add-before 'configure 'set-cross-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((glibc-headers (assoc-ref inputs "cross-glibc-hurd-headers")) - (mach-headers (assoc-ref inputs "cross-gnumach-headers")) - (cpath (string-append glibc-headers "/include" - ":" mach-headers "/include"))) - (for-each (cut setenv <> cpath) - '#$%gcc-cross-include-paths) - #t))))))) - - (inputs `(("cross-glibc-hurd-headers" ,xglibc/hurd-headers) - ("cross-gnumach-headers" ,xgnumach-headers))) - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ("cross-mig" ,xmig) - ,@(alist-delete "mig" - (package-native-inputs hurd-minimal)))))) - - (define xhurd-core-headers - (package - (inherit hurd-core-headers) - (name (string-append (package-name hurd-core-headers) - "-cross-" target)) - - (inputs `(("gnumach-headers" ,xgnumach-headers) - ("hurd-headers" ,xhurd-headers) - ("hurd-minimal" ,xhurd-minimal))))) - - (match target - ((or "i586-pc-gnu" "i586-gnu") xhurd-core-headers) - (_ xlinux-headers))) +(define cross-kernel-headers/implementation + (mlambda (target linux-headers xgcc xbinutils) + (define xlinux-headers + (package + (inherit linux-headers) + (name (string-append (package-name linux-headers) + "-cross-" target)) + (arguments + (substitute-keyword-arguments + `(#:implicit-cross-inputs? #f + ,@(package-arguments linux-headers)) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda _ + (setenv "ARCH" ,(platform-linux-architecture + (lookup-platform-by-target target))) + (format #t "`ARCH' set to `~a' (cross compiling)~%" + (getenv "ARCH")) + + (invoke "make" ,(system->defconfig target)) + (invoke "make" "mrproper" + ,@(if (version>=? (package-version linux-headers) "5.3") + '("headers") + '("headers_check"))))))))) + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs linux-headers))))) + + (define xmig + (cross-mig target #:xgcc xgcc #:xbinutils xbinutils)) + + (define xgnumach-headers + (cross-gnumach-headers target #:xgcc xgcc #:xbinutils xbinutils)) + + (define xhurd-headers + (package + (inherit hurd-headers) + (name (string-append (package-name hurd-headers) + "-cross-" target)) + + (arguments + (substitute-keyword-arguments (package-arguments hurd-headers) + ((#:configure-flags flags) + `(cons* ,(string-append "--build=" (%current-system)) + ,(string-append "--host=" target) + ,flags)))) + + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig" (package-native-inputs hurd-headers)))))) + + (define xglibc/hurd-headers + (package + (inherit glibc/hurd-headers) + (name (string-append (package-name glibc/hurd-headers) + "-cross-" target)) + + (arguments + (substitute-keyword-arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26)) + ,@(package-arguments glibc/hurd-headers)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'set-cross-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((mach (assoc-ref inputs "gnumach-headers")) + (hurd (assoc-ref inputs "hurd-headers")) + (cpath (string-append mach "/include:" + hurd "/include"))) + (for-each (cut setenv <> cpath) + ',%gcc-cross-include-paths) + #t))))) + ((#:configure-flags flags) + `(cons* ,(string-append "--build=" (%current-system)) + ,(string-append "--host=" target) + ,flags)))) + + (propagated-inputs `(("gnumach-headers" ,xgnumach-headers) + ("hurd-headers" ,xhurd-headers))) + + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig"(package-native-inputs glibc/hurd-headers)))))) + + (define xhurd-minimal + (package + (inherit hurd-minimal) + (name (string-append (package-name hurd-minimal) + "-cross-" target)) + (arguments + (substitute-keyword-arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26)) + ,@(package-arguments hurd-minimal)) + ((#:configure-flags flags) + `(cons* ,(string-append "--build=" (%current-system)) + ,(string-append "--host=" target) + ,flags)) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'delete-shared-target + ;; Cannot create shared libraries due to missing crt1.o + (lambda _ + (substitute* "Makeconf" + (("(targets := \\$\\(libname\\)\\.a) \\$\\(libname\\)\\.so" all static) + static) + (("\\$\\(DESTDIR\\)\\$\\(libdir\\)/\\$\\(libname\\)\\.so\\.\\$\\(hurd-version\\)") + "") + (("^libs: .*\\.so\\..*" all) + (string-append "# " all))))) + (add-before 'configure 'set-cross-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((glibc-headers (assoc-ref inputs "cross-glibc-hurd-headers")) + (mach-headers (assoc-ref inputs "cross-gnumach-headers")) + (cpath (string-append glibc-headers "/include" + ":" mach-headers "/include"))) + (for-each (cut setenv <> cpath) + '#$%gcc-cross-include-paths) + #t))))))) + + (inputs `(("cross-glibc-hurd-headers" ,xglibc/hurd-headers) + ("cross-gnumach-headers" ,xgnumach-headers))) + + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig" + (package-native-inputs hurd-minimal)))))) + + (define xhurd-core-headers + (package + (inherit hurd-core-headers) + (name (string-append (package-name hurd-core-headers) + "-cross-" target)) + + (inputs `(("gnumach-headers" ,xgnumach-headers) + ("hurd-headers" ,xhurd-headers) + ("hurd-minimal" ,xhurd-minimal))))) + + (match target + ((or "i586-pc-gnu" "i586-gnu") xhurd-core-headers) + (_ xlinux-headers)))) (define* (cross-libc . args) (if (or (= (length args) 1) (contains-keyword? args)) From patchwork Fri Jan 5 16:40:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58385 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 CFC2427BBEA; Fri, 5 Jan 2024 16:42:13 +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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 24CED27BBE2 for ; Fri, 5 Jan 2024 16:42:13 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnGq-00086a-S6; Fri, 05 Jan 2024 11:42:10 -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 1rLnGi-00082M-Ii for guix-patches@gnu.org; Fri, 05 Jan 2024 11:42:03 -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 1rLnGg-00036U-Hu; Fri, 05 Jan 2024 11:42:00 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnGk-0003vo-TL; Fri, 05 Jan 2024 11:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 5/7] gnu: Memozise cross-mig results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286415017 (code B ref 68266); Fri, 05 Jan 2024 16:42:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:04 +0000 Received: from localhost ([127.0.0.1]:57736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFn-0003tz-Iw for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:04 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:33519) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFh-0003s1-8J for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:59 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 5C84D27BBEC for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:52 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id d12c39fb for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:47 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-mig): Move code to cross-mig/implementation and call it. (cross-mig/implementation) New procedure. Change-Id: Iaf2a69c48664d2f0766b9d2f6e981653e0e3c44c --- gnu/packages/cross-base.scm | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index f966e2f5ac..6c6c6e7636 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -467,37 +467,39 @@ (define* (cross-mig target (xbinutils (cross-binutils target))) "Return a cross-mig for TARGET, where TARGET is a GNU triplet. Use XGCC as the base compiler. Use XBINUTILS as the associated cross-Binutils." - (define xgnumach-headers - (cross-gnumach-headers target - #:xgcc xgcc - #:xbinutils xbinutils)) - (package - (inherit mig) - (name (string-append "mig-cross")) - (arguments - (substitute-keyword-arguments (package-arguments mig) - ((#:configure-flags flags #~'()) - #~(list #$(string-append "--target=" target))) - ((#:tests? _ #f) - #f) - ((#:phases phases #~%standard-phases) - #~(modify-phases #$phases - (add-before 'configure 'set-cross-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((mach #+xgnumach-headers) - (cpath (string-append mach "/include"))) - (for-each (lambda (variable) - (setenv variable cpath)) - '#$%gcc-cross-include-paths)))))))) - (propagated-inputs - (list xgnumach-headers)) - (native-inputs - (modify-inputs (package-native-inputs mig) - (prepend xgcc xbinutils))))) + (cross-mig/implementation target xgcc xbinutils)) +(define cross-mig/implementation + (mlambda (target xgcc xbinutils) + "Return a cross-mig for TARGET, where TARGET is a GNU triplet. Use XGCC as +the base compiler. Use XBINUTILS as the associated cross-Binutils." + (define xgnumach-headers + (cross-gnumach-headers target + #:xgcc xgcc + #:xbinutils xbinutils)) (package + (inherit mig) + (name (string-append "mig-cross")) (arguments + (substitute-keyword-arguments (package-arguments mig) + ((#:configure-flags flags #~'()) + #~(list #$(string-append "--target=" target))) + ((#:tests? _ #f) + #f) + ((#:phases phases #~%standard-phases) #~(modify-phases #$phases + (add-before 'configure 'set-cross-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((mach #+xgnumach-headers) + (cpath (string-append mach "/include"))) + (for-each (lambda (variable) + (setenv variable cpath)) + '#$%gcc-cross-include-paths)))))))) + (propagated-inputs + (list xgnumach-headers)) + (native-inputs + (modify-inputs (package-native-inputs mig) + (prepend xgcc xbinutils)))))) (define cross-kernel-headers/implementation (mlambda (target linux-headers xgcc xbinutils) From patchwork Fri Jan 5 16:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58387 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 DDFA127BBEA; Fri, 5 Jan 2024 16:42:34 +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.9 required=5.0 tests=BAYES_00,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 A2D7A27BBE9 for ; Fri, 5 Jan 2024 16:42:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnGt-00087H-O0; Fri, 05 Jan 2024 11:42:11 -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 1rLnGi-00082I-HF for guix-patches@gnu.org; Fri, 05 Jan 2024 11:42:03 -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 1rLnGf-00036P-Nj; Fri, 05 Jan 2024 11:41:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnGk-0003vY-23; Fri, 05 Jan 2024 11:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 6/7] gnu: Memozise cross-libc results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286314991 (code B ref 68266); Fri, 05 Jan 2024 16:42:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:03 +0000 Received: from localhost ([127.0.0.1]:57730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFm-0003tU-FI for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:03 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFh-0003sA-Tp for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:59 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 7241827BBED for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:52 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id d5431592 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:48 +0000 Message-ID: <64ae83ce361b2883e9bdf4bcdaacb03a4fbd9611.1704472849.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-libc*): Move code to cross-libc/implementation and call it. (cross-libc/implementation) New procedure. Change-Id: I72f430136860e5d1fd9edeb3274678186b896bd4 --- gnu/packages/cross-base.scm | 165 +++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 80 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6c6c6e7636..8a40211456 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -651,10 +651,22 @@ (define cross-kernel-headers/implementation (_ xlinux-headers)))) (define* (cross-libc . args) + "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS +and the cross tool chain. If TARGET doesn't have a standard C library #f is +returned." (if (or (= (length args) 1) (contains-keyword? args)) (apply cross-libc* args) (apply cross-libc/deprecated args))) +(define* (cross-libc* target + #:key + (libc (libc-for-target target)) + (xgcc (cross-gcc target)) + (xbinutils (cross-binutils target)) + (xheaders (cross-kernel-headers target))) + (cross-libc/implementation target libc + xgcc xbinutils xheaders)) + (define* (cross-libc/deprecated target #:optional (libc (libc-for-target target)) @@ -668,88 +680,81 @@ (define* (cross-libc/deprecated target #:xbinutils xbinutils #:xheaders xheaders)) -(define* (cross-libc* target - #:key - (libc (libc-for-target target)) - (xgcc (cross-gcc 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 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" +(define cross-libc/implementation + (mlambda (target libc xgcc xbinutils xheaders) + (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))))) - ((? target-avr?) - (make-avr-libc #:xbinutils xbinutils - #:xgcc xgcc)) - (else #f))) + ,@(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))))) + ((? target-avr?) + (make-avr-libc #:xbinutils xbinutils + #:xgcc xgcc)) + (else #f)))) (define* (cross-gcc-toolchain/implementation target #:key From patchwork Fri Jan 5 16:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 58386 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 47DC527BBE2; Fri, 5 Jan 2024 16:42:27 +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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 B6EED27BBE9 for ; Fri, 5 Jan 2024 16:42:26 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnGu-00089w-QE; Fri, 05 Jan 2024 11:42:12 -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 1rLnGi-00082F-Gr for guix-patches@gnu.org; Fri, 05 Jan 2024 11:42:03 -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 1rLnGg-00036T-6O for guix-patches@gnu.org; Fri, 05 Jan 2024 11:42:00 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnGk-0003vg-GU; Fri, 05 Jan 2024 11:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 7/7] packages: rust: Memoize make-rust-sysroot results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286315008 (code B ref 68266); Fri, 05 Jan 2024 16:42:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:03 +0000 Received: from localhost ([127.0.0.1]:57734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFn-0003tk-3H for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:03 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:55299) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFh-0003s9-Rb for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:59 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 7D6CA27BBEE for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:52 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id d075a7ef for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:49 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> 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: , 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 To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/rust.scm (make-rust-sysroot): Move code to make-rust-sysroot/implementation. (make-rust-sysroot/implementation): New variable. Change-Id: Ibb30c7398328c87c032bb8828635a34ada935167 --- gnu/packages/rust.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index ea95d27476..64cde7ea14 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -60,6 +60,7 @@ (define-module (gnu packages rust) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix download) + #:use-module (guix memoization) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) @@ -1057,7 +1058,10 @@ (define-public rust (package-native-inputs base-rust)))))) (define*-public (make-rust-sysroot target) - (let ((base-rust rust)) + (make-rust-sysroot/implementation target rust)) + +(define make-rust-sysroot/implementation + (mlambda (target base-rust) (package (inherit base-rust) (name (string-append "rust-sysroot-for-" target))