Subject: [bug#45558] [PATCH] Add js_of_ocaml

From: pukkamustard <[email-masked]>
Date: Mon, 03 May 2021 12:38:13 +0000

Hi divoplade,

divoplade <[email-masked]> writes:

> I finally got js_of_ocaml packaged.

Thank you!

> I'm not sure I did everything correctly (especially indentation

There do seem to be some indentation issues. Have you seen the 
section "Formatting Code" in the Guix manual? There is also a 
little script in the guix repository that will automatically 
indent a package definition.

Also your commit logs don't seem to be exactly in the required 
format. For example: "gnu: add ocaml-ppxlib" should be "gnu: Add 
ocaml-ppxlib.". Check the section "Submitting Patches" in the Guix 
manual and also the commit history for examples.

There are also some things that the linter discovers. For example 
you can omit the ".git" suffix for GitHub sources or that 
pkg-config is not needed in ocaml-graphics. You can run `git lint 
PACKAGE` too see what the linter has to say (and maybe should do 
that for modified package definitions).

> , but also how to make non-4.07 packages

This looks ok.

I submitted a series of patches that does this for many OCaml 
packages including the ones included in your series 
(https://issues.guix.gnu.org/47768). I'm sorry I should have 
included your work in my patch series instead of duplicating.

Maybe a small difference is that the patches in #47769 include a 
more recent version of ocaml-ppxlib (and the required version of 
ocaml-migrate-parsetree).

I have updated your patches for ocaml-graphics and js_of_ocaml so 
that they can be applied on #47769. Some changes in the attached 
patches:

ocaml-graphics:
- Use version 5.1.1 instead of 5.1.0 (5.1.1 was released after you 
  submitted the patches)
- Remove unnecessary inputs
- Change git-reference url to homepage (GitHub without the ".git" 
  suffix)
- Minor changes to description too make linter happy

ocaml-js-of-ocaml:
- Set home-page to https://ocsigen.org/js_of_ocaml/
- Use version 3.9.0 instead of 3.8.0 (again released after you 
  submitted the patches)
- Enable source maps by including ocaml-yojson as input
- Enable tests (this requires ocaml-ppx-expect, 
  ocaml-ppx-variants-conv, ocaml-variantslib and an updated 
  version of ocaml-num)

>From ef943e9e01e979a3de7c84d88d5f8d3d6535da9a Mon Sep 17 00:00:00 2001
From: divoplade <[email-masked]>
Date: Wed, 30 Dec 2020 19:06:57 +0100
Subject: [PATCH 1/6] gnu: Add ocaml-graphics.

* gnu/packages/ocaml.scm (ocaml-graphics): New variable.

Co-Authored-By: pukkamustard <[email-masked]>
---
 gnu/packages/ocaml.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index c390a8bce9..4727b294d9 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -6900,3 +6900,29 @@ Both interfaces give the user total control over the blocking behavior of
 their application, with the unbuffered interface enabling zero-copy IO.
 Parsers are backtracking by default and support unbounded lookahead.")
     (license license:bsd-3)))
+
+(define-public ocaml-graphics
+  (package
+    (name "ocaml-graphics")
+    (version "5.1.1")
+    (home-page "https://github.com/ocaml/graphics")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url home-page)
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "14w07ydji2nbdk366nfp2pzs9484xp9vqv63n345id13v48z8bfi"))))
+    (build-system dune-build-system)
+    (propagated-inputs
+     `(("libx11" ,libx11)))
+    (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.31.1

>From 96f9bb75aa9a401f353619d112e414eab2745db1 Mon Sep 17 00:00:00 2001
From: pukkamustard <[email-masked]>
Date: Mon, 3 May 2021 22:49:23 +0200
Subject: [PATCH 2/6] gnu: Add ocaml-variantslib.

* gnu/packages/ocaml.scm (ocaml-variantslib): New variable.
  (ocaml4.07-variantslib): Inherit from ocaml-variantslib.
---
 gnu/packages/ocaml.scm | 52 ++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 4727b294d9..e40bc78db2 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5137,37 +5137,45 @@ of a record and create new record values.")
               "12948pzxrl360lybm9fzyvplgcl87zjbn4m3sk1aw75zk85p1388"))
      (properties `((upstream-name . "fieldslib"))))))
 
