From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2NIvGyQxmGVY2QAAkFu2QA (envelope-from ) for ; Fri, 05 Jan 2024 17:41:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id gIMyFSQxmGWA1AAAqHPOHw (envelope-from ) for ; Fri, 05 Jan 2024 17:41:08 +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=1704472868; 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=8345rq5K824Mz7fCXiYoCezMWNrYL7/t6Gcxswv5bnU=; b=swKGKDFcbVDfDQJow3H3AWvXmmsR1Qba/0kKcYJbEtWZuMm+hnkIUsNEwhMxGhkmRLB+J6 lX2RHAq5uwaH2ZcyxhSa47BdhsMfS6tLkCykedqBOmgPcLPt/xse/SpNpow1/eclz5VdeC VPM7jlmOklwnJRXh3dBm2MYtrzyqkAR4S3B/vAL0hH+Qzh6Hj3ooniCxPjeyCsBJBvnBlN vODSSRJghQIcohaEDQTsQsPrtcycSbJeRSn070gzIrsRcntiZmCr63sMm+1ZDk/4m51iyG mrA4BOEgH8cxnBXS6zi3MqifxfBZ55xNGM+/TKQr+MCfVu1tMN9pw65K9XFpYg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704472868; a=rsa-sha256; cv=none; b=LMfPyB529pE4UKI0phSYPx4mgC8q+1tbwFRZ7EpTH2XmGhx+g0UlRI4yA3KIj+3gGr2Azb xezRQ3fw/rYV6HfkqG7z/yIfEwH+DLVprPTkrXgVztdCyplhaR2QS8XsCb6uyuS2zO2XoW KwuFRannrkCBZPmqPo/Xe/UsCKVW4aCLWI+AACPGgpaA4DwP+nLiZKOdlmON5YKb4y32ED 4qE3s1jGFjGPFqCRieOET0sEy8fM4MEFM4WnMvN+vyGzkYKEKdTfcIjXdSgSWWPfiCPqkG mQw2apa3ExKTbVmpkFPW4Vj5prZmdTiio81WYmUee0eIEe+95iSF8S/7E5WSUA== 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 0A63CFA9E for ; Fri, 5 Jan 2024 17:41:08 +0100 (CET) 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 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-Queue-Id: 0A63CFA9E X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -4.79 X-Spam-Score: -4.79 X-TUID: pbPVE4DmH24Q 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(-) 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 base-commit: 5279bd453f354cbbaafff44e46c6fa03a39bc10a -- 2.41.0