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.
This commit is contained in:
Julien Lepiller 2020-01-23 03:24:01 +01:00
parent 0ccd9463ec
commit 1e8da4cdef
No known key found for this signature in database
GPG Key ID: 53D457B2D636EE82
1 changed files with 17 additions and 3 deletions

View File

@ -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))