unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 00/10] ocaml patches
@ 2017-01-18 20:27 Julien Lepiller
  2017-01-18 20:27 ` [PATCH 01/10] gnu: Add ocaml-base64 Julien Lepiller
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

Here are the next 10 ocaml-related patches I would like to push. What do you
think?

I'm pretty sure number 9 and 10 can be improved, any idea?

Julien Lepiller (10):
  gnu: Add ocaml-base64.
  gnu: Add ocamlify.
  gnu: Add omake.
  gnu: Add ocaml-batteries.
  gnu: Add ocaml-pcre.
  gnu: Add ocaml-expect.
  gnu: Add ocaml-fileutils.
  gnu: Add ocaml-oasis.
  gnu: Add ocaml-js-build-tools.
  gnu: Add ocaml-bin-prot.

 gnu/local.mk                                       |   2 +
 gnu/packages/ocaml.scm                             | 301 +++++++++++++++++++++
 .../patches/ocaml-janestreet-fix-libdir.patch      |  36 +++
 .../patches/ocaml-omake-fix-non-determinism.patch  |  41 +++
 4 files changed, 380 insertions(+)
 create mode 100644 gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
 create mode 100644 gnu/packages/patches/ocaml-omake-fix-non-determinism.patch

-- 
2.11.0

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/10] gnu: Add ocaml-base64.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:27 ` [PATCH 02/10] gnu: Add ocamlify Julien Lepiller
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-base64): New variable.
---
 gnu/packages/ocaml.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 28c6ab34f..012833766 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1696,3 +1696,35 @@ without a complete in-memory representation of the data.")
     (description "Client-side URL transfer library, supporting HTTP and a
 multitude of other network protocols (FTP/SMTP/RTSP/etc).")
     (license license:isc)))
+
+(define-public ocaml-base64
+  (package
+    (name "ocaml-base64")
+    (version "2.1.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/mirage/ocaml-base64/"
+                                  "releases/download/v" version "/base64-"
+                                   version ".tbz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                 "1p45sawchmrkr22gkmydjc4ary23pisp58zsnb7iq7d82nxs1lfq"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:build-flags (list "build" "--tests" "true")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("topkg" ,ocaml-topkg)
+       ("opam" ,opam)
+       ("rresult" ,ocaml-rresult)
+       ("bos" ,ocaml-bos)
+       ("alcotest" ,ocaml-alcotest)))
+    (home-page "https://github.com/mirage/ocaml-base64")
+    (synopsis "Base64 encoding for OCaml")
+    (description "Base64 is a group of similar binary-to-text encoding schemes
+that represent binary data in an ASCII string format by translating it into a
+radix-64 representation.  It is specified in RFC 4648.")
+    (license license:isc)))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/10] gnu: Add ocamlify.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
  2017-01-18 20:27 ` [PATCH 01/10] gnu: Add ocaml-base64 Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:27 ` [PATCH 03/10] gnu: Add omake Julien Lepiller
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocamlify): New variable.
---
 gnu/packages/ocaml.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 012833766..a2297d1ab 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1728,3 +1728,27 @@ multitude of other network protocols (FTP/SMTP/RTSP/etc).")
 that represent binary data in an ASCII string format by translating it into a
 radix-64 representation.  It is specified in RFC 4648.")
     (license license:isc)))
+
+(define-public ocamlify
+  (package
+    (name "ocamlify")
+    (version "0.0.2")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri name version 1209))
+              (sha256
+               (base32
+                "1f0fghvlbfryf5h3j4as7vcqrgfjb4c8abl5y0y5h069vs4kp5ii"))))
+    (build-system ocaml-build-system)
+    ; tests are done during build
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'check))))
+    (home-page "https://forge.ocamlcore.org/projects/ocamlify")
+    (synopsis "Include files in OCaml code")
+    (description "OCamlify allows to create OCaml source code by including
+whole files into OCaml string or string list.  The code generated can be
+compiled as a standard OCaml file.  It allows embedding external resources as
+OCaml code.")
+    (license license:lgpl2.1))); with an exception
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/10] gnu: Add omake.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
  2017-01-18 20:27 ` [PATCH 01/10] gnu: Add ocaml-base64 Julien Lepiller
  2017-01-18 20:27 ` [PATCH 02/10] gnu: Add ocamlify Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 22:00   ` Marius Bakke
  2017-01-18 20:27 ` [PATCH 04/10] gnu: Add ocaml-batteries Julien Lepiller
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (omake): New variable.
* gnu/packages/patches/ocaml-omake-fix-non-determinism.patch: New file.
* gnu/local.mk (dist_patch_DATA): New patch.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/ocaml.scm                             | 41 ++++++++++++++++++++++
 .../patches/ocaml-omake-fix-non-determinism.patch  | 41 ++++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 gnu/packages/patches/ocaml-omake-fix-non-determinism.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 24dcd03fd..5b919dd86 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -778,6 +778,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
   %D%/packages/patches/ocaml-Add-a-.file-directive.patch	\
   %D%/packages/patches/ocaml-findlib-make-install.patch	\
+  %D%/packages/patches/ocaml-omake-fix-non-determinism.patch	\
   %D%/packages/patches/ola-readdir-r.patch			\
   %D%/packages/patches/openexr-missing-samples.patch		\
   %D%/packages/patches/openjpeg-CVE-2016-5157.patch		\
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index a2297d1ab..f69f77a7b 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1752,3 +1752,44 @@ whole files into OCaml string or string list.  The code generated can be
 compiled as a standard OCaml file.  It allows embedding external resources as
 OCaml code.")
     (license license:lgpl2.1))); with an exception
