From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id mHzoFjQxmGXjRQEAkFu2QA (envelope-from ) for ; Fri, 05 Jan 2024 17:41:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 4DBkEjQxmGWGVwEAe85BDQ (envelope-from ) for ; Fri, 05 Jan 2024 17:41:24 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704472884; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=KAYqwPhAdPTLYnBHJzL9f2EElE0YQ1VIx6MCZ9RQvlQ=; b=PMU9BaSAx/lb8e6SGoKG2R2dId6ueYrcOuo4N7NPoqgHe5b1UiRsIQDnnQ+mQCcOw6I0+t 7BlAmsvJTN+Ye4hC8vRJwwxJ772NLXXgU3D64nDTCMDs1sEx+6g2XOhiIlKk2Fd1WRbIiz DuRNIMjOPg5qiQt7xK7vZmt+TvP+M8OmEtyKxL+VFBci3TXhRtq0nsQLQIstC8pLA21J1T l8VhOIrevW0d8+hkEylfw+nXICEjaPTcxMEGWjpYn4pYd1zA4/a2lquOsL7rd0ifx8K5BT woKguudjwMQQf7TTMuRrYd7sghPrbK6isk5mE+Y67jYZOAiv/on36wM2QldlmQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704472884; a=rsa-sha256; cv=none; b=kPUby+3kfY0me0B7u/5fCqlPv9VpLy2hlNJkcecstPj2hchvmVyl2YeV80LKScrhxvZOcb e/HnuFLpbSkSffAdnXHm0BmCXozBe4Xd0AvmAAnx6uBemOp6IBFT3KeN3FvjFF6gNfQ7Qf /dLnk+F2NgxkyhvbJCriEtuc67nJ4jln1xdfabbzLf4nLdZNVoaqmRhRwqANqGV11HNTf1 YNit0R8X3XJfkPOM0mR/DVnGCXmhrM+Bz5JC9pZEm/e7p4uSh7Mj/QZc79PGZnGLl0j8P+ ZtMWHd/HP49s7d34V8CNbzf3Nnn8tE35Qa5H6JeiMkaWWyCuFlRcRuS15I6N7g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EFF15F40F for ; Fri, 5 Jan 2024 17:41:24 +0100 (CET) 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 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.77 X-Spam-Score: -4.77 X-Migadu-Queue-Id: 1EFF15F40F X-Migadu-Scanner: mx11.migadu.com X-TUID: Wn+l1nIbvAxT 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)) -- 2.41.0