build-system: gnu: Improve gnu-cross-build style.

* guix/build-system/gnu.scm
(gnu-cross-build): Use with-imported-modules around the
gnu-cross-build builder gexp.

Change-Id: I47246571b1d84a82a67a8c289fd5ad4b5a3b5aeb
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
Nicolas Graves 2025-04-25 11:26:30 +02:00 committed by Christopher Baines
parent 490ad5f932
commit aa7b1abf2c
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -520,65 +521,65 @@ is one of `host' or `target'."
cross-built inputs, and NATIVE-INPUTS are inputs that run on the build cross-built inputs, and NATIVE-INPUTS are inputs that run on the build
platform." platform."
(define builder (define builder
#~(begin (with-imported-modules imported-modules
(use-modules #$@(sexp->gexp modules)) #~(begin
(use-modules #$@(sexp->gexp modules))
(define %build-host-inputs (define %build-host-inputs
#+(input-tuples->gexp build-inputs)) #+(input-tuples->gexp build-inputs))
(define %build-target-inputs (define %build-target-inputs
(append #$(input-tuples->gexp host-inputs) (append #$(input-tuples->gexp host-inputs)
#+(input-tuples->gexp target-inputs))) #+(input-tuples->gexp target-inputs)))
(define %build-inputs (define %build-inputs
(append %build-host-inputs %build-target-inputs)) (append %build-host-inputs %build-target-inputs))
(define %outputs (define %outputs
#$(outputs->gexp outputs)) #$(outputs->gexp outputs))
(gnu-build #:source #+source (gnu-build #:source #+source
#:system #$system #:system #$system
#:build #$build #:build #$build
#:target #$target #:target #$target
#:outputs %outputs #:outputs %outputs
#:inputs %build-target-inputs #:inputs %build-target-inputs
#:native-inputs %build-host-inputs #:native-inputs %build-host-inputs
#:search-paths '#$(sexp->gexp #:search-paths '#$(sexp->gexp
(map search-path-specification->sexp (map search-path-specification->sexp
search-paths)) search-paths))
#:native-search-paths '#$(sexp->gexp #:native-search-paths '#$(sexp->gexp
(map (map
search-path-specification->sexp search-path-specification->sexp
native-search-paths)) native-search-paths))
#:phases #$(if (pair? phases) #:phases #$(if (pair? phases)
(sexp->gexp phases) (sexp->gexp phases)
phases) phases)
#:locale #$locale #:locale #$locale
#:separate-from-pid1? #$separate-from-pid1? #:separate-from-pid1? #$separate-from-pid1?
#:bootstrap-scripts #$bootstrap-scripts #:bootstrap-scripts #$bootstrap-scripts
#:configure-flags #$configure-flags #:configure-flags #$configure-flags
#:make-flags #$make-flags #:make-flags #$make-flags
#:out-of-source? #$out-of-source? #:out-of-source? #$out-of-source?
#:tests? #$tests? #:tests? #$tests?
#:test-target #$test-target #:test-target #$test-target
#:parallel-build? #$parallel-build? #:parallel-build? #$parallel-build?
#:parallel-tests? #$parallel-tests? #:parallel-tests? #$parallel-tests?
#:patch-shebangs? #$patch-shebangs? #:patch-shebangs? #$patch-shebangs?
#:license-file-regexp #$license-file-regexp #:license-file-regexp #$license-file-regexp
#:strip-binaries? #$strip-binaries? #:strip-binaries? #$strip-binaries?
#:validate-runpath? #$validate-runpath? #:validate-runpath? #$validate-runpath?
#:make-dynamic-linker-cache? #$make-dynamic-linker-cache? #:make-dynamic-linker-cache? #$make-dynamic-linker-cache?
#:license-file-regexp #$license-file-regexp #:license-file-regexp #$license-file-regexp
#:strip-flags #$strip-flags #:strip-flags #$strip-flags
#:strip-directories #$strip-directories))) #:strip-directories #$strip-directories))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile)) (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f))) system #:graft? #f)))
(gexp->derivation name builder (gexp->derivation name builder
#:system system #:system system
#:target target #:target target
#:graft? #f #:graft? #f
#:modules imported-modules
#:substitutable? substitutable? #:substitutable? substitutable?
#:allowed-references allowed-references #:allowed-references allowed-references
#:disallowed-references disallowed-references #:disallowed-references disallowed-references