+
+(define-public omake
+  (package
+    (name "omake")
+    (version "0.10.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.camlcity.org/download/"
+                                  "omake-" version ".tar.gz"))
+              (sha256
+               (base32
+                "093ansbppms90hiqvzar2a46fj8gm9iwnf8gn38s6piyp70lrbsj"))
+              (patches (search-patches "ocaml-omake-fix-non-determinism.patch"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       #:tests? #f; no test target
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-makefile
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "mk/osconfig_unix.mk"
+                (("CC = cc") "CC = gcc")))))))
+    (native-inputs `(("hevea" ,hevea)))
+    (home-page "http://projects.camlcity.org/projects/omake.html")
+    (synopsis "Build system designed for scalability and portability")
+    (description "Similar to make utilities you may have used, but it features
+many additional enhancements, including:
+
+- Support for projects spanning several directories or directory hierarchies.
+- Fast, reliable, automated, scriptable dependency analysis using MD5 digests,
+with full support for incremental builds.
+- Dependency analysis takes the command lines into account — whenever the
+command line used to build a target changes, the target is considered
+out-of-date.
+-  Fully scriptable, includes a library that providing support for standard
+tasks in C, C++, OCaml, and LaTeX projects, or a mixture thereof.")
+    (license (list license:lgpl2.1; libmojave
+                   license:expat; OMake scripts
+                   license:gpl2)))); OMake itself, with an exception
diff --git a/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch b/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch
new file mode 100644
index 000000000..813ce3cd7
--- /dev/null
+++ b/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch
@@ -0,0 +1,41 @@
+From 2e7e254160506dc00f1beabf170512a8e932934b Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sat, 31 Dec 2016 15:43:38 +0100
+Subject: [PATCH] fix build date in binary
+
+---
+ src/magic/omake_gen_magic.ml | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/magic/omake_gen_magic.ml b/src/magic/omake_gen_magic.ml
+index b2419ba..fad52f5 100644
+--- a/src/magic/omake_gen_magic.ml
++++ b/src/magic/omake_gen_magic.ml
+@@ -150,7 +150,7 @@ let ir_magic = "%s"
+ let obj_magic = "%s"
+ let lib_dir = "%s"
+ let version = "%s"
+-let version_message = "OMake %s:\\n\\tbuild [%s %s %d %02d:%02d:%02d %d]\\n\\ton %s"
++let version_message = "OMake %s"
+ |}
+        default_save_interval
+        digest_len
+@@ -160,15 +160,7 @@ let version_message = "OMake %s:\\n\\tbuild [%s %s %d %02d:%02d:%02d %d]\\n\\ton
+        (digest_files ".omo.magic" ".omo" omo_files)
+        (String.escaped libdir)
+        (String.escaped (shorten_version version))
+-       (String.escaped version)
+-       [|"Sun"; "Mon"; "Tue"; "Wed"; "Thu"; "Fri"; "Sat"|].(tm.tm_wday)
+-       [|"Jan"; "Feb"; "Mar"; "Apr"; "May"; "Jun"; "Jul"; "Aug"; "Sep"; "Oct"; "Nov"; "Dec"|].(tm.tm_mon)
+-       tm.tm_mday
+-       tm.tm_hour
+-       tm.tm_min
+-       tm.tm_sec
+-       (tm.tm_year + 1900)
+-       (String.escaped (Unix.gethostname ()));
++       (String.escaped version);
+   List.iter
+     (fun (name,value) ->
+        Printf.fprintf buf "let %s = %S\n" name value
+--
+2.11.0
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/10] gnu: Add ocaml-batteries.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (2 preceding siblings ...)
  2017-01-18 20:27 ` [PATCH 03/10] gnu: Add omake Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:27 ` [PATCH 05/10] gnu: Add ocaml-pcre Julien Lepiller
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-batteries): New variable.
---
 gnu/packages/ocaml.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index f69f77a7b..bc4193ac6 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1793,3 +1793,32 @@ tasks in C, C++, OCaml, and LaTeX projects, or a mixture thereof.")
     (license (list license:lgpl2.1; libmojave
                    license:expat; OMake scripts
                    license:gpl2)))); OMake itself, with an exception
+
+(define-public ocaml-batteries
+  (package
+    (name "ocaml-batteries")
+    (version "2.5.3")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri "batteries" version 1650))
+              (sha256
+               (base32
+                "1a97w3x2l1jr5x9kj5gqm1x6b0q9fjqdcsvls7arnl3bvzgsia0n"))))
+    (build-system ocaml-build-system)
+    (native-inputs
+     `(("qtest" ,ocaml-qtest)
+       ("bisect" ,ocaml-bisect)
+       ("ounit" ,ocaml-ounit)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'check); tests are run by the build phase
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             (zero? (system* "ocaml" "setup.ml" "-build")))))))
+    (home-page "http://batteries.forge.ocamlcore.org/")
+    (synopsis "Development platform for the OCaml programming language")
+    (description "Define a standard set of libraries which may be expected on
+every compliant installation of OCaml and organize these libraries into a
+hierarchy of modules.")
+    (license license:lgpl2.1+)))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/10] gnu: Add ocaml-pcre.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (3 preceding siblings ...)
  2017-01-18 20:27 ` [PATCH 04/10] gnu: Add ocaml-batteries Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:27 ` [PATCH 06/10] gnu: Add ocaml-expect Julien Lepiller
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-pcre): New variable.
---
 gnu/packages/ocaml.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bc4193ac6..4fbb75c24 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -40,6 +40,7 @@
   #:use-module (gnu packages m4)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -1822,3 +1823,38 @@ tasks in C, C++, OCaml, and LaTeX projects, or a mixture thereof.")
 every compliant installation of OCaml and organize these libraries into a
 hierarchy of modules.")
     (license license:lgpl2.1+)))
+
+(define-public ocaml-pcre
+  (package
+    (name "ocaml-pcre")
+    (version "7.2.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/mmottl/pcre-ocaml/archive"
+                                  "/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0rj6dw79px4sj2kq0iss2nzq3rnsn9wivvc0f44wa1mppr6njfb3"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'link-lib
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
+                    (lib (string-append out "/lib/ocaml/site-lib/pcre")))
+               (mkdir-p stubs)
+               (symlink (string-append lib "/dllpcre_stubs.so")
+                        (string-append stubs "/dllpcre_stubs.so"))))))))
+    (native-inputs
+     `(("batteries" ,ocaml-batteries)
+       ("pcre:bin" ,pcre "bin")))
+    (propagated-inputs `(("pcre" ,pcre)))
+    (home-page "https://mmottl.github.io/pcre-ocaml")
+    (synopsis "Bindings to the Perl Compatibility Regular Expressions library")
+    (description "Pcre-ocaml offers library functions for string pattern
+matching and substitution, similar to the functionality offered by the Perl
+language.")
+    (license license:lgpl2.1))); with an exception
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/10] gnu: Add ocaml-expect.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (4 preceding siblings ...)
  2017-01-18 20:27 ` [PATCH 05/10] gnu: Add ocaml-pcre Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:27 ` [PATCH 07/10] gnu: Add ocaml-fileutils Julien Lepiller
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-expect): New variable.
---
 gnu/packages/ocaml.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 4fbb75c24..b70c10dea 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1858,3 +1858,24 @@ hierarchy of modules.")
 matching and substitution, similar to the functionality offered by the Perl
 language.")
     (license license:lgpl2.1))); with an exception
+
+(define-public ocaml-expect
+  (package
+    (name "ocaml-expect")
+    (version "0.0.5")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri name version 1372))
+              (sha256
+               (base32
+                "07xq8w2x2vffc32z7vk6y14jwbfb1cw0m2lm1jzi60hnr1dvg8by"))))
+    (build-system ocaml-build-system)
+    (native-inputs
+     `(("ocaml-pcre" ,ocaml-pcre)
+       ("ounit" ,ocaml-ounit)))
+    (propagated-inputs `(("batteries" ,ocaml-batteries)))
+    (home-page "https://forge.ocamlcore.org/projects/ocaml-expect/")
+    (synopsis "Simple implementation of expect")
+    (description "Help building unitary testing of interactive program.  You
+can match the question using a regular expression or a timeout.")
+    (license license:lgpl2.0))) ; with an exception
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/10] gnu: Add ocaml-fileutils.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (5 preceding siblings ...)
  2017-01-18 20:27 ` [PATCH 06/10] gnu: Add ocaml-expect Julien Lepiller
@ 2017-01-18 20:27 ` Julien Lepiller
  2017-01-18 20:28 ` [PATCH 08/10] gnu: Add ocaml-oasis Julien Lepiller
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:27 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-fileutils): New variable.
---
 gnu/packages/ocaml.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index b70c10dea..6d033ebfe 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1879,3 +1879,21 @@ language.")
     (description "Help building unitary testing of interactive program.  You
 can match the question using a regular expression or a timeout.")
     (license license:lgpl2.0))) ; with an exception
+
+(define-public ocaml-fileutils
+  (package
+    (name "ocaml-fileutils")
+    (version "0.5.1")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri name version 1651))
+              (sha256
+               (base32
+                "0g6zx2rcvacklxyli19ixcf6ich9ipxsps4k3jz98f5zlaab0a7g"))))
+    (build-system ocaml-build-system)
+    (native-inputs `(("ounit" ,ocaml-ounit)))
+    (home-page "http://ocaml-fileutils.forge.ocamlcore.org")
+    (synopsis "Pure OCaml functions to manipulate real file and filename")
+    (description "Library to provide pure OCaml functions to manipulate real
+file (POSIX like) and filename.")
+    (license license:lgpl2.1)))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/10] gnu: Add ocaml-oasis.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (6 preceding siblings ...)
  2017-01-18 20:27 ` [PATCH 07/10] gnu: Add ocaml-fileutils Julien Lepiller
@ 2017-01-18 20:28 ` Julien Lepiller
  2017-01-18 22:14   ` Marius Bakke
  2017-01-18 20:28 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:28 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-oasis): New variable.
---
 gnu/packages/ocaml.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 6d033ebfe..35e0d081e 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1897,3 +1897,33 @@ can match the question using a regular expression or a timeout.")
     (description "Library to provide pure OCaml functions to manipulate real
 file (POSIX like) and filename.")
     (license license:lgpl2.1)))
+
+(define-public ocaml-oasis
+  (package
+    (name "ocaml-oasis")
+    (version "0.4.8")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri name version 1669))
+              (sha256
+               (base32
+                "1ln7vc7ip6s5xbi20mhnn087xi4a2m5vqawx0703qqnfkzhmslqy"))))
+    (build-system ocaml-build-system)
+    (native-inputs
+     `(("ocamlify" ,ocamlify)
+       ("ocamlmod" ,ocamlmod)
+       ("ounit" ,ocaml-ounit)
+       ("omake" ,omake)
+       ("ocaml-expect" ,ocaml-expect)
+       ("ocaml-pcre" ,ocaml-pcre)
+       ("ocaml-fileutils" ,ocaml-fileutils)
+       ("camlp4" ,camlp4)
+       ("texlive" ,texlive)
+       ("pkg-config" ,pkg-config)))
+    (arguments `(#:tests? #f)) ; 33.33% test failures... ld cannot find crti.o
+    (home-page "https://oasis.forge.ocamlcore.org")
+    (synopsis "Integrates a configure, build, install system in OCaml projects")
+    (description "OASIS is a tool to integrate a configure, build and install
+system in your OCaml projects.  It helps to create standard entry points in your
+build system and allows external tools to analyse your project easily.")
+    (license license:lgpl2.1))) ; with an exception
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (7 preceding siblings ...)
  2017-01-18 20:28 ` [PATCH 08/10] gnu: Add ocaml-oasis Julien Lepiller
@ 2017-01-18 20:28 ` Julien Lepiller
  2017-01-18 22:21   ` Marius Bakke
  2017-01-18 20:28 ` [PATCH 10/10] gnu: Add ocaml-bin-prot Julien Lepiller
  2017-01-18 22:27 ` [PATCH 00/10] ocaml patches Marius Bakke
  10 siblings, 1 reply; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:28 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
* gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
* gnu/local.mk (dist_patch_DATA): New patch.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/ocaml.scm                             | 49 ++++++++++++++++++++++
 .../patches/ocaml-janestreet-fix-libdir.patch      | 36 ++++++++++++++++
 3 files changed, 86 insertions(+)
 create mode 100644 gnu/packages/patches/ocaml-janestreet-fix-libdir.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5b919dd86..7b210c7b3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -778,6 +778,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
   %D%/packages/patches/ocaml-Add-a-.file-directive.patch	\
   %D%/packages/patches/ocaml-findlib-make-install.patch	\
+  %D%/packages/patches/ocaml-janestreet-fix-libdir.patch \
   %D%/packages/patches/ocaml-omake-fix-non-determinism.patch	\
   %D%/packages/patches/ola-readdir-r.patch			\
   %D%/packages/patches/openexr-missing-samples.patch		\
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 35e0d081e..120095118 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -66,6 +66,35 @@
                  (number->string file-number) "/" name "-" version
                  ".tar.gz"))
 
