summaryrefslogtreecommitdiff
path: root/guix/build-system/ocaml.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build-system/ocaml.scm')
-rw-r--r--guix/build-system/ocaml.scm20
1 files changed, 17 insertions, 3 deletions
diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
index de3e71a5aa..c5996bf0cf 100644
--- a/guix/build-system/ocaml.scm
+++ b/guix/build-system/ocaml.scm
@@ -92,7 +92,11 @@
(let ((module (resolve-interface '(gnu packages ocaml))))
(module-ref module 'ocaml4.07-findlib)))
-(define* (package-with-explicit-ocaml ocaml findlib old-prefix new-prefix
+(define (default-ocaml4.07-dune)
+ (let ((module (resolve-interface '(gnu packages ocaml))))
+ (module-ref module 'ocaml4.07-dune)))
+
+(define* (package-with-explicit-ocaml ocaml findlib dune old-prefix new-prefix
#:key variant-property)
"Return a procedure of one argument, P. The procedure creates a package
with the same fields as P, which is assumed to use OCAML-BUILD-SYSTEM, such
@@ -100,6 +104,10 @@ that it is compiled with OCAML and FINDLIB instead. The inputs are changed
recursively accordingly. If the name of P starts with OLD-PREFIX, this is
replaced by NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name.
+When the package uses the DUNE-BUILD-SYSTEM, the procedure creates a package
+with the same fields as P, such that it is compiled with OCAML, FINDLIB and DUNE
+instead.
+
When VARIANT-PROPERTY is present, it is used as a key to search for
pre-defined variants of this transformation recorded in the 'properties' field
of packages. The property value must be the promise of a package. This is a
@@ -132,10 +140,15 @@ pre-defined variants."
name))))
(arguments
(let ((ocaml (if (promise? ocaml) (force ocaml) ocaml))
- (findlib (if (promise? findlib) (force findlib) findlib)))
+ (findlib (if (promise? findlib) (force findlib) findlib))
+ (dune (if (promise? dune) (force dune) dune)))
(ensure-keyword-arguments (package-arguments p)
`(#:ocaml ,ocaml
- #:findlib ,findlib))))))
+ #:findlib ,findlib
+ ,@(if (eq? (package-build-system p)
+ (default-dune-build-system))
+ `(#:dune ,dune)
+ '())))))))
(else p)))
(define (cut? p)
@@ -148,6 +161,7 @@ pre-defined variants."
(define package-with-ocaml4.07
(package-with-explicit-ocaml (delay (default-ocaml4.07))
(delay (default-ocaml4.07-findlib))
+ (delay (default-ocaml4.07-dune))
"ocaml-" "ocaml4.07-"
#:variant-property 'ocaml4.07-variant))