-(define-public ocaml4.07-variantslib
+(define-public ocaml-variantslib
   (package
-    (name "ocaml4.07-variantslib")
-    (version "0.11.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://ocaml.janestreet.com/ocaml-core/v"
-                                  (version-major+minor version)
-                                  "/files/variantslib-v" version ".tar.gz"))
-              (sha256
-               (base32
-                "1hsdwmkslvk4cznqr4lyyiy7vvk5spil226k0z2in26fxq6y0hf3"))))
+    (name "ocaml-variantslib")
+    (version "0.14.0")
+    (source
+     (janestreet-origin "variantslib" version
+              "11zp27gh282dx9ifbhcp6i7fkc97fvk8amaj58mf1g1hwklc0lm3"))
     (build-system dune-build-system)
     (arguments
      ;; No tests
-     `(#:tests? #f
-       #:ocaml ,ocaml-4.07
-       #:findlib ,ocaml4.07-findlib
-       #:dune ,ocaml4.07-dune))
+     `(#:tests? #f))
     (propagated-inputs
-      `(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
-        ("ocaml-migrate-parsetree"
-         ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
-        ("ocaml-ppxlib" ,(package-with-ocaml4.07 ocaml-ppxlib))))
-    (properties `((upstream-name . "variantslib")))
+     `(("ocaml-base" ,ocaml-base)
+       ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+       ("ocaml-ppxlib" ,ocaml-ppxlib)))
+    (properties `((upstream-name . "variantslib")
+                  (ocaml4.07-variant . ,(delay ocaml4.07-variantslib))))
     (home-page "https://github.com/janestreet/variantslib")
     (synopsis "OCaml variants as first class values")
     (description "The Core suite of libraries is an alternative to OCaml's
 standard library.")
     (license license:asl2.0)))
 
+(define-public ocaml4.07-variantslib
+  (package-with-ocaml4.07
+   (package
+     (inherit ocaml-variantslib)
+     (name "ocaml-variantslib")
+     (version "0.11.0")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "https://ocaml.janestreet.com/ocaml-core/v"
+                                   (version-major+minor version)
+                                   "/files/variantslib-v" version ".tar.gz"))
+               (sha256
+                (base32
+                 "1hsdwmkslvk4cznqr4lyyiy7vvk5spil226k0z2in26fxq6y0hf3"))))
+     (properties `((upstream-name . "variantslib"))))))
+
 (define-public ocaml-ppx-fields-conv
   (package
     (name "ocaml-ppx-fields-conv")
@@ -5268,7 +5276,7 @@ definitions.")
     (build-system dune-build-system)
     (propagated-inputs
      `(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
-       ("ocaml-variantslib" ,ocaml4.07-variantslib)
+       ("ocaml-variantslib" ,(package-with-ocaml4.07 ocaml-variantslib))
        ("ocaml-migrate-parsetree"
         ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
        ("ocaml-ppxlib" ,(package-with-ocaml4.07 ocaml-ppxlib))))
@@ -6312,7 +6320,7 @@ standard library that was developed by Jane Street.")
         ("ocaml-splittable-random" ,ocaml4.07-splittable-random)
         ("ocaml-stdio" ,(package-with-ocaml4.07 ocaml-stdio))
         ("ocaml-typerep" ,ocaml4.07-typerep)
-        ("ocaml-variantslib" ,ocaml4.07-variantslib)
+        ("ocaml-variantslib" ,(package-with-ocaml4.07 ocaml-variantslib))
         ("ocaml-migrate-parsetree"
          ,(package-with-ocaml4.07 ocaml-migrate-parsetree))))
     (properties `((upstream-name . "core_kernel")))
-- 
2.31.1

>From 4753a6bf81c13af58a866782c8b63bbf035c9bd3 Mon Sep 17 00:00:00 2001
From: pukkamustard <[email-masked]>
Date: Mon, 3 May 2021 22:42:10 +0200
Subject: [PATCH 3/6] gnu: Add ocaml-ppx-variants-conv.

* gnu/packages/ocaml.scm (ocaml-ppx-variants-conv): New variable.
  (ocaml4.07-ppx-variants-conv): Inherit from ocaml-ppx-variants-conv.
---
 gnu/packages/ocaml.scm | 65 ++++++++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index e40bc78db2..019bfea9f9 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5260,32 +5260,29 @@ definitions.")
                  "0pqwnqy1xp309wvdcaax4lg02yk64lq2w03mbgfvf6ps5ry4gis9"))))
      (properties `((upstream-name . "ppx_sexp_conv"))))))
 