+;; Janestreet packages are found in a similar way and all need the same patch
+(define (janestreet-origin name version hash)
+  (origin (method url-fetch)
+          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
+                              (version-major+minor version) "/files/"
+                              name "-" version ".tar.gz"))
+          (sha256 (base32 hash))
+          (patches (search-patches "ocaml-janestreet-fix-libdir.patch"))
+          (modules '((guix build utils)))
+          (snippet `(substitute* "install.ml"
+                                 (((string-append "lib/" ,name))
+                                  (string-append "lib/ocaml/site-lib/" ,name))))))
+
+;; They also require almost the same set of arguments
+(define janestreet-arguments
+ `(#:use-make? #t
+   #:make-flags
+   (list (string-append "CONFIGUREFLAGS=--prefix "
+                        (assoc-ref %outputs "out")
+                        " --enable-tests")
+         (string-append "LIBDIR="
+                        (assoc-ref %outputs "out")
+                        "/lib/ocaml/site-lib")
+         ;; for ocaml-bin-prot, otherwise ignored
+         (string-append "OCAML_TOPLEVEL_PATH="
+                        (assoc-ref %build-inputs "findlib")
+                        "/lib/ocaml/site-lib"))
+   #:phases (modify-phases %standard-phases (delete 'configure))))
+
 (define-public ocaml
   (package
     (name "ocaml")
@@ -1927,3 +1956,23 @@ file (POSIX like) and filename.")
 system in your OCaml projects.  It helps to create standard entry points in your
 build system and allows external tools to analyse your project easily.")
     (license license:lgpl2.1))) ; with an exception
+
+(define-public ocaml-js-build-tools
+  (package
+    (name "ocaml-js-build-tools")
+    (version "113.33.06")
+    (source (janestreet-origin "js-build-tools" version
+              "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
+    (native-inputs
+     `(("oasis" ,ocaml-oasis)
+       ("opam" ,opam)))
+    (build-system ocaml-build-system)
+    (arguments janestreet-arguments)
+    (home-page "https://github.com/janestreet/js-build-tools")
+    (synopsis "Collection of tools to help building Jane Street Packages")
+    (description "This packages contains tools to help building Jane Street
+Packages. However most of it is general purpose.  It contains:
+
+- an oasis2opam-install tool to produce a .install file from the oasis build log
+- an js_build_tools ocamlbuild plugin with various goodies")
+    (license license:asl2.0)))
diff --git a/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
new file mode 100644
index 000000000..07cabe3c4
--- /dev/null
+++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
@@ -0,0 +1,36 @@
+diff -aur package.pristine/Makefile package.new/Makefile
+--- package.pristine/Makefile	2016-02-06 01:55:14.650150309 +0100
++++ package.new/Makefile	2016-02-06 01:57:56.012174364 +0100
+@@ -29,26 +29,26 @@
+ 	ocaml -I js-utils js-utils/gen_install.ml
+
+ install: $(NAME).install
+-	opam-installer -i --prefix $(PREFIX) $(NAME).install
++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ uninstall: $(NAME).install
+-	opam-installer -u --prefix $(PREFIX) $(NAME).install
++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ reinstall: $(NAME).install
+-	opam-installer -u --prefix $(PREFIX) $(NAME).install &> /dev/null || true
+-	opam-installer -i --prefix $(PREFIX) $(NAME).install
++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install &> /dev/null || true
++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ bin.tar.gz: $(NAME).install
+ 	rm -rf _install
+ 	mkdir _install
+-	opam-installer -i --prefix _install $(NAME).install
++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
+ 	tar czf bin.tar.gz -C _install .
+ 	rm -rf _install
+
+ bin.lzo: $(NAME).install
+ 	rm -rf _install
+ 	mkdir _install
+-	opam-installer -i --prefix _install $(NAME).install
++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
+ 	cd _install && lzop -1 -P -o ../bin.lzo `find . -type f`
+ 	rm -rf _install
+
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/10] gnu: Add ocaml-bin-prot.
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (8 preceding siblings ...)
  2017-01-18 20:28 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
@ 2017-01-18 20:28 ` Julien Lepiller
  2017-01-18 22:27 ` [PATCH 00/10] ocaml patches Marius Bakke
  10 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-18 20:28 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-bin-prot): New variable.
---
 gnu/packages/ocaml.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 120095118..71a5c1954 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1976,3 +1976,24 @@ Packages. However most of it is general purpose.  It contains:
 - an oasis2opam-install tool to produce a .install file from the oasis build log
 - an js_build_tools ocamlbuild plugin with various goodies")
     (license license:asl2.0)))
+
+(define-public ocaml-bin-prot
+  (package
+    (name "ocaml-bin-prot")
+    (version "113.33.03")
+    (source (janestreet-origin "bin_prot" version
+               "1ws8c017z8nbj3vw92ndvjk9011f71rmp3llncbv8r5fc76wqv3l"))
+    (native-inputs
+     `(("js-build-tools" ,ocaml-js-build-tools)
+       ("opam" ,opam)))
+    (build-system ocaml-build-system)
+    (arguments janestreet-arguments)
+    (home-page "https://github.com/janestreet/bin_prot/")
+    (synopsis "A binary protocol generator")
+    (description "This library contains functionality for reading and writing
+OCaml-values in a type-safe binary protocol.  It is extremely efficient,
+typically supporting type-safe marshalling and unmarshalling of even highly
+structured values at speeds sufficient to saturate a gigabit connection.  The
+protocol is also heavily optimized for size, making it ideal for long-term
+storage of large amounts of data.")
+    (license license:asl2.0)))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 03/10] gnu: Add omake.
  2017-01-18 20:27 ` [PATCH 03/10] gnu: Add omake Julien Lepiller
@ 2017-01-18 22:00   ` Marius Bakke
  0 siblings, 0 replies; 24+ messages in thread
From: Marius Bakke @ 2017-01-18 22:00 UTC (permalink / raw)
  To: Julien Lepiller, guix-devel

[-- Attachment #1: Type: text/plain, Size: 5858 bytes --]

Julien Lepiller <julien@lepiller.eu> writes:

> * gnu/packages/ocaml.scm (omake): New variable.
> * gnu/packages/patches/ocaml-omake-fix-non-determinism.patch: New file.
> * gnu/local.mk (dist_patch_DATA): New patch.
> ---
>  gnu/local.mk                                       |  1 +
>  gnu/packages/ocaml.scm                             | 41 ++++++++++++++++++++++
>  .../patches/ocaml-omake-fix-non-determinism.patch  | 41 ++++++++++++++++++++++
>  3 files changed, 83 insertions(+)
>  create mode 100644 gnu/packages/patches/ocaml-omake-fix-non-determinism.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 24dcd03fd..5b919dd86 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -778,6 +778,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
>    %D%/packages/patches/ocaml-Add-a-.file-directive.patch	\
>    %D%/packages/patches/ocaml-findlib-make-install.patch	\
> +  %D%/packages/patches/ocaml-omake-fix-non-determinism.patch	\
                          ^^^^^^^^^^^
                          This should start with the package name.
 
>    %D%/packages/patches/ola-readdir-r.patch			\
>    %D%/packages/patches/openexr-missing-samples.patch		\
>    %D%/packages/patches/openjpeg-CVE-2016-5157.patch		\
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index a2297d1ab..f69f77a7b 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -1752,3 +1752,44 @@ whole files into OCaml string or string list.  The code generated can be
>  compiled as a standard OCaml file.  It allows embedding external resources as
>  OCaml code.")
>      (license license:lgpl2.1))); with an exception
> +
> +(define-public omake
> +  (package
> +    (name "omake")
> +    (version "0.10.1")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "http://download.camlcity.org/download/"
> +                                  "omake-" version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "093ansbppms90hiqvzar2a46fj8gm9iwnf8gn38s6piyp70lrbsj"))
> +              (patches (search-patches "ocaml-omake-fix-non-determinism.patch"))))
> +    (build-system ocaml-build-system)
> +    (arguments
> +     `(#:make-flags
> +       (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
> +       #:tests? #f; no test target
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'configure 'fix-makefile
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (substitute* "mk/osconfig_unix.mk"
> +                (("CC = cc") "CC = gcc")))))))

Indentation seems off here :-)

> +    (native-inputs `(("hevea" ,hevea)))
> +    (home-page "http://projects.camlcity.org/projects/omake.html")
> +    (synopsis "Build system designed for scalability and portability")
> +    (description "Similar to make utilities you may have used, but it features
> +many additional enhancements, including:
> +
> +- Support for projects spanning several directories or directory hierarchies.
> +- Fast, reliable, automated, scriptable dependency analysis using MD5 digests,
> +with full support for incremental builds.
> +- Dependency analysis takes the command lines into account — whenever the
> +command line used to build a target changes, the target is considered
> +out-of-date.
> +-  Fully scriptable, includes a library that providing support for standard
> +tasks in C, C++, OCaml, and LaTeX projects, or a mixture thereof.")

Could you use @enumerate here instead?

> +    (license (list license:lgpl2.1; libmojave
> +                   license:expat; OMake scripts
> +                   license:gpl2)))); OMake itself, with an exception

Which exception? Also, is there no "or later" on these?

> diff --git a/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch b/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch
> new file mode 100644
> index 000000000..813ce3cd7
> --- /dev/null
> +++ b/gnu/packages/patches/ocaml-omake-fix-non-determinism.patch
> @@ -0,0 +1,41 @@
> +From 2e7e254160506dc00f1beabf170512a8e932934b Mon Sep 17 00:00:00 2001
> +From: Julien Lepiller <julien@lepiller.eu>
> +Date: Sat, 31 Dec 2016 15:43:38 +0100
> +Subject: [PATCH] fix build date in binary

Ooh, nice find! The rest LGTM.

> +
> +---
> + src/magic/omake_gen_magic.ml | 12 ++----------
> + 1 file changed, 2 insertions(+), 10 deletions(-)
> +
> +diff --git a/src/magic/omake_gen_magic.ml b/src/magic/omake_gen_magic.ml
> +index b2419ba..fad52f5 100644
> +--- a/src/magic/omake_gen_magic.ml
> ++++ b/src/magic/omake_gen_magic.ml
> +@@ -150,7 +150,7 @@ let ir_magic = "%s"
> + let obj_magic = "%s"
> + let lib_dir = "%s"
> + let version = "%s"
> +-let version_message = "OMake %s:\\n\\tbuild [%s %s %d %02d:%02d:%02d %d]\\n\\ton %s"
> ++let version_message = "OMake %s"
> + |}
> +        default_save_interval
> +        digest_len
> +@@ -160,15 +160,7 @@ let version_message = "OMake %s:\\n\\tbuild [%s %s %d %02d:%02d:%02d %d]\\n\\ton
> +        (digest_files ".omo.magic" ".omo" omo_files)
> +        (String.escaped libdir)
> +        (String.escaped (shorten_version version))
> +-       (String.escaped version)
> +-       [|"Sun"; "Mon"; "Tue"; "Wed"; "Thu"; "Fri"; "Sat"|].(tm.tm_wday)
> +-       [|"Jan"; "Feb"; "Mar"; "Apr"; "May"; "Jun"; "Jul"; "Aug"; "Sep"; "Oct"; "Nov"; "Dec"|].(tm.tm_mon)
> +-       tm.tm_mday
> +-       tm.tm_hour
> +-       tm.tm_min
> +-       tm.tm_sec
> +-       (tm.tm_year + 1900)
> +-       (String.escaped (Unix.gethostname ()));
> ++       (String.escaped version);
> +   List.iter
> +     (fun (name,value) ->
> +        Printf.fprintf buf "let %s = %S\n" name value
> +--
> +2.11.0
> -- 
> 2.11.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 08/10] gnu: Add ocaml-oasis.
  2017-01-18 20:28 ` [PATCH 08/10] gnu: Add ocaml-oasis Julien Lepiller
@ 2017-01-18 22:14   ` Marius Bakke
  0 siblings, 0 replies; 24+ messages in thread
