[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: guix: ocaml: Also replace dune when relevant in package-with-expl
From: |
guix-commits |
Subject: |
04/05: guix: ocaml: Also replace dune when relevant in package-with-explicit-ocaml. |
Date: |
Sun, 26 Jan 2020 21:56:33 -0500 (EST) |
roptat pushed a commit to branch master
in repository guix.
commit 1e8da4cdefb089ac7d2453d71f72924540238d87
Author: Julien Lepiller <address@hidden>
AuthorDate: Thu Jan 23 03:24:01 2020 +0100
guix: ocaml: Also replace dune when relevant in package-with-explicit-ocaml.
* guix/build-system/ocaml.scm (package-with-explicit-ocaml): Take a dune
argument and add it to transformed packages when relevant.
---
guix/build-system/ocaml.scm | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
index de3e71a..c5996bf 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))