-(define-public ocaml4.07-ppx-variants-conv
+(define-public ocaml-ppx-variants-conv
   (package
-    (name "ocaml4.07-ppx-variants-conv")
-    (version "0.11.1")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/janestreet/ppx_variants_conv")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "1yc0gsds5m2nv39zga8nnrca2n75rkqy5dz4xj1635ybz20hhbjd"))))
+    (name "ocaml-ppx-variants-conv")
+    (version "0.14.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/janestreet/ppx_variants_conv")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0q6a43zrwqzdz7aja0k44a2llyjjj5xzi2kigwhsnww3g0r5ig84"))))
     (build-system dune-build-system)
     (propagated-inputs
-     `(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
-       ("ocaml-variantslib" ,(package-with-ocaml4.07 ocaml-variantslib))
-       ("ocaml-migrate-parsetree"
-        ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
-       ("ocaml-ppxlib" ,(package-with-ocaml4.07 ocaml-ppxlib))))
-    (arguments
-     `(#:ocaml ,ocaml-4.07
-       #:findlib ,ocaml4.07-findlib
-       #:dune ,ocaml4.07-dune))
+     `(("ocaml-base" ,ocaml-base)
+       ("ocaml-variantslib" ,ocaml-variantslib)
+       ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+       ("ocaml-ppxlib" ,ocaml-ppxlib)))
     (properties
-     `((upstream-name . "ppx_variants_conv")))
+     `((upstream-name . "ppx_variants_conv")
+       (ocaml4.07-variant . ,(delay ocaml4.07-ppx-variants-conv))))
     (home-page
      "https://github.com/janestreet/ppx_variants_conv")
     (synopsis "Generation of accessor and iteration functions for OCaml variant types")
@@ -5294,6 +5291,24 @@ definitions.")
 variant types.")
     (license license:asl2.0)))
 
+(define-public ocaml4.07-ppx-variants-conv
+  (package-with-ocaml4.07
+   (package
+     (inherit ocaml-ppx-variants-conv)
+     (name "ocaml-ppx-variants-conv")
+     (version "0.11.1")
+     (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/janestreet/ppx_variants_conv")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "1yc0gsds5m2nv39zga8nnrca2n75rkqy5dz4xj1635ybz20hhbjd"))))
+    (properties `((upstream-name . "ppx_variants_conv"))))))
+
 (define-public ocaml-ppx-custom-printf
   (package
     (name "ocaml-ppx-custom-printf")
@@ -5352,7 +5367,7 @@ string conversion.")
         ("ocaml-ppx-custom-printf" ,(package-with-ocaml4.07 ocaml-ppx-custom-printf))
         ("ocaml-ppx-fields-conv" ,(package-with-ocaml4.07 ocaml-ppx-fields-conv))
         ("ocaml-ppx-sexp-conv" ,(package-with-ocaml4.07 ocaml-ppx-sexp-conv))
-        ("ocaml-ppx-variants-conv" ,ocaml4.07-ppx-variants-conv)
+        ("ocaml-ppx-variants-conv" ,(package-with-ocaml4.07 ocaml-ppx-variants-conv))
         ("ocaml-migrate-parsetree"
          ,(package-with-ocaml4.07 ocaml-migrate-parsetree))))
     (arguments
@@ -5888,7 +5903,7 @@ useful errors on failure.")
         ("ocaml-ppx-here" ,(package-with-ocaml4.07 ocaml-ppx-here))
         ("ocaml-ppx-inline-test" ,(package-with-ocaml4.07 ocaml-ppx-inline-test))
         ("ocaml-ppx-sexp-conv" ,(package-with-ocaml4.07 ocaml-ppx-sexp-conv))
-        ("ocaml-ppx-variants-conv" ,ocaml4.07-ppx-variants-conv)
+        ("ocaml-ppx-variants-conv" ,(package-with-ocaml4.07 ocaml-ppx-variants-conv))
         ("ocaml-stdio" ,(package-with-ocaml4.07 ocaml-stdio))
         ("ocaml-migrate-parsetree"
          ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
@@ -6088,7 +6103,7 @@ functions from type definitions.")
         ("ocaml-ppx-sexp-message" ,ocaml4.07-ppx-sexp-message)
         ("ocaml-ppx-sexp-value" ,ocaml4.07-ppx-sexp-value)
         ("ocaml-ppx-typerep-conv" ,ocaml4.07-ppx-typerep-conv)
-        ("ocaml-ppx-variants-conv" ,ocaml4.07-ppx-variants-conv)
+        ("ocaml-ppx-variants-conv" ,(package-with-ocaml4.07 ocaml-ppx-variants-conv))
         ("ocaml-migrate-parsetree"
          ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
         ("ocaml-ppxlib" ,(package-with-ocaml4.07 ocaml-ppxlib))))
-- 
2.31.1

>From 332c6ce5b26127f2f324a46489e4c01181de2e57 Mon Sep 17 00:00:00 2001
From: pukkamustard <[email-masked]>
Date: Mon, 3 May 2021 22:32:27 +0200
Subject: [PATCH 4/6] gnu: Add ocaml-ppx-expect.

* gnu/packages/ocaml.scm (ocaml-ppx-expect): New variable.
  (ocaml4.07-ppx-expect): Inherit from ocaml-ppx-expect.
---
 gnu/packages/ocaml.scm | 83 +++++++++++++++++++++++++-----------------
 1 file changed, 49 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 019bfea9f9..c4a024c850 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -3791,7 +3791,7 @@ library is currently designed for Unicode Standard 3.2.")
      `(("ocaml-result" ,(package-with-ocaml4.07 ocaml-result))
        ("ocaml-camomile" ,(package-with-ocaml4.07 ocaml-camomile))))
     (native-inputs
-     `(("ocaml-ppx-expect" ,ocaml4.07-ppx-expect)))
+     `(("ocaml-ppx-expect" ,(package-with-ocaml4.07 ocaml-ppx-expect))))
     (properties
      `((upstream-name . "charInfo_width")))
     (home-page "https://bitbucket.org/zandoye/charinfo_width/")