From: Marius Bakke @ 2017-01-18 22:14 UTC (permalink / raw)
  To: Julien Lepiller, guix-devel

[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]

Julien Lepiller <julien@lepiller.eu> writes:

> * gnu/packages/ocaml.scm (ocaml-oasis): New variable.
> ---
>  gnu/packages/ocaml.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 6d033ebfe..35e0d081e 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -1897,3 +1897,33 @@ can match the question using a regular expression or a timeout.")
>      (description "Library to provide pure OCaml functions to manipulate real
>  file (POSIX like) and filename.")
>      (license license:lgpl2.1)))
> +
> +(define-public ocaml-oasis
> +  (package
> +    (name "ocaml-oasis")
> +    (version "0.4.8")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (ocaml-forge-uri name version 1669))
> +              (sha256
> +               (base32
> +                "1ln7vc7ip6s5xbi20mhnn087xi4a2m5vqawx0703qqnfkzhmslqy"))))
> +    (build-system ocaml-build-system)
> +    (native-inputs
> +     `(("ocamlify" ,ocamlify)
> +       ("ocamlmod" ,ocamlmod)
> +       ("ounit" ,ocaml-ounit)
> +       ("omake" ,omake)
> +       ("ocaml-expect" ,ocaml-expect)
> +       ("ocaml-pcre" ,ocaml-pcre)
> +       ("ocaml-fileutils" ,ocaml-fileutils)
> +       ("camlp4" ,camlp4)
> +       ("texlive" ,texlive)
> +       ("pkg-config" ,pkg-config)))
> +    (arguments `(#:tests? #f)) ; 33.33% test failures... ld cannot find crti.o

This has been discussed a couple of times on the mailing list. IIRC
setting up LD_LIBRARY_PATH to point to $glibc/lib fixes it.

See e.g. https://lists.gnu.org/archive/html/help-guix/2017-01/msg00028.html

or https://lists.gnu.org/archive/html/guix-devel/2016-11/msg01104.html

for a patch with a (suboptimal) fix. I should brush up this package.. :P

> +    (home-page "https://oasis.forge.ocamlcore.org")
> +    (synopsis "Integrates a configure, build, install system in OCaml projects")
> +    (description "OASIS is a tool to integrate a configure, build and install
> +system in your OCaml projects.  It helps to create standard entry points in your
> +build system and allows external tools to analyse your project easily.")
> +    (license license:lgpl2.1))) ; with an exception

Please clarify what the exception is, or where to find the full text.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-18 20:28 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
@ 2017-01-18 22:21   ` Marius Bakke
  2017-01-20 13:28     ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Bakke @ 2017-01-18 22:21 UTC (permalink / raw)
  To: Julien Lepiller, guix-devel

[-- Attachment #1: Type: text/plain, Size: 6304 bytes --]

Julien Lepiller <julien@lepiller.eu> writes:

> * gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
> * gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
> * gnu/local.mk (dist_patch_DATA): New patch.
> ---
>  gnu/local.mk                                       |  1 +
>  gnu/packages/ocaml.scm                             | 49 ++++++++++++++++++++++
>  .../patches/ocaml-janestreet-fix-libdir.patch      | 36 ++++++++++++++++
>  3 files changed, 86 insertions(+)
>  create mode 100644 gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 5b919dd86..7b210c7b3 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -778,6 +778,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
>    %D%/packages/patches/ocaml-Add-a-.file-directive.patch	\
>    %D%/packages/patches/ocaml-findlib-make-install.patch	\
> +  %D%/packages/patches/ocaml-janestreet-fix-libdir.patch \
>    %D%/packages/patches/ocaml-omake-fix-non-determinism.patch	\
>    %D%/packages/patches/ola-readdir-r.patch			\
>    %D%/packages/patches/openexr-missing-samples.patch		\
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 35e0d081e..120095118 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -66,6 +66,35 @@
>                   (number->string file-number) "/" name "-" version
>                   ".tar.gz"))
>  
> +;; Janestreet packages are found in a similar way and all need the same patch
> +(define (janestreet-origin name version hash)
> +  (origin (method url-fetch)
> +          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
> +                              (version-major+minor version) "/files/"
> +                              name "-" version ".tar.gz"))
> +          (sha256 (base32 hash))
> +          (patches (search-patches "ocaml-janestreet-fix-libdir.patch"))
> +          (modules '((guix build utils)))
> +          (snippet `(substitute* "install.ml"
> +                                 (((string-append "lib/" ,name))
> +                                  (string-append "lib/ocaml/site-lib/" ,name))))))
> +
> +;; They also require almost the same set of arguments
> +(define janestreet-arguments
> + `(#:use-make? #t
> +   #:make-flags
> +   (list (string-append "CONFIGUREFLAGS=--prefix "
> +                        (assoc-ref %outputs "out")
> +                        " --enable-tests")
> +         (string-append "LIBDIR="
> +                        (assoc-ref %outputs "out")
> +                        "/lib/ocaml/site-lib")
> +         ;; for ocaml-bin-prot, otherwise ignored
> +         (string-append "OCAML_TOPLEVEL_PATH="
> +                        (assoc-ref %build-inputs "findlib")
> +                        "/lib/ocaml/site-lib"))
> +   #:phases (modify-phases %standard-phases (delete 'configure))))
> +
>  (define-public ocaml
>    (package
>      (name "ocaml")
> @@ -1927,3 +1956,23 @@ file (POSIX like) and filename.")
>  system in your OCaml projects.  It helps to create standard entry points in your
>  build system and allows external tools to analyse your project easily.")
>      (license license:lgpl2.1))) ; with an exception
> +
> +(define-public ocaml-js-build-tools
> +  (package
> +    (name "ocaml-js-build-tools")
> +    (version "113.33.06")
> +    (source (janestreet-origin "js-build-tools" version
> +              "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
> +    (native-inputs
> +     `(("oasis" ,ocaml-oasis)
> +       ("opam" ,opam)))
> +    (build-system ocaml-build-system)
> +    (arguments janestreet-arguments)
> +    (home-page "https://github.com/janestreet/js-build-tools")
> +    (synopsis "Collection of tools to help building Jane Street Packages")
> +    (description "This packages contains tools to help building Jane Street
> +Packages. However most of it is general purpose.  It contains:

The second sentence is difficult to parse. Maybe ", but can also be used
for other purposes."

> +
> +- an oasis2opam-install tool to produce a .install file from the oasis build log
> +- an js_build_tools ocamlbuild plugin with various goodies")

Please use @enumerate here too.

Hopefully someone else can chime in on the helper functions above, if it
works I'd say they are fine. LGTM!

> +    (license license:asl2.0)))
> diff --git a/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> new file mode 100644
> index 000000000..07cabe3c4
> --- /dev/null
> +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> @@ -0,0 +1,36 @@
> +diff -aur package.pristine/Makefile package.new/Makefile
> +--- package.pristine/Makefile	2016-02-06 01:55:14.650150309 +0100
> ++++ package.new/Makefile	2016-02-06 01:57:56.012174364 +0100
> +@@ -29,26 +29,26 @@
> + 	ocaml -I js-utils js-utils/gen_install.ml
> +
> + install: $(NAME).install
> +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
> ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
> +
> + uninstall: $(NAME).install
> +-	opam-installer -u --prefix $(PREFIX) $(NAME).install
> ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
> +
> + reinstall: $(NAME).install
> +-	opam-installer -u --prefix $(PREFIX) $(NAME).install &> /dev/null || true
> +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
> ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install &> /dev/null || true
> ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
> +
> + bin.tar.gz: $(NAME).install
> + 	rm -rf _install
> + 	mkdir _install
> +-	opam-installer -i --prefix _install $(NAME).install
> ++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
> + 	tar czf bin.tar.gz -C _install .
> + 	rm -rf _install
> +
> + bin.lzo: $(NAME).install
> + 	rm -rf _install
> + 	mkdir _install
> +-	opam-installer -i --prefix _install $(NAME).install
> ++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
> + 	cd _install && lzop -1 -P -o ../bin.lzo `find . -type f`
> + 	rm -rf _install
> +
> -- 
> 2.11.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/10] ocaml patches
  2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
                   ` (9 preceding siblings ...)
  2017-01-18 20:28 ` [PATCH 10/10] gnu: Add ocaml-bin-prot Julien Lepiller
