doc: "filesystem" -> "file system"
[jackhill/guix/guix.git] / gnu / packages / ocaml.scm
index 12d813f..f6f7308 100644 (file)
@@ -2,6 +2,9 @@
 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
+;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module ((guix licenses) #:hide (zlib))
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix svn-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages base)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages xorg)
-  #:use-module (gnu packages texlive)
+  #:use-module (gnu packages tex)
+  #:use-module (gnu packages ghostscript)
+  #:use-module (gnu packages lynx)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages m4)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages curl))
                     "/ocaml-" version ".tar.xz"))
               (sha256
                (base32
-                "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3"))))
+                "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3"))
+              (patches (search-patches "ocaml-CVE-2015-8869.patch"))))
     (build-system gnu-build-system)
+    (native-search-paths
+     (list (search-path-specification
+            (variable "OCAMLPATH")
+            (files (list (string-append "lib/ocaml"))))))
     (native-inputs
      `(("perl" ,perl)
        ("pkg-config" ,pkg-config)))
@@ -135,7 +149,7 @@ functional, imperative and object-oriented styles of programming.")
 (define-public opam
   (package
     (name "opam")
-    (version "1.1.1")
+    (version "1.2.2")
     (source (origin
               (method url-fetch)
               ;; Use the '-full' version, which includes all the dependencies.
@@ -147,7 +161,7 @@ functional, imperative and object-oriented styles of programming.")
                )
               (sha256
                (base32
-                "1frzqkx6yn1pnyd9qz3bv3rbwv74bmc1xji8kl41r1dkqzfl3xqv"))))
+                "004gwn6rbpcb53y3rpb3v23vk39rp2xmf0liyd5iy12ij8bigrhm"))))
     (build-system gnu-build-system)
     (arguments
      '(;; Sometimes, 'make -jX' would fail right after ./configure with
@@ -155,30 +169,34 @@ functional, imperative and object-oriented styles of programming.")
        #:parallel-build? #f
 
        ;; For some reason, 'ocp-build' needs $TERM to be set.
-       #:make-flags '("TERM=screen")
+       #:make-flags `("TERM=screen"
+                      ,(string-append "SHELL="
+                                      (assoc-ref %build-inputs "bash")
+                                      "/bin/sh"))
        #:test-target "tests"
 
        ;; FIXME: There's an obscure test failure:
        ;;   …/_obuild/opam/opam.asm install P1' failed.
        #:tests? #f
 
-       #:phases (alist-cons-before
-                 'build 'pre-build
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((bash (assoc-ref inputs "bash")))
-                     (substitute* "src/core/opamSystem.ml"
-                       (("\"/bin/sh\"")
-                        (string-append "\"" bash "/bin/sh\"")))))
-                 (alist-cons-before
-                  'check 'pre-check
-                  (lambda _
-                    (setenv "HOME" (getcwd))
-                    (and (system "git config --global user.email guix@gnu.org")
-                         (system "git config --global user.name Guix")))
-                  %standard-phases))))
+       #:phases (modify-phases %standard-phases
+                 (add-before 'build 'pre-build
+                   (lambda* (#:key inputs make-flags #:allow-other-keys)
+                     (let ((bash (assoc-ref inputs "bash")))
+                       (substitute* "src/core/opamSystem.ml"
+                         (("\"/bin/sh\"")
+                          (string-append "\"" bash "/bin/sh\"")))
+                       ;; Build dependencies
+                       (zero? (apply system* "make" "lib-ext" make-flags)))))
+                 (add-before 'check 'pre-check
+                   (lambda _
+                     (setenv "HOME" (getcwd))
+                     (and (system "git config --global user.email guix@gnu.org")
+                          (system "git config --global user.name Guix")))))))
     (native-inputs
      `(("git" ,git)                               ;for the tests
-       ("python" ,python)))                       ;for the tests
+       ("python" ,python)                         ;for the tests
+       ("camlp4" ,camlp4)))
     (inputs
      `(("ocaml" ,ocaml)
        ("ncurses" ,ncurses)
@@ -196,14 +214,14 @@ Git-friendly development workflow.")
 (define-public camlp4
   (package
     (name "camlp4")
-    (version "4.02.0+1")
+    (version "4.02+6")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/ocaml/camlp4/archive/"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "0055f4jiz82rgn581xhq3mr4qgq2qgdxqppmp8i2x1xnsim4h9pn"))
+                "0icdfzhsbgf89925gc8gl3fm8z2xzszzlib0v9dj5wyzkyv3a342"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system gnu-build-system)
     (native-inputs `(("ocaml" ,ocaml)
@@ -238,14 +256,14 @@ syntax of OCaml.")
 (define-public camlp5
   (package
     (name "camlp5")
-    (version "6.12")
+    (version "6.14")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://camlp5.gforge.inria.fr/distrib/src/"
                                   name "-" version ".tgz"))
               (sha256
                (base32
-                "00jwgp6w4g64lfqjx77xziy532091fy00c42fsy0b4i892rch5mp"))))
+                "1ql04iyvclpyy9805kpddc4ndjb5d0qg4shhi2fc6bixi49fvy89"))))
     (build-system gnu-build-system)
     (inputs
      `(("ocaml" ,ocaml)))
@@ -279,14 +297,14 @@ concrete syntax of the language (Quotations, Syntax Extensions).")
 (define-public hevea
   (package
     (name "hevea")
-    (version "2.23")
+    (version "2.28")
     (source (origin
               (method url-fetch)
-              (uri (string-append "http://hevea.inria.fr/distri/"
+              (uri (string-append "http://hevea.inria.fr/old/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1f9pj48518ixhjxbviv2zx27v4anp92zgg3x704g1s5cki2w33nv"))))
+                "14fns13wlnpiv9i05841kvi3cq4b9v2sw5x3ff6ziws28q701qnd"))))
     (build-system gnu-build-system)
     (inputs
      `(("ocaml" ,ocaml)))
@@ -294,7 +312,12 @@ concrete syntax of the language (Quotations, Syntax Extensions).")
      `(#:tests? #f  ; no test suite
        #:make-flags (list (string-append "PREFIX=" %output))
        #:phases (modify-phases %standard-phases
-                  (delete 'configure))))
+                  (delete 'configure)
+                  (add-before 'build 'patch-/bin/sh
+                    (lambda _
+                      (substitute* "_tags"
+                        (("/bin/sh") (which "sh")))
+                      #t)))))
     (home-page "http://hevea.inria.fr/")
     (synopsis "LaTeX to HTML translator")
     (description
@@ -367,7 +390,7 @@ It is developed using Objective Caml and Camlp5.")
     (build-system gnu-build-system)
     (native-inputs
      `(("which" ,which)
-       ("emacs" ,emacs-no-x)
+       ("emacs" ,emacs-minimal)
        ("texinfo" ,texinfo)))
     (inputs
      `(("host-emacs" ,emacs)
@@ -430,22 +453,131 @@ assistant to write formal mathematical proofs using a variety of theorem
 provers.")
     (license gpl2+)))
 
-(define-public unison
+(define-public lablgtk
   (package
-    (name "unison")
-    (version "2.48.3")
+    (name "lablgtk")
+    (version "2.18.3")
     (source
       (origin
         (method url-fetch)
-          (uri (string-append "https://www.seas.upenn.edu/~bcpierce/unison/"
-                              "download/releases/stable/unison-" version
-                              ".tar.gz"))
+          (uri (string-append "https://forge.ocamlcore.org/frs/download.php/"
+                              "1479/lablgtk-2.18.3.tar.gz"))
           (sha256
             (base32
-              "10sln52rnnsj213jy3166m0q97qpwnrwl6mm529xfy10x3xkq3gl"))))
+              "1bybn3jafxf4cx25zvn8h2xj9agn1xjbn7j3ywxxqx6az7rfnnwp"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)))
+     `(("camlp4" ,camlp4)
+       ("ocaml" ,ocaml)
+       ("pkg-config" ,pkg-config)))
+    ;; FIXME: Add inputs gtkgl-2.0, libpanelapplet-2.0, gtkspell-2.0,
+    ;; and gtk+-quartz-2.0 once available.
+    (inputs
+     `(("gtk+" ,gtk+-2)
+       ("gtksourceview" ,gtksourceview-2)
+       ("libgnomecanvas" ,libgnomecanvas)
+       ("libgnomeui" ,libgnomeui)
+       ("libglade" ,libglade)
+       ("librsvg" ,librsvg)))
+    (arguments
+     `(#:tests? #f ; no check target
+
+       ;; opt: also install cmxa files
+       #:make-flags (list "all" "opt")
+       ;; Occasionally we would get "Error: Unbound module GtkThread" when
+       ;; compiling 'gtkThInit.ml', with 'make -j'.  So build sequentially.
+       #:parallel-build? #f
+
+       #:phases
+         (modify-phases %standard-phases
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (ocaml (assoc-ref inputs "ocaml")))
+                 ;; Install into the output and not the ocaml directory.
+                 (substitute* "config.make"
+                   ((ocaml) out))
+                 (system* "make" "old-install")
+                 #t))))))
+    (home-page "http://lablgtk.forge.ocamlcore.org/")
+    (synopsis "GTK+ bindings for OCaml")
+    (description
+     "LablGtk is an OCaml interface to GTK+ 1.2 and 2.x.  It provides
+a strongly-typed object-oriented interface that is compatible with the
+dynamic typing of GTK+.  Most widgets and methods are available.  LablGtk
+also provides bindings to
+gdk-pixbuf, the GLArea widget (in combination with LablGL), gnomecanvas,
+gnomeui, gtksourceview, gtkspell,
+libglade (and it an generate OCaml code from .glade files),
+libpanel, librsvg and quartz.")
+    (license lgpl2.1)))
+
+(define-public unison
+  (package
+    (name "unison")
+    (version "2.48.3")
+    (source
+      (origin
+        (method svn-fetch)
+        (uri (svn-reference
+              (url (string-append "https://webdav.seas.upenn.edu/svn/"
+                                  "unison/branches/"
+                                  (version-major+minor version)))
+              (revision 535)))
+        (file-name (string-append name "-" version "-checkout"))
+        (sha256
+         (base32
+          "0486s53wyayicj9f2raj2dvwvk4xyzar219rccc1iczdwixm4x05"))
+        (modules '((guix build utils)
+                   (ice-9 rdelim)
+                   (ice-9 regex)
+                   (srfi srfi-1)))
+        (snippet
+         `(begin
+            ;; The svn revision in the release tarball appears to be
+            ;; artificially manipulated in order to set the desired point
+            ;; version number.  Because the point version is calculated during
+            ;; the build, we can offset pointVersionOrigin by the desired
+            ;; point version and write that into "Rev: %d".  We do this rather
+            ;; than hardcoding the necessary revision number, for
+            ;; maintainability.
+            (with-atomic-file-replacement "src/mkProjectInfo.ml"
+              (lambda (in out)
+                (let ((pt-ver (string->number (third (string-split ,version #\.))))
+                      (pt-rx  (make-regexp "^let pointVersionOrigin = ([0-9]+)"))
+                      (rev-rx (make-regexp "Rev: [0-9]+")))
+                  (let loop ((pt-origin #f))
+                    (let ((line (read-line in 'concat)))
+                      (cond
+                       ((regexp-exec pt-rx line)
+                        => (lambda (m)
+                             (display line out)
+                             (loop (string->number (match:substring m 1)))))
+                       ((regexp-exec rev-rx line)
+                        => (lambda (m)
+                             (format out "~aRev: ~d~a"
+                                     (match:prefix m)
+                                     (+ pt-origin pt-ver)
+                                     (match:suffix m))
+                             (dump-port in out))) ;done
+                       (else
+                        (display line out)
+                        (loop pt-origin))))))))
+            ;; Without the '-fix' argument, the html file produced does not
+            ;; have functioning internal hyperlinks.
+            (substitute* "doc/Makefile"
+              (("hevea unison") "hevea -fix unison"))))))
+    (build-system gnu-build-system)
+    (outputs '("out"
+               "doc"))                  ; 1.9 MiB of documentation
+    (native-inputs
+     `(("ocaml" ,ocaml)
+       ;; For documentation
+       ("ghostscript-gs" ,ghostscript-gs)
+       ("ghostscript" ,ghostscript)
+       ("texlive" ,texlive)
+       ("hevea" ,hevea)
+       ("lynx" ,lynx)))
     (arguments
      `(#:parallel-build? #f
        #:parallel-tests? #f
@@ -462,7 +594,36 @@ provers.")
                       (bin (string-append out "/bin")))
                  (mkdir-p bin)
                  (setenv "HOME" out) ; forces correct INSTALLDIR in Makefile
-                 #t))))))
+                 #t)))
+           (add-after 'install 'install-fsmonitor
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (bin (string-append out "/bin")))
+                 ;; 'unison-fsmonitor' is used in "unison -repeat watch" mode.
+                 (install-file "src/unison-fsmonitor" bin))))
+           (add-after 'install 'install-doc
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((doc (string-append (assoc-ref outputs "doc")
+                                         "/share/doc/unison")))
+                 (mkdir-p doc)
+                 ;; This file needs write-permissions, because it's
+                 ;; overwritten by 'docs' during documentation generation.
+                 (chmod "src/strings.ml" #o600)
+                 (and (zero? (system* "make" "docs"
+                                      "TEXDIRECTIVES=\\\\draftfalse"))
+                      (begin
+                        (for-each (lambda (f)
+                                    (install-file f doc))
+                                  (map (lambda (ext)
+                                         (string-append
+                                          "doc/unison-manual." ext))
+                                       ;; Install only html documentation,
+                                       ;; since the build is currently
+                                       ;; non-reproducible with the ps, pdf,
+                                       ;; and dvi docs.
+                                       '(;;"ps" "pdf" "dvi"
+                                         "html")))
+                        #t))))))))
     (home-page "https://www.cis.upenn.edu/~bcpierce/unison/")
     (synopsis "File synchronizer")
     (description
@@ -472,3 +633,51 @@ a collection of files and directories to be stored on different hosts
 brought up to date by propagating the changes in each replica
 to the other.")
     (license gpl3+)))
+
+(define-public ocaml-findlib
+  (package
+    (name "ocaml-findlib")
+    (version "1.6.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.camlcity.org/download/"
+                                  "findlib" "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "02abg1lsnwvjg3igdyb8qjgr5kv1nbwl4gaf8mdinzfii5p82721"))
+              (patches (search-patches "ocaml-findlib-make-install.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("camlp4" ,camlp4)
+       ("m4" ,m4)
+       ("ocaml" ,ocaml)))
+    (arguments
+     `(#:tests? #f  ; no test suite
+       #:parallel-build? #f
+       #:make-flags (list "all" "opt")
+       #:phases (modify-phases %standard-phases
+                  (replace
+                   'configure
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let ((out (assoc-ref outputs "out")))
+                       (system*
+                        "./configure"
+                        "-bindir" (string-append out "/bin")
+                        "-config" (string-append out "/etc/ocamfind.conf")
+                        "-mandir" (string-append out "/share/man")
+                        "-sitelib" (string-append out "/lib/ocaml/site-lib")
+                        "-with-toolbox")))))))
+    (home-page "http://projects.camlcity.org/projects/findlib.html")
+    (synopsis "Management tool for OCaml libraries")
+    (description
+     "The \"findlib\" library provides a scheme to manage reusable software
+components (packages), and includes tools that support this scheme.  Packages
+are collections of OCaml modules for which metainformation can be stored.  The
+packages are kept in the file system hierarchy, but with strict directory
+structure.  The library contains functions to look the directory up that
+stores a package, to query metainformation about a package, and to retrieve
+dependency information about multiple packages.  There is also a tool that
+allows the user to enter queries on the command-line.  In order to simplify
+compilation and linkage, there are new frontends of the various OCaml
+compilers that can directly deal with packages.")
+    (license x11)))