profiles: Add manifest generator based on build-system.
Changes
3 files changed · +48 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| doc/guix.texi | modified | +17 | −0 | View file |
| guix/profiles.scm | modified | +18 | −0 | View file |
| tests/profiles.scm | modified | +13 | −0 | View file |
doc/guix.texi
View filediff --git a/doc/guix.texi b/doc/guix.texi
index d3abbf2..c25a307 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9837,6 +9837,23 @@ line, which can often be more convenient.
@c TODO: specifications->package, etc.
+@deffn {Procedure} build-system->manifest build-system [system] [#:target]
+Given @var{build-system}, a variable referring to a build system value
+suitable for the @code{build-system} field in the @code{package} record
+type, return a manifest providing all the packages required by the build
+system, for @var{system}, optionally when cross-compiling to
+@var{target}.
+
+In order to be able to use a build system variable, the corresponding
+module must be loaded, as in the following example:
+
+@lisp
+(use-modules (guix build-system cmake))
+
+(build-system->manifest cmake-build-system)
+@end lisp
+@end deffn
+
@node Build Systems
@section Build Systems
guix/profiles.scm
View filediff --git a/guix/profiles.scm b/guix/profiles.scm
index e5f8337..51dd064 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -127,6 +127,7 @@
package->manifest-entry
package->development-manifest
packages->manifest
+ build-system->manifest
ca-certificate-bundle
%default-profile-hooks
%manifest-format-version
@@ -462,6 +463,23 @@ argument and returning an alist."
packages)
manifest-entry=?)))
+(define* (build-system->manifest build-system
+ #:optional
+ (system (%current-system))
+ #:key target)
+ "Return a manifest containing the list of packages pulled by BUILD-SYSTEM, a
+variable that defines a build system suitable for the PACKAGE record type."
+ (let ((empty-package (package
+ (name "empty")
+ (version "1")
+ (source #f)
+ (build-system build-system)
+ (home-page #f)
+ (synopsis #f)
+ (description #f)
+ (license #f))))
+ (package->development-manifest empty-package system #:target target)))
+
(define %manifest-format-version
;; The current manifest format version.
4)
tests/profiles.scm
View filediff --git a/tests/profiles.scm b/tests/profiles.scm
index f63c077..55e7146 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013-2023 Ludovic Courtès <[email protected]>
;;; Copyright © 2014 Alex Kost <[email protected]>
+;;; Copyright © 2026 Simon Tournier <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -271,6 +272,18 @@
(manifest-pattern (name name))))
'("gcc" "binutils" "glibc" "coreutils" "grep" "sed"))))
+(test-assert "build-system->manifest"
+ (let* ((package packages:hello)
+ (development-manifest (package->development-manifest package))
+ (build-system-manifest (build-system->manifest (package-build-system
+ package)))
+ (development-entries (manifest-entries development-manifest))
+ (build-system-entries (manifest-entries build-system-manifest)))
+ (and (eqv? (length development-entries)
+ (length build-system-entries))
+ (null? (lset-difference manifest-entry=?
+ development-entries build-system-entries)))))
+
(test-assertm "profile-derivation"
(mlet* %store-monad
((entry -> (package->manifest-entry %bootstrap-guile))