(address . guix-patches@gnu.org)
Dear guix,
I finally got js_of_ocaml packaged. I'm not sure I did everything
correctly (especially indentation, but also how to make non-4.07
packages, and whether the package should have multiple outputs
corresponding to the opam packages), so do not hesitate to sendfeedback.
Best regards,
divoplade
From 0a753eb2d96b2deb7059bce0be6846f6623a85e4 Mon Sep 17 00:00:00 2001
From: divoplade <d@divoplade.fr>
Date: Wed, 30 Dec 2020 18:45:28 +0100
Subject: [PATCH 1/5] gnu: Add ocaml-compiler-libs
* gnu/packages/ocaml.scm (ocaml-compiler-libs): New variable.
(ocaml4.07-compiler-libs): Inherit from ocaml-compiler-libs.
---
gnu/packages/ocaml.scm | 45 +++++++++++++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 12 deletions(-)
Toggle diff (87 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 2df16e7cd2..4b1ed09a79 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -3683,7 +3683,7 @@ syntax checking on dedukti files.")
`(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
("ocaml-migrate-parsetree"
,(package-with-ocaml4.07 ocaml-migrate-parsetree))
- ("ocaml-compiler-libs" ,ocaml4.07-compiler-libs)
+ ("ocaml-compiler-libs" ,(package-with-ocaml4.07 ocaml-compiler-libs))
("ocaml-sexplib0" ,(package-with-ocaml4.07 ocaml-sexplib0))
("ocaml-stdio" ,ocaml4.07-stdio)
("ocaml-ppxlib" ,ocaml4.07-ppxlib)))
@@ -4285,10 +4285,10 @@ provided by companion libraries such as
#:dune ,ocaml4.07-dune))
(properties '()))))
-(define-public ocaml4.07-compiler-libs
+(define-public ocaml-compiler-libs
(package
- (name "ocaml4.07-compiler-libs")
- (version "0.11.0")
+ (name "ocaml-compiler-libs")
+ (version "0.12.3")
(home-page "https://github.com/janestreet/ocaml-compiler-libs")
(source
(origin
@@ -4299,20 +4299,41 @@ provided by companion libraries such as
(file-name (git-file-name name version))
(sha256
(base32
- "03jds7bszh8wwpfwxb3dg0gyr1j1872wxwx1xqhry5ir0i84bg0s"))))
+ "00nrar7h2pyflbdiq6wwwrb4k5jh9iff0jllihzm6ms8d5pspsg5"))))
(build-system dune-build-system)
- (arguments
- `(#:tests? #f ;no tests
- #:ocaml ,ocaml-4.07
- #:findlib ,ocaml4.07-findlib
- #:dune ,ocaml4.07-dune))
- (properties `((upstream-name . "ocaml-compiler-libs")))
+ (arguments `(#:tests? #f))
+ (properties `((upstream-name . "ocaml-compiler-libs")
+ (ocaml4.07-variant . ,(delay ocaml4.07-compiler-libs))))
(synopsis "Compiler libraries repackaged")
(description "This package simply repackages the OCaml compiler libraries
so they don't expose everything at toplevel. For instance, @code{Ast_helper}
is now @code{Ocaml_common.Ast_helper}.")
(license license:expat)))
+(define-public ocaml4.07-compiler-libs
+ (package-with-ocaml4.07
+ (package
+ (inherit ocaml-compiler-libs)
+ (name "ocaml4.07-compiler-libs")
+ (version "0.11.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url (string-append (package-home-page ocaml-compiler-libs)
+ ".git"))
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "03jds7bszh8wwpfwxb3dg0gyr1j1872wxwx1xqhry5ir0i84bg0s"))))
+ (arguments
+ `(#:tests? #f ;no tests
+ #:ocaml ,ocaml-4.07
+ #:findlib ,ocaml4.07-findlib
+ #:dune ,ocaml4.07-dune))
+ (properties '()))))
+
(define-public ocaml4.07-stdio
(package
(name "ocaml4.07-stdio")
@@ -4389,7 +4410,7 @@ as part of the same ocaml-migrate-parsetree driver.")
(build-system dune-build-system)
(propagated-inputs
`(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
- ("ocaml-compiler-libs" ,ocaml4.07-compiler-libs)
+ ("ocaml-compiler-libs" ,(package-with-ocaml4.07 ocaml-compiler-libs))
("ocaml-migrate-parsetree"
,(package-with-ocaml4.07 ocaml-migrate-parsetree))
("ocaml-ppx-derivers" ,(package-with-ocaml4.07 ocaml-ppx-derivers))
--
2.29.2
From c53824f13472d91cd7087e965976876725164e66 Mon Sep 17 00:00:00 2001
From: divoplade <d@divoplade.fr>
Date: Wed, 30 Dec 2020 19:06:57 +0100
Subject: [PATCH 4/5] gnu: Add ocaml-graphics
---
gnu/packages/ocaml.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
Toggle diff (39 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 828dd6ff73..353394e4d4 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -6148,3 +6148,32 @@ provides support to program with time varying values: declarative events and
signals. React doesn't define any primitive event or signal, it lets the
client chooses the concrete timeline.")
(license license:lgpl2.1+)))
+
+(define-public ocaml-graphics
+ (package
+ (name "ocaml-graphics")
+ (version "5.1.0")
+ (home-page "https://github.com/ocaml/graphics")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url (string-append home-page ".git"))
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1ilw5r1lpy88fpfcpifxxbdg74f468jb5xhimw92iwmr410gnqp2"))))
+ (build-system dune-build-system)
+ (propagated-inputs
+ `(("dune-configurator" ,dune-configurator)
+ ("libx11" ,libx11)
+ ("pkg-config" ,pkg-config)))
+ (synopsis "The OCaml graphics library")
+ (description
+ "The graphics library provides a set of portable drawing
+primitives. Drawing takes place in a separate window that is created
+when Graphics.open_graph is called.
+
+This library used to be distributed with OCaml up to OCaml 4.08.")
+ (license license:lgpl2.1+)))
--
2.29.2
From 151ffb96657268adf40103d8c4aac04f4d3a61fb Mon Sep 17 00:00:00 2001
From: divoplade <d@divoplade.fr>
Date: Wed, 30 Dec 2020 19:08:57 +0100
Subject: [PATCH 5/5] gnu: Add ocaml-js-of-ocaml
---
gnu/packages/ocaml.scm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
Toggle diff (48 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 353394e4d4..ce1d09f936 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -6177,3 +6177,41 @@ when Graphics.open_graph is called.
This library used to be distributed with OCaml up to OCaml 4.08.")
(license license:lgpl2.1+)))
+
+(define-public ocaml-js-of-ocaml
+ (package
+ (name "ocaml-js-of-ocaml")
+ (version "3.8.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ocsigen/js_of_ocaml")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1ls3nhavhifsfwwz45k4xw91ml9zi6rnkfp3175b2havbavbzral"))))
+ (build-system dune-build-system)
+ (arguments `(#:tests? #f))
+ (propagated-inputs
+ `(("ocaml-ppxlib" ,ocaml-ppxlib)
+ ("ocaml-uchar" ,ocaml-uchar)
+ ("ocaml-menhir" ,ocaml-menhir)
+ ("ocaml-reactivedata" ,ocaml-reactivedata)
+ ("ocaml-cmdliner" ,ocaml-cmdliner)
+ ("ocaml-lwt" ,ocaml-lwt)
+ ("ocaml-tyxml" ,ocaml-tyxml)
+ ("ocaml-re" ,ocaml-re)
+ ("ocaml-uutf" ,ocaml-uutf)
+ ("ocaml-graphics" ,ocaml-graphics)))
+ (properties `((upstream-name . "js_of_ocaml")))
+ (home-page
+ "http://ocsigen.github.io/js_of_ocaml")
+ (synopsis
+ "Compiler from OCaml bytecode to Javascript")
+ (description
+ "Js_of_ocaml is a compiler from OCaml bytecode to JavaScript.
+It makes it possible to run pure OCaml programs in JavaScript
+environment like browsers and Node.js
+")
+ (license license:lgpl2.1+)))
--
2.29.2