@@ -5876,40 +5876,31 @@ useful errors on failure.")
         ("ocaml-ppxlib" ,ocaml-ppxlib)))
      (properties `((upstream-name . "ppx_assert"))))))
 
-(define-public ocaml4.07-ppx-expect
+(define-public ocaml-ppx-expect
   (package
-    (name "ocaml4.07-ppx-expect")
-    (version "0.12.0")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                     (url "https://github.com/janestreet/ppx_expect")
-                     (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "1wawsbjfkri4sw52n8xqrzihxc3xfpdicv3ahz83a1rsn4lb8j5q"))))
+    (name "ocaml-ppx-expect")
+    (version "0.14.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/janestreet/ppx_expect")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0vbbnjrzpyk5p0js21lafr6fcp2wqka89p1876rdf472cmg0l7fv"))))
     (build-system dune-build-system)
-    (arguments
-     `(#:ocaml ,ocaml-4.07
-       #:findlib ,ocaml4.07-findlib
-       #:dune ,ocaml4.07-dune))
     (propagated-inputs
-      `(("ocaml-base" ,(package-with-ocaml4.07 ocaml-base))
-        ("ocaml-ppx-assert" ,(package-with-ocaml4.07 ocaml4.07-ppx-assert))
-        ("ocaml-ppx-compare" ,(package-with-ocaml4.07 ocaml-ppx-compare))
-        ("ocaml-ppx-custom-printf" ,(package-with-ocaml4.07 ocaml-ppx-custom-printf))
-        ("ocaml-ppx-fields-conv" ,(package-with-ocaml4.07 ocaml-ppx-fields-conv))
-        ("ocaml-ppx-here" ,(package-with-ocaml4.07 ocaml-ppx-here))
-        ("ocaml-ppx-inline-test" ,(package-with-ocaml4.07 ocaml-ppx-inline-test))
-        ("ocaml-ppx-sexp-conv" ,(package-with-ocaml4.07 ocaml-ppx-sexp-conv))
-        ("ocaml-ppx-variants-conv" ,(package-with-ocaml4.07 ocaml-ppx-variants-conv))
-        ("ocaml-stdio" ,(package-with-ocaml4.07 ocaml-stdio))
-        ("ocaml-migrate-parsetree"
-         ,(package-with-ocaml4.07 ocaml-migrate-parsetree))
-        ("ocaml-ppxlib" ,(package-with-ocaml4.07 ocaml-ppxlib))
-        ("ocaml-re" ,(package-with-ocaml4.07 ocaml-re))))
-    (properties `((upstream-name . "ppx_expect")))
+     `(("ocaml-base" ,ocaml-base)
+       ("ocaml-ppx-here" ,ocaml-ppx-here)
+       ("ocaml-ppx-inline-test" ,ocaml-ppx-inline-test)
+       ("ocaml-stdio" ,ocaml-stdio)
+       ("ocaml-ppxlib" ,ocaml-ppxlib)
+       ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+       ("ocaml-re" ,ocaml-re)))
+    (properties `((upstream-name . "ppx_expect")
+                  (ocaml4.07-variant . ,(delay ocaml4.07-ppx-expect))))
     (home-page "https://github.com/janestreet/ppx_expect")
     (synopsis "Cram like framework for OCaml")
     (description "Expect-test is a framework for writing tests in OCaml, similar
@@ -5919,6 +5910,30 @@ output-generating code, interleaved with @code{%expect} extension expressions
 to denote the expected output.")
     (license license:asl2.0)))
 
