From a810e6647ba30aba02b58840101ee66b7fbcd792 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 15 Oct 2020 22:34:38 +0200 Subject: [PATCH 3/7] guix: ocaml: Add package-with-ocaml4.09. * guix/build-system/ocaml.scm (package-with-ocaml4.09) (strip-ocaml4.09-variant): New variables. * gnu/packages/ocaml.scm (ocaml4.09-result, ocaml4.09-csexp) (ocaml4.09-dune-configurator, ocaml4.09-dune): New variables. --- gnu/packages/ocaml.scm | 46 ++++++++++++++++++++++++++++++++++++- guix/build-system/ocaml.scm | 27 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 84daa8afca..e3ddb36a4e 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -1321,15 +1321,36 @@ following a very simple s-expression syntax.") #:tests? #f)) (propagated-inputs `(("ocaml-csexp" ,ocaml-csexp))) + (properties `((ocaml4.09-variant . ,(delay ocaml4.09-dune-configurator)))) (synopsis "") (description ""))) +(define-public ocaml4.09-dune-configurator + (package + (inherit dune-configurator) + (name "ocaml4.09-dune-configurator") + (arguments + `(#:package "dune-configurator" + #:tests? #f + #:dune ,(package-with-ocaml4.09 dune-bootstrap) + #:ocaml ,ocaml-4.09 + #:findlib ,ocaml4.09-findlib)) + (propagated-inputs + `(("ocaml-csexp" ,(package-with-ocaml4.09 ocaml-csexp)))))) + (define-public dune (package (inherit dune-bootstrap) (propagated-inputs `(("dune-configurator" ,dune-configurator))) - (properties `((ocaml4.07-variant . ,(delay ocaml4.07-dune)))))) + (properties `((ocaml4.07-variant . ,(delay ocaml4.07-dune)) + (ocaml4.09-variant . ,(delay ocaml4.09-dune)))))) + +(define-public ocaml4.09-dune + (package + (inherit (package-with-ocaml4.09 dune-bootstrap)) + (propagated-inputs + `(("dune-configurator" ,dune-configurator))))) (define-public ocaml4.07-dune (package @@ -1370,6 +1391,7 @@ following a very simple s-expression syntax.") #t))))) (propagated-inputs `(("ocaml-result" ,ocaml-result))) + (properties `((ocaml4.09-variant . ,(delay ocaml4.09-csexp)))) (home-page "https://github.com/ocaml-dune/csexp") (synopsis "Parsing and printing of S-expressions in Canonical form") (description "This library provides minimal support for Canonical @@ -1386,6 +1408,18 @@ To avoid a dependency on a particular S-expression library, the only module of this library is parameterised by the type of S-expressions.") (license license:expat))) +(define-public ocaml4.09-csexp + (package + (inherit ocaml-csexp) + (name "ocaml4.09-csexp") + (arguments + `(#:ocaml ,ocaml-4.09 + #:findlib ,ocaml4.09-findlib + ,@(substitute-keyword-arguments (package-arguments ocaml-csexp) + ((#:dune _) (package-with-ocaml4.09 dune-bootstrap))))) + (propagated-inputs + `(("ocaml-result" ,(package-with-ocaml4.09 ocaml-result)))))) + (define-public ocaml-migrate-parsetree (package (name "ocaml-migrate-parsetree") @@ -1494,12 +1528,22 @@ powerful.") (arguments `(#:test-target "." #:dune ,dune-bootstrap)) + (properties `((ocaml4.09-variant . ,(delay ocaml4.09-result)))) (home-page "https://github.com/janestreet/result") (synopsis "Compatibility Result module") (description "Uses the new result type defined in OCaml >= 4.03 while staying compatible with older version of OCaml should use the Result module defined in this library.") (license license:bsd-3))) + +(define-public ocaml4.09-result + (package + (inherit ocaml-result) + (arguments + `(#:test-target "." + #:dune ,(package-with-ocaml4.09 dune-bootstrap) + #:ocaml ,ocaml-4.09 + #:findlib ,ocaml4.09-findlib)))) (define-public ocaml-topkg (package diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm index c5996bf0cf..5513216c25 100644 --- a/guix/build-system/ocaml.scm +++ b/guix/build-system/ocaml.scm @@ -29,6 +29,8 @@ #:export (%ocaml-build-system-modules package-with-ocaml4.07 strip-ocaml4.07-variant + package-with-ocaml4.09 + strip-ocaml4.09-variant default-findlib default-ocaml lower @@ -96,6 +98,18 @@ (let ((module (resolve-interface '(gnu packages ocaml)))) (module-ref module 'ocaml4.07-dune))) +(define (default-ocaml4.09) + (let ((ocaml (resolve-interface '(gnu packages ocaml)))) + (module-ref ocaml 'ocaml-4.09))) + +(define (default-ocaml4.09-findlib) + (let ((module (resolve-interface '(gnu packages ocaml)))) + (module-ref module 'ocaml4.09-findlib))) + +(define (default-ocaml4.09-dune) + (let ((module (resolve-interface '(gnu packages ocaml)))) + (module-ref module 'ocaml4.09-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 @@ -171,6 +185,19 @@ pre-defined variants." (inherit p) (properties (alist-delete 'ocaml4.07-variant (package-properties p))))) +(define package-with-ocaml4.09 + (package-with-explicit-ocaml (delay (default-ocaml4.09)) + (delay (default-ocaml4.09-findlib)) + (delay (default-ocaml4.09-dune)) + "ocaml-" "ocaml4.09-" + #:variant-property 'ocaml4.09-variant)) + +(define (strip-ocaml4.09-variant p) + "Remove the 'ocaml4.09-variant' property from P." + (package + (inherit p) + (properties (alist-delete 'ocaml4.09-variant (package-properties p))))) + (define* (lower name #:key source inputs native-inputs outputs system target (ocaml (default-ocaml)) -- 2.28.0