@ 2017-01-18 22:27 ` Marius Bakke
  2017-01-19  8:56   ` Julien Lepiller
  10 siblings, 1 reply; 24+ messages in thread
From: Marius Bakke @ 2017-01-18 22:27 UTC (permalink / raw)
  To: Julien Lepiller, guix-devel

[-- Attachment #1: Type: text/plain, Size: 705 bytes --]

Julien Lepiller <julien@lepiller.eu> writes:

> Here are the next 10 ocaml-related patches I would like to push. What do you
> think?

I don't know anything about ocaml, but the patches reads fine to me.

One thing that strikes me is the usage of native-inputs; I assume it's
because the packages are not referenced, but bear in mind that they are
built for the architecture of the build machine, and not for the target
system.

E.g. `guix build --system=i686-linux ocamlify` will add 64-bit
native-inputs even if the final product is supposed to be 32-bit. Not
sure if that will cause problems or not.

> I'm pretty sure number 9 and 10 can be improved, any idea?

Not from me, I'd say it looks fine :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/10] ocaml patches
  2017-01-18 22:27 ` [PATCH 00/10] ocaml patches Marius Bakke
@ 2017-01-19  8:56   ` Julien Lepiller
  0 siblings, 0 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-19  8:56 UTC (permalink / raw)
  To: guix-devel

On Wed, 18 Jan 2017 23:27:06 +0100
Marius Bakke <mbakke@fastmail.com> wrote:

> Julien Lepiller <julien@lepiller.eu> writes:
> 
> > Here are the next 10 ocaml-related patches I would like to push.
> > What do you think?  
> 
> I don't know anything about ocaml, but the patches reads fine to me.
> 
> One thing that strikes me is the usage of native-inputs; I assume it's
> because the packages are not referenced, but bear in mind that they
> are built for the architecture of the build machine, and not for the
> target system.
I use native-inputs because the build system needs binaries (not
libraries) from these packages.

> 
> E.g. `guix build --system=i686-linux ocamlify` will add 64-bit
> native-inputs even if the final product is supposed to be 32-bit. Not
> sure if that will cause problems or not.
Just to be sure, I'll cross-compile them. I'll send updated patches
soon.

> 
> > I'm pretty sure number 9 and 10 can be improved, any idea?  
> 
> Not from me, I'd say it looks fine :-)
Thanks for your review :)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-18 22:21   ` Marius Bakke
@ 2017-01-20 13:28     ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2017-01-20 13:28 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

>> --- /dev/null
>> +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
>> @@ -0,0 +1,36 @@
>> +diff -aur package.pristine/Makefile package.new/Makefile
>> +--- package.pristine/Makefile	2016-02-06 01:55:14.650150309 +0100
>> ++++ package.new/Makefile	2016-02-06 01:57:56.012174364 +0100

Also, please add one or two lines here describing what the patch does
and what its upstream status is.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-27 22:12 [PATCH 00/10] ocaml patches v2 Julien Lepiller
@ 2017-01-27 22:12 ` Julien Lepiller
  2017-01-30  9:19   ` Ludovic Courtès
  2017-01-30  9:22   ` Ludovic Courtès
  0 siblings, 2 replies; 24+ messages in thread