+(define-public ocaml4.07-ppx-expect
+  (package-with-ocaml4.07
+   (package
+     (inherit ocaml-ppx-expect)
+     (version "0.12.0")
+     (source
+      (janestreet-origin "ppx_expect" version
+                         "1zpci8c49yn2ixchmwjx1kf9pwybv3dnn4l2dgnd6m36qnkralfk"))
+     (propagated-inputs
+      `(("ocaml-base" ,ocaml-base)
+        ("ocaml-ppx-assert" ,ocaml-ppx-assert)
+        ("ocaml-ppx-compare" ,ocaml-ppx-compare)
+        ("ocaml-ppx-custom-printf" ,ocaml-ppx-custom-printf)
+        ("ocaml-ppx-fields-conv" ,ocaml-ppx-fields-conv)
+        ("ocaml-ppx-here" ,ocaml-ppx-here)
+        ("ocaml-ppx-inline-test" ,ocaml-ppx-inline-test)
+        ("ocaml-ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
+        ("ocaml-ppx-variants-conv" ,ocaml-ppx-variants-conv)
+        ("ocaml-stdio" ,ocaml-stdio)
+        ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+        ("ocaml-ppxlib" ,ocaml-ppxlib)
+        ("ocaml-re" ,ocaml-re)))
+     (properties `((upstream-name . "ppx_expect"))))))
+
 (define-public ocaml-ppx-js-style
   (package
     (name "ocaml-ppx-js-style")
@@ -6091,7 +6106,7 @@ functions from type definitions.")
         ("ocaml-ppx-bench" ,ocaml4.07-ppx-bench)
         ("ocaml-ppx-bin-prot" ,ocaml4.07-ppx-bin-prot)
         ("ocaml-ppx-custom-printf" ,(package-with-ocaml4.07 ocaml-ppx-custom-printf))
-        ("ocaml-ppx-expect" ,ocaml4.07-ppx-expect)
+        ("ocaml-ppx-expect" ,(package-with-ocaml4.07 ocaml-ppx-expect))
         ("ocaml-ppx-fail" ,ocaml4.07-ppx-fail)
         ("ocaml-ppx-fields-conv" ,(package-with-ocaml4.07 ocaml-ppx-fields-conv))
         ("ocaml-ppx-here" ,(package-with-ocaml4.07 ocaml-ppx-here))
@@ -6236,7 +6251,7 @@ Configurator allows one to:
        #:findlib ,ocaml4.07-findlib
        #:dune ,ocaml4.07-dune))
     (native-inputs
-     `(("ocaml-ppx-expect" ,ocaml4.07-ppx-expect)))
+     `(("ocaml-ppx-expect" ,(package-with-ocaml4.07 ocaml-ppx-expect))))
     (home-page "https://github.com/janestreet/spawn")
     (synopsis "Spawning sub-processes")
     (description
-- 
2.31.1

>From ac57c989bb2dab51e45561c3faeed8ef5a52cb3a Mon Sep 17 00:00:00 2001
From: pukkamustard <[email-masked]>
Date: Tue, 4 May 2021 07:58:43 +0200
Subject: [PATCH 5/6] gnu: ocaml-num: Update to 1.4.

* gnu/packages/ocaml.scm (ocaml-num): Update to 1.4.
---
 gnu/packages/ocaml.scm | 31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index c4a024c850..349124c99e 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -958,7 +958,7 @@ written in Objective Caml.")
 (define-public ocaml-num
   (package
     (name "ocaml-num")
-    (version "1.1")
+    (version "1.4")
     (source
      (origin
        (method git-fetch)
@@ -967,33 +967,8 @@ written in Objective Caml.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0a4mhxgs5hi81d227aygjx35696314swas0vzy3ig809jb7zq4h0"))))
-    (build-system ocaml-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (add-before 'build 'fix-makefile
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; This package supposes we install to the same directory as
-             ;; the ocaml package.
-             (substitute* "src/META"
-               (("\"\\^\"") (string-append "\"" (assoc-ref outputs "out")
-                                           "/lib/ocaml/site-lib\"")))
-             (substitute* "src/Makefile"
-               (("\\) \\$\\(STDLIBDIR\\)")
-                (string-append ") " (assoc-ref outputs "out")
-                               "/lib/ocaml/site-lib")))
-             #t))
-         (add-after 'install 'fix-stubslib
-           (lambda* (#:key outputs #:allow-other-keys)
-             (format #t "~a~%" (find-files "." ".*.so"))
-             (let ((stubdir (string-append (assoc-ref outputs "out")
-                                           "/lib/ocaml/site-lib/stublibs")))
-               (delete-file stubdir)
-               (mkdir-p stubdir)
-               (install-file "src/dllnums.so" stubdir))
-             #t)))))
+        (base32 "1vzdnvpj5dbj3ifx03v25pj2jj1ccav072v4d29pk1czdba2lzfc"))))
+    (build-system dune-build-system)
     (home-page "https://github.com/ocaml/num")
     (synopsis "Arbitrary-precision integer and rational arithmetic")
     (description "OCaml-Num contains the legacy Num library for
-- 
2.31.1

>From 7a19c648423b31d2322a86dc762dd01e39c417c0 Mon Sep 17 00:00:00 2001
From: divoplade <[email-masked]>
Date: Wed, 30 Dec 2020 19:08:57 +0100
Subject: [PATCH 6/6] gnu: Add ocaml-js-of-ocaml.

* gnu/packages/ocaml.scm (ocaml-js-of-ocaml): New variable.

Co-Authored-By: pukkamustard <[email-masked]>
---
 gnu/packages/ocaml.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 349124c99e..24d9e814fa 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages node)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -6939,3 +6940,43 @@ 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+)))
+
+(define-public ocaml-js-of-ocaml
+  (package
+    (name "ocaml-js-of-ocaml")
+    (version "3.9.1")
+    (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 "00hdjaj94j3nc6f6wbbpx59h4yc79siphs34i1hry11r56paaqyk"))))
+    (build-system dune-build-system)
+    (arguments `(#:test-target "."))
+    (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)
+       ("ocaml-yojson" ,ocaml-yojson)))
+    (native-inputs
+     ;; for tests
+     `(("node" ,node)
+       ("ocaml-ppx-expect" ,ocaml-ppx-expect)
+       ("ocaml-num" ,ocaml-num)))
+    (properties `((upstream-name . "js_of_ocaml")))
+    (home-page "https://ocsigen.org/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.31.1

Best regards,
pukkamustard