gnu: libidn: Update to 1.30.
[jackhill/guix/guix.git] / gnu / packages / ocaml.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages ocaml)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages perl)
27 #:use-module (gnu packages python)
28 #:use-module (gnu packages ncurses)
29 #:use-module (gnu packages version-control)
30 #:use-module (gnu packages curl))
31
32 (define-public ocaml
33 (package
34 (name "ocaml")
35 (version "4.00.1")
36 (source (origin
37 (method url-fetch)
38 (uri (string-append
39 "http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-"
40 version ".tar.gz"))
41 (sha256
42 (base32
43 "0yp86napnvbi2jgxr6bk1235bmjdclgzrzgq4mhwv87l7dymr3dl"))))
44 (build-system gnu-build-system)
45 (arguments
46 `(#:modules ((guix build gnu-build-system)
47 (guix build utils)
48 (srfi srfi-1))
49 #:phases (alist-replace
50 'configure
51 (lambda* (#:key outputs #:allow-other-keys)
52 ;; OCaml uses "-prefix <prefix>" rather than the usual
53 ;; "--prefix=<prefix>".
54 (let ((out (assoc-ref outputs "out")))
55 (zero? (system* "./configure" "-prefix" out
56 "-mandir"
57 (string-append out "/share/man")))))
58 (alist-replace
59 'build
60 (lambda* (#:key outputs #:allow-other-keys)
61 ;; "make" does not do anything, we must use
62 ;; "make world.opt".
63 (zero? (system* "make" "world.opt")))
64 (alist-replace
65 'check-after-install
66 (lambda* (#:key outputs #:allow-other-keys)
67 ;; There does not seem to be a "check" or "test" target.
68 (zero? (system "cd testsuite && make all")))
69 (let ((check (assq-ref %standard-phases 'check)))
70 ;; OCaml assumes that "make install" is run before
71 ;; launching the tests.
72 (alist-cons-after
73 'install 'check-after-install
74 check
75 (alist-delete 'check %standard-phases))))))))
76 (inputs `(("perl" ,perl)))
77 (home-page "http://caml.inria.fr/")
78 (synopsis "The OCaml programming language")
79 (description
80 "OCaml is a general purpose industrial-strength programming language with
81 an emphasis on expressiveness and safety. Developed for more than 20 years at
82 Inria it benefits from one of the most advanced type systems and supports
83 functional, imperative and object-oriented styles of programming.")
84 (license (list qpl gpl2))))
85
86 (define-public opam
87 (package
88 (name "opam")
89 (version "1.1.1")
90 (source (origin
91 (method url-fetch)
92 ;; Use the '-full' version, which includes all the dependencies.
93 (uri (string-append
94 "https://github.com/ocaml/opam/releases/download/"
95 version "/opam-full-" version ".tar.gz")
96 ;; (string-append "https://github.com/ocaml/opam/archive/"
97 ;; version ".tar.gz")
98 )
99 (sha256
100 (base32
101 "1frzqkx6yn1pnyd9qz3bv3rbwv74bmc1xji8kl41r1dkqzfl3xqv"))))
102 (build-system gnu-build-system)
103 (arguments
104 '(;; Sometimes, 'make -jX' would fail right after ./configure with
105 ;; "Fatal error: exception End_of_file".
106 #:parallel-build? #f
107
108 ;; For some reason, 'ocp-build' needs $TERM to be set.
109 #:make-flags '("TERM=screen")
110 #:test-target "tests"
111
112 ;; FIXME: There's an obscure test failure:
113 ;; …/_obuild/opam/opam.asm install P1' failed.
114 #:tests? #f
115
116 #:phases (alist-cons-before
117 'build 'pre-build
118 (lambda* (#:key inputs #:allow-other-keys)
119 (let ((bash (assoc-ref inputs "bash")))
120 (substitute* "src/core/opamSystem.ml"
121 (("\"/bin/sh\"")
122 (string-append "\"" bash "/bin/sh\"")))))
123 (alist-cons-before
124 'check 'pre-check
125 (lambda _
126 (setenv "HOME" (getcwd))
127 (and (system "git config --global user.email guix@gnu.org")
128 (system "git config --global user.name Guix")))
129 %standard-phases))))
130 (native-inputs
131 `(("git" ,git) ;for the tests
132 ("python" ,python))) ;for the tests
133 (inputs
134 `(("ocaml" ,ocaml)
135 ("ncurses" ,ncurses)
136 ("curl" ,curl)))
137 (home-page "http://opam.ocamlpro.com/")
138 (synopsis "Package manager for OCaml")
139 (description
140 "OPAM is a tool to manage OCaml packages. It supports multiple
141 simultaneous compiler installations, flexible package constraints, and a
142 Git-friendly development workflow.")
143
144 ;; The 'LICENSE' file waives some requirements compared to LGPLv3.
145 (license lgpl3)))