From: Julien Lepiller @ 2017-01-27 22:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
* gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/ocaml.scm                             | 50 ++++++++++++++++++++++
 .../patches/ocaml-janestreet-fix-libdir.patch      | 39 +++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 gnu/packages/patches/ocaml-janestreet-fix-libdir.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 2e3548342..8555e403f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -775,6 +775,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
   %D%/packages/patches/ocaml-Add-a-.file-directive.patch	\
   %D%/packages/patches/ocaml-findlib-make-install.patch	\
+  %D%/packages/patches/ocaml-janestreet-fix-libdir.patch \
   %D%/packages/patches/omake-fix-non-determinism.patch	\
   %D%/packages/patches/ola-readdir-r.patch			\
   %D%/packages/patches/openexr-missing-samples.patch		\
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index ba0f5cd4c..9b323975f 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -66,6 +66,35 @@
                  (number->string file-number) "/" name "-" version
                  ".tar.gz"))
 
+;; Janestreet packages are found in a similar way and all need the same patch
+(define (janestreet-origin name version hash)
+  (origin (method url-fetch)
+          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
+                              (version-major+minor version) "/files/"
+                              name "-" version ".tar.gz"))
+          (sha256 (base32 hash))
+          (patches (search-patches "ocaml-janestreet-fix-libdir.patch"))
+          (modules '((guix build utils)))
+          (snippet `(substitute* "install.ml"
+                                 (((string-append "lib/" ,name))
+                                  (string-append "lib/ocaml/site-lib/" ,name))))))
+
+;; They also require almost the same set of arguments
+(define janestreet-arguments
+ `(#:use-make? #t
+   #:make-flags
+   (list (string-append "CONFIGUREFLAGS=--prefix "
+                        (assoc-ref %outputs "out")
+                        " --enable-tests")
+         (string-append "LIBDIR="
+                        (assoc-ref %outputs "out")
+                        "/lib/ocaml/site-lib")
+         ;; for ocaml-bin-prot, otherwise ignored
+         (string-append "OCAML_TOPLEVEL_PATH="
+                        (assoc-ref %build-inputs "findlib")
+                        "/lib/ocaml/site-lib"))
+   #:phases (modify-phases %standard-phases (delete 'configure))))
+
 (define-public ocaml
   (package
     (name "ocaml")
@@ -1942,3 +1971,24 @@ file (POSIX like) and filename.")
 system in your OCaml projects.  It helps to create standard entry points in your
 build system and allows external tools to analyse your project easily.")
     (license license:lgpl2.1))) ; with ocaml static compilation exception
+
+(define-public ocaml-js-build-tools
+  (package
+    (name "ocaml-js-build-tools")
+    (version "113.33.06")
+    (source (janestreet-origin "js-build-tools" version
+              "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
+    (native-inputs
+     `(("oasis" ,ocaml-oasis)
+       ("opam" ,opam)))
+    (build-system ocaml-build-system)
+    (arguments janestreet-arguments)
+    (home-page "https://github.com/janestreet/js-build-tools")
+    (synopsis "Collection of tools to help building Jane Street Packages")
+    (description "This packages contains tools to help building Jane Street
+Packages, but can be used for other purposes.  It contains:
+@enumerate
+@item an oasis2opam-install tool to produce a .install file from the oasis build log
+@item an js_build_tools ocamlbuild plugin with various goodies
+@end enumerate")
+    (license license:asl2.0)))
diff --git a/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
new file mode 100644
index 000000000..4ba2a7510
--- /dev/null
+++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
@@ -0,0 +1,39 @@
+This patch adds a --libdir option to opam-installer so it installs the plugin
+in the specified directory rather than in the default one (ocaml's directory in
+the store, which is forbidden).
+diff -aur package.pristine/Makefile package.new/Makefile
+--- package.pristine/Makefile	2016-02-06 01:55:14.650150309 +0100
++++ package.new/Makefile	2016-02-06 01:57:56.012174364 +0100
+@@ -29,26 +29,26 @@
+ 	ocaml -I js-utils js-utils/gen_install.ml
+
+ install: $(NAME).install
+-	opam-installer -i --prefix $(PREFIX) $(NAME).install
++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ uninstall: $(NAME).install
+-	opam-installer -u --prefix $(PREFIX) $(NAME).install
++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ reinstall: $(NAME).install
+-	opam-installer -u --prefix $(PREFIX) $(NAME).install &> /dev/null || true
+-	opam-installer -i --prefix $(PREFIX) $(NAME).install
++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install &> /dev/null || true
++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
+
+ bin.tar.gz: $(NAME).install
+ 	rm -rf _install
+ 	mkdir _install
+-	opam-installer -i --prefix _install $(NAME).install
++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
+ 	tar czf bin.tar.gz -C _install .
+ 	rm -rf _install
+
+ bin.lzo: $(NAME).install
+ 	rm -rf _install
+ 	mkdir _install
+-	opam-installer -i --prefix _install $(NAME).install
++	opam-installer -i --prefix _install --libdir $(LIBDIR) $(NAME).install
+ 	cd _install && lzop -1 -P -o ../bin.lzo `find . -type f`
+ 	rm -rf _install
+
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-27 22:12 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
@ 2017-01-30  9:19   ` Ludovic Courtès
  2017-01-30  9:22   ` Ludovic Courtès
  1 sibling, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2017-01-30  9:19 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Hey!

Julien Lepiller <julien@lepiller.eu> skribis:

> * gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
> * gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

[...]

> +;; Janestreet packages are found in a similar way and all need the same patch

Period at the end of a sentence please.

> +(define (janestreet-origin name version hash)
> +  (origin (method url-fetch)
> +          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
> +                              (version-major+minor version) "/files/"
> +                              name "-" version ".tar.gz"))
> +          (sha256 (base32 hash))
> +          (patches (search-patches "ocaml-janestreet-fix-libdir.patch"))
> +          (modules '((guix build utils)))
> +          (snippet `(substitute* "install.ml"
> +                                 (((string-append "lib/" ,name))
> +                                  (string-append "lib/ocaml/site-lib/" ,name))))))

I prefer not to rely on the ability to use non-literal patterns in
‘substitute*’, so I would write it this way:

  (let ((pattern (string-append "lib/" name)))
    `(substitute* "install.ml"
       ((,pattern)
        …)))

Also, could you add a comment about what the snippet does (I suppose
Jane Street’s default install.ml files specify a wrong location or
something?).

Lastly, please pass this through indent-code.el.

> +(define-public ocaml-js-build-tools
> +  (package
> +    (name "ocaml-js-build-tools")
> +    (version "113.33.06")
> +    (source (janestreet-origin "js-build-tools" version
> +              "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
> +    (native-inputs
> +     `(("oasis" ,ocaml-oasis)
> +       ("opam" ,opam)))
> +    (build-system ocaml-build-system)
> +    (arguments janestreet-arguments)
> +    (home-page "https://github.com/janestreet/js-build-tools")
> +    (synopsis "Collection of tools to help building Jane Street Packages")
> +    (description "This packages contains tools to help building Jane Street
> +Packages, but can be used for other purposes.  It contains:

s/Packages/packages/

> +@enumerate
> +@item an oasis2opam-install tool to produce a .install file from the oasis build log

Nitpick: @command{oasis2opam-install}, @file{.install}, OASIS.

> +@item an js_build_tools ocamlbuild plugin with various goodies

s/an js_build_tools/a @code{js_build_tools}/
Period at the end.

> --- /dev/null
> +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> @@ -0,0 +1,39 @@
> +This patch adds a --libdir option to opam-installer so it installs the plugin
> +in the specified directory rather than in the default one (ocaml's directory in
> +the store, which is forbidden).

s/forbidden/read-only/  :-)

Also please mention that this patch is meant to apply to all the
packages published by Jane Street (IIUC).

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-27 22:12 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
  2017-01-30  9:19   ` Ludovic Courtès
@ 2017-01-30  9:22   ` Ludovic Courtès
  2017-01-30 21:08     ` Julien Lepiller
  1 sibling, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2017-01-30  9:22 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Julien Lepiller <julien@lepiller.eu> skribis:

> +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> @@ -0,0 +1,39 @@
> +This patch adds a --libdir option to opam-installer so it installs the plugin
> +in the specified directory rather than in the default one (ocaml's directory in
> +the store, which is forbidden).
> +diff -aur package.pristine/Makefile package.new/Makefile
> +--- package.pristine/Makefile	2016-02-06 01:55:14.650150309 +0100
> ++++ package.new/Makefile	2016-02-06 01:57:56.012174364 +0100
> +@@ -29,26 +29,26 @@
> + 	ocaml -I js-utils js-utils/gen_install.ml
> +
> + install: $(NAME).install
> +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
> ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install
> +
> + uninstall: $(NAME).install
> +-	opam-installer -u --prefix $(PREFIX) $(NAME).install
> ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR) $(NAME).install

On second thought, I think it’d be simpler and more maintainable to do
this as a substitution in the snippet.

WDYT?

(It will also avoid ‘guix lint’ complaints about the patch file name not
matching the package name.  :-))

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-30  9:22   ` Ludovic Courtès
@ 2017-01-30 21:08     ` Julien Lepiller
  2017-01-30 22:23       ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Julien Lepiller @ 2017-01-30 21:08 UTC (permalink / raw)
  To: Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

On Mon, 30 Jan 2017 10:22:13 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> > @@ -0,0 +1,39 @@
> > +This patch adds a --libdir option to opam-installer so it installs
> > the plugin +in the specified directory rather than in the default
> > one (ocaml's directory in +the store, which is forbidden).
> > +diff -aur package.pristine/Makefile package.new/Makefile
> > +--- package.pristine/Makefile	2016-02-06 01:55:14.650150309
> > +0100 ++++ package.new/Makefile	2016-02-06
> > 01:57:56.012174364 +0100 +@@ -29,26 +29,26 @@
> > + 	ocaml -I js-utils js-utils/gen_install.ml
> > +
> > + install: $(NAME).install
> > +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
> > ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR)
> > $(NAME).install +
> > + uninstall: $(NAME).install
> > +-	opam-installer -u --prefix $(PREFIX) $(NAME).install
> > ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR)
> > $(NAME).install  
> 
> On second thought, I think it’d be simpler and more maintainable to do
> this as a substitution in the snippet.
> 
> WDYT?
> 
> (It will also avoid ‘guix lint’ complaints about the patch file name
> not matching the package name.  :-))
> 
> Ludo’.

Sure, here it is :)

[-- Attachment #2: gnu-Add-ocaml-bin-prot.patch --]
[-- Type: text/x-patch, Size: 1633 bytes --]

From 8cd3ba3a3f9702a89f8f52c75c33d3d02f20f60b Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 30 Dec 2016 16:27:27 +0100
Subject: [PATCH 2/2] gnu: Add ocaml-bin-prot.

* gnu/packages/ocaml.scm (ocaml-bin-prot): New variable.
---
 gnu/packages/ocaml.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 6e1e745fe..9d2e02f7f 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -2004,3 +2004,24 @@ from the oasis build log
 @item a @code{js_build_tools} ocamlbuild plugin with various goodies.
 @end enumerate")
     (license license:asl2.0)))
+
+(define-public ocaml-bin-prot
+  (package
+    (name "ocaml-bin-prot")
+    (version "113.33.03")
+    (source (janestreet-origin "bin_prot" version
+               "1ws8c017z8nbj3vw92ndvjk9011f71rmp3llncbv8r5fc76wqv3l"))
+    (native-inputs
+     `(("js-build-tools" ,ocaml-js-build-tools)
+       ("opam" ,opam)))
+    (build-system ocaml-build-system)
+    (arguments janestreet-arguments)
+    (home-page "https://github.com/janestreet/bin_prot/")
+    (synopsis "Binary protocol generator")
+    (description "This library contains functionality for reading and writing
+OCaml-values in a type-safe binary protocol.  It is extremely efficient,
+typically supporting type-safe marshalling and unmarshalling of even highly
+structured values at speeds sufficient to saturate a gigabit connection.  The
+protocol is also heavily optimized for size, making it ideal for long-term
+storage of large amounts of data.")
+    (license license:asl2.0)))
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-30 21:08     ` Julien Lepiller
@ 2017-01-30 22:23       ` Ludovic Courtès
  2017-01-30 22:48         ` Julien Lepiller
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2017-01-30 22:23 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Julien Lepiller <julien@lepiller.eu> skribis:

> On Mon, 30 Jan 2017 10:22:13 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Julien Lepiller <julien@lepiller.eu> skribis:
>> 
>> > +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
>> > @@ -0,0 +1,39 @@
>> > +This patch adds a --libdir option to opam-installer so it installs
>> > the plugin +in the specified directory rather than in the default
>> > one (ocaml's directory in +the store, which is forbidden).
>> > +diff -aur package.pristine/Makefile package.new/Makefile
>> > +--- package.pristine/Makefile	2016-02-06 01:55:14.650150309
>> > +0100 ++++ package.new/Makefile	2016-02-06
>> > 01:57:56.012174364 +0100 +@@ -29,26 +29,26 @@
>> > + 	ocaml -I js-utils js-utils/gen_install.ml
>> > +
>> > + install: $(NAME).install
>> > +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
>> > ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR)
>> > $(NAME).install +
>> > + uninstall: $(NAME).install
>> > +-	opam-installer -u --prefix $(PREFIX) $(NAME).install
>> > ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR)
>> > $(NAME).install  
>> 
>> On second thought, I think it’d be simpler and more maintainable to do
>> this as a substitution in the snippet.
>> 
>> WDYT?
>> 
>> (It will also avoid ‘guix lint’ complaints about the patch file name
>> not matching the package name.  :-))
>> 
>> Ludo’.
>
> Sure, here it is :)
>
> From 8cd3ba3a3f9702a89f8f52c75c33d3d02f20f60b Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Fri, 30 Dec 2016 16:27:27 +0100
> Subject: [PATCH 2/2] gnu: Add ocaml-bin-prot.
>
> * gnu/packages/ocaml.scm (ocaml-bin-prot): New variable.

Wait, I was commenting on ocaml-js-build-tools, not on ocaml-bin-prot:

  https://lists.gnu.org/archive/html/guix-devel/2017-01/threads.html#02134

Could it be that you’re replying to the wrong message?  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-30 22:23       ` Ludovic Courtès
@ 2017-01-30 22:48         ` Julien Lepiller
  2017-01-31  9:22           ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Julien Lepiller @ 2017-01-30 22:48 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2239 bytes --]

On Mon, 30 Jan 2017 23:23:27 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > On Mon, 30 Jan 2017 10:22:13 +0100
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >  
> >> Julien Lepiller <julien@lepiller.eu> skribis:
> >>   
> >> > +++ b/gnu/packages/patches/ocaml-janestreet-fix-libdir.patch
> >> > @@ -0,0 +1,39 @@
> >> > +This patch adds a --libdir option to opam-installer so it
> >> > installs the plugin +in the specified directory rather than in
> >> > the default one (ocaml's directory in +the store, which is
> >> > forbidden). +diff -aur package.pristine/Makefile
> >> > package.new/Makefile +--- package.pristine/Makefile
> >> > 2016-02-06 01:55:14.650150309 +0100 ++++
> >> > package.new/Makefile	2016-02-06 01:57:56.012174364 +0100
> >> > +@@ -29,26 +29,26 @@
> >> > + 	ocaml -I js-utils js-utils/gen_install.ml
> >> > +
> >> > + install: $(NAME).install
> >> > +-	opam-installer -i --prefix $(PREFIX) $(NAME).install
> >> > ++	opam-installer -i --prefix $(PREFIX) --libdir $(LIBDIR)
> >> > $(NAME).install +
> >> > + uninstall: $(NAME).install
> >> > +-	opam-installer -u --prefix $(PREFIX) $(NAME).install
> >> > ++	opam-installer -u --prefix $(PREFIX) --libdir $(LIBDIR)
> >> > $(NAME).install    
> >> 
> >> On second thought, I think it’d be simpler and more maintainable
> >> to do this as a substitution in the snippet.
> >> 
> >> WDYT?
> >> 
> >> (It will also avoid ‘guix lint’ complaints about the patch file
> >> name not matching the package name.  :-))
> >> 
> >> Ludo’.  
> >
> > Sure, here it is :)
> >
> > From 8cd3ba3a3f9702a89f8f52c75c33d3d02f20f60b Mon Sep 17 00:00:00
> > 2001 From: Julien Lepiller <julien@lepiller.eu>
> > Date: Fri, 30 Dec 2016 16:27:27 +0100
> > Subject: [PATCH 2/2] gnu: Add ocaml-bin-prot.
> >
> > * gnu/packages/ocaml.scm (ocaml-bin-prot): New variable.  
> 
> Wait, I was commenting on ocaml-js-build-tools, not on ocaml-bin-prot:
> 
>   https://lists.gnu.org/archive/html/guix-devel/2017-01/threads.html#02134
> 
> Could it be that you’re replying to the wrong message?  :-)
> 
> Ludo’.

I was replying to the correct message, but not with the correct patch.


[-- Attachment #2: 0001-gnu-Add-ocaml-js-build-tools.patch --]
[-- Type: text/x-patch, Size: 4049 bytes --]

From 96a8ec5f4ad68c14f49335bf58d27ef21c2419f7 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 27 Jan 2017 22:58:50 +0100
Subject: [PATCH 1/2] gnu: Add ocaml-js-build-tools.

* gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
* gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/packages/ocaml.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index ba0f5cd4c..6e1e745fe 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -66,6 +66,46 @@
                  (number->string file-number) "/" name "-" version
                  ".tar.gz"))
 
+;; Janestreet packages are found in a similar way and all need the same patch.
+(define (janestreet-origin name version hash)
+  (origin (method url-fetch)
+          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
+                              (version-major+minor version) "/files/"
+                              name "-" version ".tar.gz"))
+          (sha256 (base32 hash))
+          (modules '((guix build utils)))
+          (snippet
+           `(let ((pattern (string-append "lib/" ,name)))
+              ;; install.ml contains an invalid reference to the ppx file and
+              ;; propagates this error to the generated META file.  It
+              ;; looks for it in the "lib" directory, but it is installed in
+              ;; "lib/ocaml/site-lib/package".  This substitute does not change
+              ;; this file for non ppx packages.
+              (substitute* "install.ml"
+                           ((pattern)
+                            (string-append "lib/ocaml/site-lib/" ,name)))
+              ;; The standard Makefile would try to install janestreet modules
+              ;; in OCaml's directory in the store, which is read-only.
+              (substitute* "Makefile"
+                           (("--prefix")
+                            "--libdir $(LIBDIR) --prefix"))))))
+
+;; They also require almost the same set of arguments
+(define janestreet-arguments
+ `(#:use-make? #t
+   #:make-flags
+   (list (string-append "CONFIGUREFLAGS=--prefix "
+                        (assoc-ref %outputs "out")
+                        " --enable-tests")
+         (string-append "LIBDIR="
+                        (assoc-ref %outputs "out")
+                        "/lib/ocaml/site-lib")
+         ;; for ocaml-bin-prot, otherwise ignored
+         (string-append "OCAML_TOPLEVEL_PATH="
+                        (assoc-ref %build-inputs "findlib")
+                        "/lib/ocaml/site-lib"))
+   #:phases (modify-phases %standard-phases (delete 'configure))))
+
 (define-public ocaml
   (package
     (name "ocaml")
@@ -1942,3 +1982,25 @@ file (POSIX like) and filename.")
 system in your OCaml projects.  It helps to create standard entry points in your
 build system and allows external tools to analyse your project easily.")
     (license license:lgpl2.1))) ; with ocaml static compilation exception
+
+(define-public ocaml-js-build-tools
+  (package
+    (name "ocaml-js-build-tools")
+    (version "113.33.06")
+    (source (janestreet-origin "js-build-tools" version
+              "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
+    (native-inputs
+     `(("oasis" ,ocaml-oasis)
+       ("opam" ,opam)))
+    (build-system ocaml-build-system)
+    (arguments janestreet-arguments)
+    (home-page "https://github.com/janestreet/js-build-tools")
+    (synopsis "Collection of tools to help building Jane Street Packages")
+    (description "This package contains tools to help building Jane Street
+packages, but can be used for other purposes.  It contains:
+@enumerate
+@item an @command{oasis2opam-install} tool to produce a @file{.install} file
+from the oasis build log
+@item a @code{js_build_tools} ocamlbuild plugin with various goodies.
+@end enumerate")
+    (license license:asl2.0)))
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] gnu: Add ocaml-js-build-tools.
  2017-01-30 22:48         ` Julien Lepiller
@ 2017-01-31  9:22           ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2017-01-31  9:22 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Julien Lepiller <julien@lepiller.eu> skribis:

> I was replying to the correct message, but not with the correct patch.

OK.  :-)

> From 96a8ec5f4ad68c14f49335bf58d27ef21c2419f7 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Fri, 27 Jan 2017 22:58:50 +0100
> Subject: [PATCH 1/2] gnu: Add ocaml-js-build-tools.
>
> * gnu/packages/ocaml.scm (ocaml-js-build-tools): New variable.
> * gnu/packages/patches/ocaml-janestreet-fix-libdir.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

[...]

> +          (snippet
> +           `(let ((pattern (string-append "lib/" ,name)))
> +              ;; install.ml contains an invalid reference to the ppx file and
> +              ;; propagates this error to the generated META file.  It
> +              ;; looks for it in the "lib" directory, but it is installed in
> +              ;; "lib/ocaml/site-lib/package".  This substitute does not change
> +              ;; this file for non ppx packages.
> +              (substitute* "install.ml"
> +                           ((pattern)
> +                            (string-append "lib/ocaml/site-lib/" ,name)))
> +              ;; The standard Makefile would try to install janestreet modules
> +              ;; in OCaml's directory in the store, which is read-only.
> +              (substitute* "Makefile"
> +                           (("--prefix")
> +                            "--libdir $(LIBDIR) --prefix"))))))

