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

commit a97957e8b4afd730c63504ee34acb43f5c0105a4
Author: Jason Conroy <[email protected]>
AuthorDate: Sun Nov 30 09:54:47 2025 -0500

    guix: dune-build-system: Provide separate build system instances for OCaml 
4.x and 5.x dev stacks.
    
    * guix/build-system/dune.scm:
    Update header docs.
    (make-dune-build-system): New variable.
    (dune-build-system): Define in terms of `make-dune-build-system`.
    (ocaml5-dune-build-system): New variable.
    (lower): Remove variable.
    
    Change-Id: I2f72d93945f285436878e13b5212c90b7c2cf85f
    Signed-off-by: Julien Lepiller <[email protected]>
---
 guix/build-system/dune.scm | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 8bd72c242c..a961c55551 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017 Ben Woodcroft <[email protected]>
 ;;; Copyright © 2021, 2022 Ludovic Courtès <[email protected]>
 ;;; Copyright © 2021 pukkamustard <[email protected]>
+;;; Copyright © 2025 Jason Conroy <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,12 +32,22 @@
   #:use-module (srfi srfi-1)
   #:export (%dune-build-system-modules
             dune-build
-            dune-build-system))
+            dune-build-system
+            ocaml5-dune-build-system))
 
 ;; Commentary:
 ;;
-;; Standard build procedure for packages using dune. This is implemented as an
-;; extension of `ocaml-build-system'.
+;; Standard build procedures for packages using dune. These are implemented as
+;; extensions of `ocaml-build-system'.
+;;
+;; Multiple instances of the build system exist to support different versions
+;; of the OCaml compiler and its associated tools. Choose `dune-build-system`
+;; for a build system that works with Guix's default version of the compiler,
+;; or choose `ocamlX-dune-build-system` for some other compiler version X.
+;;
+;; Adaptor functions of the form `package-with-ocamlX.Y` defined in the OCaml
+;; build system will also work on packages with the Dune build system, subject
+;; to the same caveats.
 ;;
 ;; Code:
 
@@ -69,7 +80,7 @@
       '(#:target #:dune #:findlib #:ocaml #:inputs #:native-inputs))
 
     (and (not target)                   ;XXX: no cross-compilation
-         (let ((base (ocaml:lower
+         (let ((base ((ocaml:make-lower default-ocaml default-findlib)
                       name
                       #:source source
                       #:inputs inputs
@@ -153,14 +164,26 @@ provides a 'setup.ml' file as its build system."
                     #:graft? #f
                     #:guile-for-build guile))
 
-(define lower (make-lower ocaml:default-ocaml
-                          ocaml:default-findlib
-                          ocaml:default-dune))
-
-(define dune-build-system
+(define (make-dune-build-system default-ocaml
+                                default-findlib
+                                default-dune)
   (build-system
     (name 'dune)
     (description "The standard Dune build system")
-    (lower lower)))
+    (lower (make-lower default-ocaml
+                       default-findlib
+                       default-dune))))
+
+(define dune-build-system
+  ;; The default instance of the build system, using Guix's default OCaml
+  ;; compiler version.
+  (make-dune-build-system ocaml:default-ocaml
+                          ocaml:default-findlib
+                          ocaml:default-dune))
+
+(define ocaml5-dune-build-system
+  (make-dune-build-system ocaml:default-ocaml5
+                          ocaml:default-ocaml5-findlib
+                          ocaml:default-ocaml5-dune))
 
 ;;; dune.scm ends here

Reply via email to