Subject: [bug#45498] [PATCH 02/12] gnu: Add ocaml-sexplib.

From: pukkamustard <[email-masked]>
Date: Mon, 28 Dec 2020 13:47:08 +0100

* gnu/packages/ocaml.scm (ocaml-sexplib0): New variable.
  (ocaml4.07-sexplib0): Inherit from ocaml-sexplib0.
  (janestreet-origin): New variable.
---
 gnu/packages/ocaml.scm | 46 +++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index aa9dfb3dae..917a82c514 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -93,6 +93,14 @@
                  (number->string file-number) "/" name "-" version
                  ".tar.gz"))
 
+(define (janestreet-origin name version hash)
+  (origin (method url-fetch)
+          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/v"
+                              (version-major+minor version) "/files/"
+                              name "-v" (version-major+minor+point version)
+                              ".tar.gz"))
+          (sha256 (base32 hash))))
+
 (define-public ocaml-4.11
   (package
     (name "ocaml")
@@ -4027,33 +4035,35 @@ an arbitrary number of processes.  Cache coherence protocols and mutual
 exclusion algorithms are typical examples of such systems.")
     (license license:asl2.0)))
 
-(define-public ocaml4.07-sexplib0
+(define-public ocaml-sexplib0
   (package
-    (name "ocaml4.07-sexplib0")
-    (version "0.11.0")
+    (name "ocaml-sexplib0")
+    (version "0.14.0")
     (home-page "https://github.com/janestreet/sexplib0")
     (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url (string-append home-page ".git"))
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         "07v3ggyss7xhfv14bjk1n87sr42iqwj4cgjiv2lcdfkqk49i2bmi"))))
+     (janestreet-origin "sexplib0" version
+                        "0adrc0r1vvvr41dcpj8jwkzh1dfgqf0mks9xlnnskqfm3a51iavg"))
     (build-system dune-build-system)
-    (arguments
-     `(#:tests? #f ;no tests
-       #:ocaml ,ocaml-4.07
-       #:findlib ,ocaml4.07-findlib
-       #:dune ,ocaml4.07-dune))
+    (arguments `(#:tests? #f)) ;no tests
     (synopsis "Library containing the definition of S-expressions and some
 base converters")
     (description "Part of Jane Street's Core library The Core suite of
 libraries is an industrial strength alternative to OCaml's standard library
 that was developed by Jane Street, the largest industrial user of OCaml.")
-(license license:expat)))
+    (license license:expat)))
+
+(define-public ocaml4.07-sexplib0
+  (package (inherit ocaml-sexplib0)
+    (name "ocaml4.07-sexplib0")
+    (version "0.11.0")
+    (source
+     (janestreet-origin "sexplib0" version
+                        "1p06p2s7p9xsjn0z9qicniv1ai54d8sj11k8j633di2mm7jzxpin"))
+    (arguments
+     `(#:tests? #f ;no tests
+       #:ocaml ,ocaml-4.07
+       #:findlib ,ocaml4.07-findlib
+       #:dune ,ocaml4.07-dune))))
 
 (define-public ocaml4.07-parsexp
   (package
-- 
2.29.2