For ‘pattern’ to be a literal in the snippet, it needs to be moved it
outside of the quasiquote:

  (let ((pattern (string-append "lib/" name)))
    `(begin
       (substitute* foo
         ((,pattern) …))))

Also could you adjust the indentation of ‘substitute*’?

OK with these changes.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-01-31  9:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 20:27 [PATCH 00/10] ocaml patches Julien Lepiller
2017-01-18 20:27 ` [PATCH 01/10] gnu: Add ocaml-base64 Julien Lepiller
2017-01-18 20:27 ` [PATCH 02/10] gnu: Add ocamlify Julien Lepiller
2017-01-18 20:27 ` [PATCH 03/10] gnu: Add omake Julien Lepiller
2017-01-18 22:00   ` Marius Bakke
2017-01-18 20:27 ` [PATCH 04/10] gnu: Add ocaml-batteries Julien Lepiller
2017-01-18 20:27 ` [PATCH 05/10] gnu: Add ocaml-pcre Julien Lepiller
2017-01-18 20:27 ` [PATCH 06/10] gnu: Add ocaml-expect Julien Lepiller
2017-01-18 20:27 ` [PATCH 07/10] gnu: Add ocaml-fileutils Julien Lepiller
2017-01-18 20:28 ` [PATCH 08/10] gnu: Add ocaml-oasis Julien Lepiller
2017-01-18 22:14   ` Marius Bakke
2017-01-18 20:28 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
2017-01-18 22:21   ` Marius Bakke
2017-01-20 13:28     ` Ludovic Courtès
2017-01-18 20:28 ` [PATCH 10/10] gnu: Add ocaml-bin-prot Julien Lepiller
2017-01-18 22:27 ` [PATCH 00/10] ocaml patches Marius Bakke
2017-01-19  8:56   ` Julien Lepiller
  -- strict thread matches above, loose matches on Subject: below --
2017-01-27 22:12 [PATCH 00/10] ocaml patches v2 Julien Lepiller
2017-01-27 22:12 ` [PATCH 09/10] gnu: Add ocaml-js-build-tools Julien Lepiller
2017-01-30  9:19   ` Ludovic Courtès
2017-01-30  9:22   ` Ludovic Courtès
2017-01-30 21:08     ` Julien Lepiller
2017-01-30 22:23       ` Ludovic Courtès
2017-01-30 22:48         ` Julien Lepiller
2017-01-31  9:22           ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).