guix_mirror_bot pushed a commit to branch core-packages-team
in repository guix.

commit 5643a7a0c2ea9bc6f987fdd267526d0be21b14db
Author: Ludovic Courtès <[email protected]>
AuthorDate: Mon Feb 16 12:12:09 2026 +0100

    build-system/gnu: Add the toolchain to #:disallowed-references by default.
    
    This should help keep package closure size under control in cases where a
    reference to the toolchain is unwillingly kept, as is the case in
    guix/guix#2846.
    
    * guix/build-system/gnu.scm (default-disallowed-references): New procedure.
    (lower)[private-keywords]: Remove #:implicit-inputs? and 
#:implicit-cross-inputs?.
    (gnu-build): Add #:implicit-inputs? and #:implicit-cross-inputs?.  Change
    value for #:disallowed-references.
    (gnu-cross-build): Add #:implicit-inputs? and #:implicit-cross-inputs?.
    * guix/build-system/cmake.scm (lower)[private-keywords]: Remove 
#:implicit-inputs?
    and #:implicit-cross-inputs?.
    (cmake-build): Add #:implicit-inputs? and #:implicit-cross-inputs?.  Change
    value for #:disallowed-references.
    (cmake-cross-build): Add #:implicit-inputs? and #:implicit-cross-inputs?.
    
    Change-Id: Ie1c53802c0fff78926e4e02d5ff30b3665c74c6a
    Signed-off-by: Ludovic Courtès <[email protected]>
    Merges: #6473
---
 guix/build-system/cmake.scm | 16 ++++++++++++----
 guix/build-system/gnu.scm   | 26 ++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 373c6cbbb10..cceeb58cc61 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2015, 2020-2022 Ludovic Courtès <[email protected]>
+;;; Copyright © 2013-2015, 2020-2022, 2026 Ludovic Courtès <[email protected]>
 ;;; Copyright © 2013 Cyril Roelandt <[email protected]>
 ;;; Copyright © 2017 Ricardo Wurmus <[email protected]>
 ;;; Copyright © 2020 Efraim Flashner <[email protected]>
@@ -122,7 +122,6 @@
   "Return a bag for NAME."
   (define private-keywords
     `(#:cmake #:inputs #:native-inputs
-      #:implicit-inputs? #:implicit-cross-inputs?
       ,@(if target '() '(#:target))))
 
   (bag
@@ -161,7 +160,10 @@
 
 (define* (cmake-build name inputs
                       #:key guile source
-                      (outputs '("out")) (configure-flags ''())
+                      (outputs '("out"))
+                      (implicit-inputs? #t)
+                      (implicit-cross-inputs? #t)
+                      (configure-flags ''())
                       (search-paths '())
                       (make-flags ''())
                       (out-of-source? #t)
@@ -230,7 +232,11 @@ provides a 'CMakeLists.txt' file as its build system."
                       #:graft? #f
                       #:substitutable? substitutable?
                       #:allowed-references allowed-references
-                      #:disallowed-references disallowed-references
+                      #:disallowed-references
+                      (or disallowed-references
+                          (and implicit-inputs?
+                               (not allowed-references)
+                               (default-disallowed-references system)))
                       #:guile-for-build guile)))
 
 
@@ -243,6 +249,8 @@ provides a 'CMakeLists.txt' file as its build system."
                             target
                             build-inputs target-inputs host-inputs
                             source guile
+                            (implicit-inputs? #t)
+                            (implicit-cross-inputs? #t)
                             (outputs '("out"))
                             (configure-flags ''())
                             (search-paths '())
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index f0c261034fe..49e393b459a 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -37,6 +37,7 @@
             gnu-build-system
             standard-packages
             standard-cross-packages
+            default-disallowed-references
             package-with-explicit-inputs
             package-with-extra-configure-variable
             static-libgcc-package
@@ -275,6 +276,20 @@ standard packages used as implicit inputs of the GNU build 
system."
   (let ((distro (resolve-module '(gnu packages commencement))))
     ((module-ref distro '%final-inputs) system)))
 
+(define default-disallowed-references
+  (mlambda (system)
+    "Return the set of disallowed references for SYSTEM--i.e., build-time
+dependencies that build outputs should not refer to by default."
+    ;; XXX: Ideally we would mark all of them but this is too ambitious at
+    ;; this stage: many packages keep a reference to coreutils, grep, etc.
+    (filter-map (match-lambda
+                  (("gcc" gcc) gcc)
+                  (("binutils" binutils) binutils)
+                  (("ld-wrapper" ld-wrapper) ld-wrapper)
+                  (("libc:static" libc "static") (gexp-input libc "static"))
+                  (_ #f))
+                (standard-packages system))))
+
 (define* (lower name
                 #:key source inputs native-inputs outputs target
                 (implicit-inputs? #t) (implicit-cross-inputs? #t)
@@ -284,7 +299,6 @@ standard packages used as implicit inputs of the GNU build 
system."
   "Return a bag for NAME from the given arguments."
   (define private-keywords
     `(#:inputs #:native-inputs #:outputs
-      #:implicit-inputs? #:implicit-cross-inputs?
       ,@(if target '() '(#:target))))
 
   (bag
@@ -341,6 +355,8 @@ standard packages used as implicit inputs of the GNU build 
system."
                     guile source
                     (outputs '("out"))
                     (search-paths '())
+                    (implicit-inputs? #t)
+                    (implicit-cross-inputs? #t)
                     (bootstrap-scripts %bootstrap-scripts)
                     (configure-flags ''())
                     (make-flags ''())
@@ -433,7 +449,11 @@ are allowed to refer to."
                       #:graft? #f
                       #:substitutable? substitutable?
                       #:allowed-references allowed-references
-                      #:disallowed-references disallowed-references
+                      #:disallowed-references
+                      (or disallowed-references
+                          (and implicit-inputs?
+                               (not allowed-references)
+                               (default-disallowed-references system)))
                       #:guile-for-build guile)))
 
 
@@ -478,6 +498,8 @@ is one of `host' or `target'."
                           target
                           build-inputs target-inputs host-inputs
                           guile source
+                          (implicit-inputs? #t)
+                          (implicit-cross-inputs? #t)
                           (outputs '("out"))
                           (search-paths '())
                           (native-search-paths '())

Reply via email to