gnu: Add python-click-log.
[jackhill/guix/guix.git] / gnu / packages / ocaml.scm
CommitLineData
d192efae
CR
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
69b8f08c 3;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
b9d8756b 4;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
c900f843 5;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
d192efae
CR
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages ocaml)
69b8f08c 23 #:use-module ((guix licenses) #:hide (zlib))
d192efae
CR
24 #:use-module (guix packages)
25 #:use-module (guix download)
69b8f08c 26 #:use-module (guix utils)
d192efae
CR
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
2f6d3e41 29 #:use-module (gnu packages gcc)
3573b634
AE
30 #:use-module (gnu packages gnome)
31 #:use-module (gnu packages gtk)
0705f79c
MW
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages emacs)
34 #:use-module (gnu packages texinfo)
69b8f08c
MW
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages compression)
69b8f08c 37 #:use-module (gnu packages xorg)
1973183b 38 #:use-module (gnu packages texlive)
a34cedc4
LC
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages ncurses)
42 #:use-module (gnu packages version-control)
43 #:use-module (gnu packages curl))
d192efae
CR
44
45(define-public ocaml
46 (package
47 (name "ocaml")
be78e52c 48 (version "4.02.3")
d192efae 49 (source (origin
69b8f08c
MW
50 (method url-fetch)
51 (uri (string-append
52 "http://caml.inria.fr/pub/distrib/ocaml-"
53 (version-major+minor version)
54 "/ocaml-" version ".tar.xz"))
55 (sha256
56 (base32
be78e52c 57 "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3"))))
d192efae 58 (build-system gnu-build-system)
69b8f08c
MW
59 (native-inputs
60 `(("perl" ,perl)
61 ("pkg-config" ,pkg-config)))
62 (inputs
63 `(("libx11" ,libx11)
2f6d3e41 64 ;; For libiberty, needed for objdump support.
379d4142 65 ("gcc:lib" ,(canonical-package gcc-4.9) "lib")
2f6d3e41 66 ("zlib" ,zlib))) ;also needed for objdump support
d192efae 67 (arguments
69b8f08c
MW
68 `(#:modules ((guix build gnu-build-system)
69 (guix build utils)
70 (web server))
71 #:phases
72 (modify-phases %standard-phases
73 (add-after 'unpack 'patch-/bin/sh-references
74 (lambda* (#:key inputs #:allow-other-keys)
75 (let* ((sh (string-append (assoc-ref inputs "bash")
76 "/bin/sh"))
77 (quoted-sh (string-append "\"" sh "\"")))
78 (with-fluids ((%default-port-encoding #f))
79 (for-each (lambda (file)
80 (substitute* file
81 (("\"/bin/sh\"")
82 (begin
83 (format (current-error-port) "\
84patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
85 file quoted-sh)
86 quoted-sh))))
87 (find-files "." "\\.ml$"))
88 #t))))
89 (replace 'configure
90 (lambda* (#:key outputs #:allow-other-keys)
91 (let* ((out (assoc-ref outputs "out"))
92 (mandir (string-append out "/share/man")))
93 ;; Custom configure script doesn't recognize
94 ;; --prefix=<PREFIX> syntax (with equals sign).
95 (zero? (system* "./configure"
96 "--prefix" out
97 "--mandir" mandir)))))
98 (replace 'build
99 (lambda _
100 (zero? (system* "make" "-j" (number->string
101 (parallel-job-count))
102 "world.opt"))))
103 (delete 'check)
104 (add-after 'install 'check
105 (lambda _
106 (with-directory-excursion "testsuite"
107 (zero? (system* "make" "all")))))
108 (add-before 'check 'prepare-socket-test
109 (lambda _
110 (format (current-error-port)
111 "Spawning local test web server on port 8080~%")
112 (when (zero? (primitive-fork))
113 (run-server (lambda (request request-body)
114 (values '((content-type . (text/plain)))
115 "Hello!"))
116 'http '(#:port 8080)))
117 (let ((file "testsuite/tests/lib-threads/testsocket.ml"))
118 (format (current-error-port)
119 "Patching ~a to use localhost port 8080~%"
120 file)
121 (substitute* file
122 (("caml.inria.fr") "localhost")
123 (("80") "8080")
124 (("HTTP1.0") "HTTP/1.0"))
125 #t))))))
126 (home-page "https://ocaml.org/")
d192efae
CR
127 (synopsis "The OCaml programming language")
128 (description
129 "OCaml is a general purpose industrial-strength programming language with
35b9e423 130an emphasis on expressiveness and safety. Developed for more than 20 years at
d192efae
CR
131Inria it benefits from one of the most advanced type systems and supports
132functional, imperative and object-oriented styles of programming.")
69b8f08c
MW
133 ;; The compiler is distributed under qpl1.0 with a change to choice of
134 ;; law: the license is governed by the laws of France. The library is
135 ;; distributed under lgpl2.0.
136 (license (list qpl lgpl2.0))))
a34cedc4
LC
137
138(define-public opam
139 (package
140 (name "opam")
141 (version "1.1.1")
142 (source (origin
143 (method url-fetch)
144 ;; Use the '-full' version, which includes all the dependencies.
145 (uri (string-append
146 "https://github.com/ocaml/opam/releases/download/"
147 version "/opam-full-" version ".tar.gz")
148 ;; (string-append "https://github.com/ocaml/opam/archive/"
149 ;; version ".tar.gz")
150 )
151 (sha256
152 (base32
153 "1frzqkx6yn1pnyd9qz3bv3rbwv74bmc1xji8kl41r1dkqzfl3xqv"))))
154 (build-system gnu-build-system)
155 (arguments
156 '(;; Sometimes, 'make -jX' would fail right after ./configure with
157 ;; "Fatal error: exception End_of_file".
158 #:parallel-build? #f
159
160 ;; For some reason, 'ocp-build' needs $TERM to be set.
161 #:make-flags '("TERM=screen")
162 #:test-target "tests"
163
164 ;; FIXME: There's an obscure test failure:
165 ;; …/_obuild/opam/opam.asm install P1' failed.
166 #:tests? #f
167
168 #:phases (alist-cons-before
169 'build 'pre-build
170 (lambda* (#:key inputs #:allow-other-keys)
171 (let ((bash (assoc-ref inputs "bash")))
172 (substitute* "src/core/opamSystem.ml"
173 (("\"/bin/sh\"")
174 (string-append "\"" bash "/bin/sh\"")))))
175 (alist-cons-before
176 'check 'pre-check
177 (lambda _
178 (setenv "HOME" (getcwd))
179 (and (system "git config --global user.email guix@gnu.org")
180 (system "git config --global user.name Guix")))
181 %standard-phases))))
182 (native-inputs
183 `(("git" ,git) ;for the tests
184 ("python" ,python))) ;for the tests
185 (inputs
186 `(("ocaml" ,ocaml)
187 ("ncurses" ,ncurses)
188 ("curl" ,curl)))
189 (home-page "http://opam.ocamlpro.com/")
190 (synopsis "Package manager for OCaml")
191 (description
192 "OPAM is a tool to manage OCaml packages. It supports multiple
193simultaneous compiler installations, flexible package constraints, and a
194Git-friendly development workflow.")
195
196 ;; The 'LICENSE' file waives some requirements compared to LGPLv3.
197 (license lgpl3)))
83f4dc36 198
492ee988
LC
199(define-public camlp4
200 (package
201 (name "camlp4")
006faa35 202 (version "4.02+6")
492ee988
LC
203 (source (origin
204 (method url-fetch)
205 (uri (string-append "https://github.com/ocaml/camlp4/archive/"
206 version ".tar.gz"))
207 (sha256
208 (base32
006faa35 209 "0icdfzhsbgf89925gc8gl3fm8z2xzszzlib0v9dj5wyzkyv3a342"))
492ee988
LC
210 (file-name (string-append name "-" version ".tar.gz"))))
211 (build-system gnu-build-system)
fd5b2133 212 (native-inputs `(("ocaml" ,ocaml)
0d1c0660 213 ("which" ,which)))
492ee988
LC
214 (inputs `(("ocaml" ,ocaml)))
215 (arguments
216 '(#:tests? #f ;no documented test target
217 #:phases (modify-phases %standard-phases
218 (replace
219 'configure
220 (lambda* (#:key outputs #:allow-other-keys)
221 ;; This is a home-made 'configure' script.
222 (let ((out (assoc-ref outputs "out")))
223 (zero? (system* "./configure"
224 (string-append "--libdir=" out "/lib")
225 (string-append "--bindir=" out "/bin")
226 (string-append "--pkgdir=" out)))))))))
227 (home-page "https://github.com/ocaml/camlp4")
228 (synopsis "Write parsers in OCaml")
229 (description
230 "Camlp4 is a software system for writing extensible parsers for
231programming languages. It provides a set of OCaml libraries that are used to
232define grammars as well as loadable syntax extensions of such grammars.
233Camlp4 stands for Caml Preprocessor and Pretty-Printer and one of its most
234important applications is the definition of domain-specific extensions of the
235syntax of OCaml.")
236
237 ;; This is LGPLv2 with an exception that allows packages statically-linked
238 ;; against the library to be released under any terms.
239 (license lgpl2.0)))
240
83f4dc36
MW
241(define-public camlp5
242 (package
243 (name "camlp5")
d4bf3dac 244 (version "6.14")
83f4dc36
MW
245 (source (origin
246 (method url-fetch)
247 (uri (string-append "http://camlp5.gforge.inria.fr/distrib/src/"
248 name "-" version ".tgz"))
249 (sha256
250 (base32
d4bf3dac 251 "1ql04iyvclpyy9805kpddc4ndjb5d0qg4shhi2fc6bixi49fvy89"))))
83f4dc36
MW
252 (build-system gnu-build-system)
253 (inputs
254 `(("ocaml" ,ocaml)))
255 (arguments
256 `(#:tests? #f ; XXX TODO figure out how to run the tests
257 #:phases
258 (modify-phases %standard-phases
259 (replace 'configure
260 (lambda* (#:key outputs #:allow-other-keys)
261 (let* ((out (assoc-ref outputs "out"))
262 (mandir (string-append out "/share/man")))
263 ;; Custom configure script doesn't recognize
264 ;; --prefix=<PREFIX> syntax (with equals sign).
265 (zero? (system* "./configure"
266 "--prefix" out
267 "--mandir" mandir)))))
268 (replace 'build
269 (lambda _
270 (zero? (system* "make" "-j" (number->string
271 (parallel-job-count))
272 "world.opt")))))))
273 (home-page "http://camlp5.gforge.inria.fr/")
274 (synopsis "Pre-processor Pretty Printer for OCaml")
275 (description
276 "Camlp5 is a Pre-Processor-Pretty-Printer for Objective Caml. It offers
277tools for syntax (Stream Parsers and Grammars) and the ability to modify the
278concrete syntax of the language (Quotations, Syntax Extensions).")
279 ;; Most files are distributed under bsd-3, but ocaml_stuff/* is under qpl.
280 (license (list bsd-3 qpl))))
d6b7b5ed
MW
281
282(define-public hevea
283 (package
284 (name "hevea")
285 (version "2.23")
286 (source (origin
287 (method url-fetch)
8f26f239 288 (uri (string-append "http://hevea.inria.fr/old/"
d6b7b5ed
MW
289 name "-" version ".tar.gz"))
290 (sha256
291 (base32
292 "1f9pj48518ixhjxbviv2zx27v4anp92zgg3x704g1s5cki2w33nv"))))
293 (build-system gnu-build-system)
294 (inputs
295 `(("ocaml" ,ocaml)))
296 (arguments
297 `(#:tests? #f ; no test suite
298 #:make-flags (list (string-append "PREFIX=" %output))
299 #:phases (modify-phases %standard-phases
300 (delete 'configure))))
301 (home-page "http://hevea.inria.fr/")
302 (synopsis "LaTeX to HTML translator")
303 (description
304 "HeVeA is a LaTeX to HTML translator that generates modern HTML 5. It is
305written in Objective Caml.")
306 (license qpl)))
1973183b
MW
307
308(define-public coq
309 (package
310 (name "coq")
311 (version "8.4pl6")
312 (source (origin
313 (method url-fetch)
314 (uri (string-append "https://coq.inria.fr/distrib/V" version
315 "/files/" name "-" version ".tar.gz"))
316 (sha256
317 (base32
318 "1mpbj4yf36kpjg2v2sln12i8dzqn8rag6fd07hslj2lpm4qs4h55"))))
319 (build-system gnu-build-system)
320 (native-inputs
321 `(("texlive" ,texlive)
322 ("hevea" ,hevea)))
323 (inputs
324 `(("ocaml" ,ocaml)
325 ("camlp5" ,camlp5)))
326 (arguments
327 `(#:phases
328 (modify-phases %standard-phases
329 (replace 'configure
330 (lambda* (#:key outputs #:allow-other-keys)
331 (let* ((out (assoc-ref outputs "out"))
332 (mandir (string-append out "/share/man"))
333 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
334 (zero? (system* "./configure"
335 "--prefix" out
336 "--mandir" mandir
337 "--browser" browser)))))
338 (replace 'build
339 (lambda _
340 (zero? (system* "make" "-j" (number->string
341 (parallel-job-count))
342 "world"))))
343 (delete 'check)
344 (add-after 'install 'check
345 (lambda _
346 (with-directory-excursion "test-suite"
347 (zero? (system* "make"))))))))
348 (home-page "https://coq.inria.fr")
349 (synopsis "Proof assistant for higher-order logic")
350 (description
351 "Coq is a proof assistant for higher-order logic, which allows the
352development of computer programs consistent with their formal specification.
353It is developed using Objective Caml and Camlp5.")
354 ;; The code is distributed under lgpl2.1.
355 ;; Some of the documentation is distributed under opl1.0+.
356 (license (list lgpl2.1 opl1.0+))))
0705f79c
MW
357
358(define-public proof-general
359 (package
360 (name "proof-general")
361 (version "4.2")
362 (source (origin
363 (method url-fetch)
364 (uri (string-append
365 "http://proofgeneral.inf.ed.ac.uk/releases/"
366 "ProofGeneral-" version ".tgz"))
367 (sha256
368 (base32
369 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
370 (build-system gnu-build-system)
371 (native-inputs
372 `(("which" ,which)
373 ("emacs" ,emacs-no-x)
374 ("texinfo" ,texinfo)))
375 (inputs
376 `(("host-emacs" ,emacs)
377 ("perl" ,perl)
378 ("coq" ,coq)))
379 (arguments
380 `(#:tests? #f ; no check target
381 #:make-flags (list (string-append "PREFIX=" %output)
382 (string-append "DEST_PREFIX=" %output))
383 #:modules ((guix build gnu-build-system)
384 (guix build utils)
385 (guix build emacs-utils))
386 #:imported-modules (,@%gnu-build-system-modules
387 (guix build emacs-utils))
388 #:phases
389 (modify-phases %standard-phases
390 (delete 'configure)
391 (add-after 'unpack 'disable-byte-compile-error-on-warn
392 (lambda _
393 (substitute* "Makefile"
394 (("\\(setq byte-compile-error-on-warn t\\)")
395 "(setq byte-compile-error-on-warn nil)"))
396 #t))
397 (add-after 'unpack 'patch-hardcoded-paths
398 (lambda* (#:key inputs outputs #:allow-other-keys)
399 (let ((out (assoc-ref outputs "out"))
400 (coq (assoc-ref inputs "coq"))
401 (emacs (assoc-ref inputs "host-emacs")))
402 (define (coq-prog name)
403 (string-append coq "/bin/" name))
404 (emacs-substitute-variables "coq/coq.el"
405 ("coq-prog-name" (coq-prog "coqtop"))
406 ("coq-compiler" (coq-prog "coqc"))
407 ("coq-dependency-analyzer" (coq-prog "coqdep")))
408 (substitute* "Makefile"
409 (("/sbin/install-info") "install-info"))
410 (substitute* "bin/proofgeneral"
411 (("^PGHOMEDEFAULT=.*" all)
412 (string-append all
413 "PGHOME=$PGHOMEDEFAULT\n"
414 "EMACS=" emacs "/bin/emacs")))
415 #t)))
416 (add-after 'unpack 'clean
417 (lambda _
418 ;; Delete the pre-compiled elc files for Emacs 23.
419 (zero? (system* "make" "clean"))))
420 (add-after 'install 'install-doc
421 (lambda* (#:key make-flags #:allow-other-keys)
422 ;; XXX FIXME avoid building/installing pdf files,
423 ;; due to unresolved errors building them.
424 (substitute* "Makefile"
425 ((" [^ ]*\\.pdf") ""))
426 (zero? (apply system* "make" "install-doc"
427 make-flags)))))))
428 (home-page "http://proofgeneral.inf.ed.ac.uk/")
e881752c
AK
429 (synopsis "Generic front-end for proof assistants based on Emacs")
430 (description
0705f79c
MW
431 "Proof General is a major mode to turn Emacs into an interactive proof
432assistant to write formal mathematical proofs using a variety of theorem
433provers.")
434 (license gpl2+)))
b9d8756b 435
3573b634
AE
436(define-public lablgtk
437 (package
438 (name "lablgtk")
439 (version "2.18.3")
440 (source
441 (origin
442 (method url-fetch)
443 (uri (string-append "https://forge.ocamlcore.org/frs/download.php/"
444 "1479/lablgtk-2.18.3.tar.gz"))
445 (sha256
446 (base32
447 "1bybn3jafxf4cx25zvn8h2xj9agn1xjbn7j3ywxxqx6az7rfnnwp"))))
448 (build-system gnu-build-system)
449 (native-inputs
450 `(("camlp4" ,camlp4)
451 ("ocaml" ,ocaml)
452 ("pkg-config" ,pkg-config)))
453 ;; FIXME: Add inputs gtkgl-2.0, libpanelapplet-2.0, gtkspell-2.0,
454 ;; and gtk+-quartz-2.0 once available.
455 (inputs
456 `(("gtk+" ,gtk+-2)
c900f843 457 ("gtksourceview" ,gtksourceview-2)
3573b634
AE
458 ("libgnomecanvas" ,libgnomecanvas)
459 ("libgnomeui" ,libgnomeui)
460 ("libglade" ,libglade)
461 ("librsvg" ,librsvg)))
462 (arguments
463 `(#:tests? #f ; no check target
ef89cb42
LC
464
465 ;; Occasionally we would get "Error: Unbound module GtkThread" when
466 ;; compiling 'gtkThInit.ml', with 'make -j'. So build sequentially.
467 #:parallel-build? #f
468
3573b634
AE
469 #:phases
470 (modify-phases %standard-phases
471 (replace 'install
472 (lambda* (#:key inputs outputs #:allow-other-keys)
473 (let ((out (assoc-ref outputs "out"))
474 (ocaml (assoc-ref inputs "ocaml")))
475 ;; Install into the output and not the ocaml directory.
476 (substitute* "config.make"
477 ((ocaml) out))
478 (system* "make" "old-install")
479 #t))))))
480 (home-page "http://lablgtk.forge.ocamlcore.org/")
481 (synopsis "GTK+ bindings for OCaml")
482 (description
483 "LablGtk is an OCaml interface to GTK+ 1.2 and 2.x. It provides
484a strongly-typed object-oriented interface that is compatible with the
485dynamic typing of GTK+. Most widgets and methods are available. LablGtk
486also provides bindings to
487gdk-pixbuf, the GLArea widget (in combination with LablGL), gnomecanvas,
488gnomeui, gtksourceview, gtkspell,
489libglade (and it an generate OCaml code from .glade files),
490libpanel, librsvg and quartz.")
491 (license lgpl2.1)))
492
b9d8756b
AE
493(define-public unison
494 (package
495 (name "unison")
496 (version "2.48.3")
497 (source
498 (origin
499 (method url-fetch)
500 (uri (string-append "https://www.seas.upenn.edu/~bcpierce/unison/"
501 "download/releases/stable/unison-" version
502 ".tar.gz"))
503 (sha256
504 (base32
505 "10sln52rnnsj213jy3166m0q97qpwnrwl6mm529xfy10x3xkq3gl"))))
506 (build-system gnu-build-system)
507 (native-inputs
508 `(("ocaml" ,ocaml)))
509 (arguments
510 `(#:parallel-build? #f
511 #:parallel-tests? #f
512 #:test-target "selftest"
513 #:tests? #f ; Tests require writing to $HOME.
514 ; If some $HOME is provided, they fail with the message
515 ; "Fatal error: Skipping some tests -- remove me!"
516 #:phases
517 (modify-phases %standard-phases
518 (delete 'configure)
519 (add-before 'install 'prepare-install
520 (lambda* (#:key outputs #:allow-other-keys)
521 (let* ((out (assoc-ref outputs "out"))
522 (bin (string-append out "/bin")))
523 (mkdir-p bin)
524 (setenv "HOME" out) ; forces correct INSTALLDIR in Makefile
525 #t))))))
526 (home-page "https://www.cis.upenn.edu/~bcpierce/unison/")
527 (synopsis "File synchronizer")
528 (description
529 "Unison is a file-synchronization tool. It allows two replicas of
530a collection of files and directories to be stored on different hosts
531(or different disks on the same host), modified separately, and then
532brought up to date by propagating the changes in each replica
533to the other.")
534 (license gpl3+)))