ocaml.scm
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
3 | ;;; |
4 | ;;; This file is part of GNU Guix. |
5 | ;;; |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
7 | ;;; under the terms of the GNU General Public License as published by |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
9 | ;;; your option) any later version. |
10 | ;;; |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | ;;; GNU General Public License for more details. |
15 | ;;; |
16 | ;;; You should have received a copy of the GNU General Public License |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
18 | |
19 | (define-module (more packages ocaml) |
20 | #:use-module (guix packages) |
21 | #:use-module (guix download) |
22 | #:use-module (guix git-download) |
23 | #:use-module (guix utils) |
24 | #:use-module (guix build-system gnu) |
25 | #:use-module (guix build-system ocaml) |
26 | #:use-module ((guix licenses) #:prefix license:) |
27 | #:use-module (gnu packages) |
28 | #:use-module (gnu packages assembly) |
29 | #:use-module (gnu packages autotools) |
30 | #:use-module (gnu packages base) |
31 | #:use-module (gnu packages bison) |
32 | #:use-module (gnu packages boost) |
33 | #:use-module (gnu packages check) |
34 | #:use-module (gnu packages emacs) |
35 | #:use-module (gnu packages flex) |
36 | #:use-module (gnu packages llvm) |
37 | #:use-module (gnu packages m4) |
38 | #:use-module (gnu packages maths) |
39 | #:use-module (gnu packages multiprecision) |
40 | #:use-module (gnu packages ocaml) |
41 | #:use-module (gnu packages perl) |
42 | #:use-module (gnu packages pkg-config) |
43 | #:use-module (gnu packages protobuf) |
44 | #:use-module (gnu packages python) |
45 | #:use-module (gnu packages tex) |
46 | #:use-module (gnu packages texinfo) |
47 | #:use-module (more packages smt) |
48 | #:use-module (ice-9 match)) |
49 | |
50 | (define (ocaml-forge-uri name version file-number) |
51 | (string-append "https://forge.ocamlcore.org/frs/download.php/" |
52 | (number->string file-number) "/" name "-" version |
53 | ".tar.gz")) |
54 | |
55 | (define-public proof-general2 |
56 | (package |
57 | (name "proof-general2") |
58 | (version "4.4") |
59 | (source (origin |
60 | (method url-fetch) |
61 | (uri (string-append |
62 | "https://github.com/ProofGeneral/PG/archive/v" |
63 | version ".tar.gz")) |
64 | (file-name (string-append name "-" version ".tar.gz")) |
65 | (sha256 |
66 | (base32 |
67 | "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv")))) |
68 | (build-system gnu-build-system) |
69 | (native-inputs |
70 | `(("which" ,which) |
71 | ("emacs" ,emacs-minimal) |
72 | ("texinfo" ,texinfo))) |
73 | (inputs |
74 | `(("host-emacs" ,emacs) |
75 | ("perl" ,perl) |
76 | ("coq" ,coq))) |
77 | (arguments |
78 | `(#:tests? #f ; no check target |
79 | #:make-flags (list (string-append "PREFIX=" %output) |
80 | (string-append "DEST_PREFIX=" %output) |
81 | "-j1") |
82 | #:modules ((guix build gnu-build-system) |
83 | (guix build utils) |
84 | (guix build emacs-utils)) |
85 | #:imported-modules (,@%gnu-build-system-modules |
86 | (guix build emacs-utils)) |
87 | #:phases |
88 | (modify-phases %standard-phases |
89 | (delete 'configure) |
90 | (add-after 'unpack 'disable-byte-compile-error-on-warn |
91 | (lambda _ |
92 | (substitute* "Makefile" |
93 | (("\\(setq byte-compile-error-on-warn t\\)") |
94 | "(setq byte-compile-error-on-warn nil)")) |
95 | #t)) |
96 | (add-after 'unpack 'patch-hardcoded-paths |
97 | (lambda* (#:key inputs outputs #:allow-other-keys) |
98 | (let ((out (assoc-ref outputs "out")) |
99 | (coq (assoc-ref inputs "coq")) |
100 | (emacs (assoc-ref inputs "host-emacs"))) |
101 | (define (coq-prog name) |
102 | (string-append coq "/bin/" name)) |
103 | (substitute* "pgshell/pgshell.el" |
104 | (("/bin/sh") (which "sh"))) |
105 | ;(emacs-substitute-variables "coq/coq.el" |
106 | ; ("coq-prog-name" (coq-prog "coqtop")) |
107 | ; ("coq-compiler" (coq-prog "coqc")) |
108 | ; ("coq-dependency-analyzer" (coq-prog "coqdep"))) |
109 | (substitute* "Makefile" |
110 | (("/sbin/install-info") "install-info")) |
111 | (substitute* "bin/proofgeneral" |
112 | (("^PGHOMEDEFAULT=.*" all) |
113 | (string-append all |
114 | "PGHOME=$PGHOMEDEFAULT\n" |
115 | "EMACS=" emacs "/bin/emacs"))) |
116 | #t)))))) |
117 | ;(add-after 'unpack 'clean |
118 | ; (lambda _ |
119 | ; ;; Delete the pre-compiled elc files for Emacs 23. |
120 | ; (zero? (system* "make" "clean")))) |
121 | ;(add-after 'install 'install-doc |
122 | ; (lambda* (#:key make-flags #:allow-other-keys) |
123 | ; ;; XXX FIXME avoid building/installing pdf files, |
124 | ; ;; due to unresolved errors building them. |
125 | ; (substitute* "Makefile" |
126 | ; ((" [^ ]*\\.pdf") "")) |
127 | ; (zero? (apply system* "make" "install-doc" |
128 | ; make-flags))))))) |
129 | (home-page "http://proofgeneral.inf.ed.ac.uk/") |
130 | (synopsis "Generic front-end for proof assistants based on Emacs") |
131 | (description |
132 | "Proof General is a major mode to turn Emacs into an interactive proof |
133 | assistant to write formal mathematical proofs using a variety of theorem |
134 | provers.") |
135 | (license license:gpl2+))) |
136 | |
137 | (define-public ocaml4.02-camlp5 |
138 | (package |
139 | (inherit camlp5) |
140 | (inputs |
141 | `(("ocaml" ,ocaml-4.02))))) |
142 | |
143 | (define-public coq-8.6 |
144 | (package |
145 | (inherit coq) |
146 | (name "coq") |
147 | (version "8.6.1") |
148 | (source (origin |
149 | (method url-fetch) |
150 | (uri (string-append "https://github.com/coq/coq/archive/V" |
151 | version ".tar.gz")) |
152 | (file-name (string-append name "-" version ".tar.gz")) |
153 | (sha256 |
154 | (base32 |
155 | "02nm5sn79hrb9fdmkhyclk80jydadf4jcafmr3idwr5h4z56qbms")))) |
156 | (arguments |
157 | `(#:ocaml ,ocaml-4.02 |
158 | #:findlib ,ocaml4.02-findlib |
159 | #:phases |
160 | (modify-phases %standard-phases |
161 | (replace 'configure |
162 | (lambda* (#:key outputs #:allow-other-keys) |
163 | (let* ((out (assoc-ref outputs "out")) |
164 | (mandir (string-append out "/share/man")) |
165 | (browser "icecat -remote \"OpenURL(%s,new-tab)\"")) |
166 | (invoke "./configure" |
167 | "-prefix" out |
168 | "-mandir" mandir |
169 | "-browser" browser |
170 | "-coqide" "opt")) |
171 | #t)) |
172 | (replace 'build |
173 | (lambda* (#:key inputs #:allow-other-keys) |
174 | (invoke "make" "-j" (number->string |
175 | (parallel-job-count)) |
176 | "world") |
177 | #t)) |
178 | (delete 'check) |
179 | (add-after 'install 'check |
180 | (lambda _ |
181 | (with-directory-excursion "test-suite" |
182 | (invoke "make")) |
183 | #t))))) |
184 | (native-inputs '()) |
185 | (inputs |
186 | `(("lablgtk" ,ocaml4.02-lablgtk) |
187 | ("python" ,python-2) |
188 | ("camlp5" ,ocaml4.02-camlp5))))) |
189 | |
190 | (define-public coq-8.7 |
191 | (package |
192 | (inherit coq) |
193 | (name "coq") |
194 | (version "8.7.2") |
195 | (source (origin |
196 | (method url-fetch) |
197 | (uri (string-append "https://github.com/coq/coq/archive/V" |
198 | version ".tar.gz")) |
199 | (file-name (string-append name "-" version ".tar.gz")) |
200 | (sha256 |
201 | (base32 |
202 | "1lkqvs7ayzv5kkg26y837pg0d6r2b5hbjxl71ba93f39kybw69gg")))) |
203 | (arguments |
204 | `(#:phases |
205 | (modify-phases %standard-phases |
206 | (replace 'configure |
207 | (lambda* (#:key outputs #:allow-other-keys) |
208 | (let* ((out (assoc-ref outputs "out")) |
209 | (mandir (string-append out "/share/man")) |
210 | (browser "icecat -remote \"OpenURL(%s,new-tab)\"")) |
211 | (invoke "./configure" |
212 | "-prefix" out |
213 | "-mandir" mandir |
214 | "-browser" browser |
215 | "-coqide" "opt")) |
216 | #t)) |
217 | (replace 'build |
218 | (lambda* (#:key inputs #:allow-other-keys) |
219 | (substitute* "ide/ideutils.ml" |
220 | (("Bytes.unsafe_to_string read_string") "read_string")) |
221 | (invoke "make" "-j" (number->string |
222 | (parallel-job-count)) |
223 | (string-append |
224 | "USERFLAGS=-I " |
225 | (assoc-ref inputs "ocaml-num") |
226 | "/lib/ocaml/site-lib") |
227 | "world") |
228 | #t)) |
229 | (delete 'check) |
230 | (add-after 'install 'check |
231 | (lambda _ |
232 | (with-directory-excursion "test-suite" |
233 | ;; These two tests fail. |
234 | ;; This one fails because the output is not formatted as expected. |
235 | (delete-file-recursively "coq-makefile/timing") |
236 | ;; This one fails because we didn't build coqtop.byte. |
237 | (delete-file-recursively "coq-makefile/findlib-package") |
238 | (invoke "make")) |
239 | #t))))))) |
240 | |
241 | (define-public coq-bignums-8.7 |
242 | (package |
243 | (inherit coq-bignums) |
244 | (name "coq-bignums") |
245 | (version "8.7.0") |
246 | (source (origin |
247 | (method url-fetch) |
248 | (uri (string-append "https://github.com/coq/bignums/archive/V" |
249 | version ".tar.gz")) |
250 | (file-name (string-append name "-" version ".tar.gz")) |
251 | (sha256 |
252 | (base32 |
253 | "03iw9jiwq9jx45gsvp315y3lxr8m9ksppmcjvxs5c23qnky6zqjx")))) |
254 | (native-inputs |
255 | `(("ocaml" ,ocaml) |
256 | ("coq-8.7" ,coq-8.7))) |
257 | (inputs |
258 | `(("camlp5" ,camlp5))))) |
259 | |
260 | (define-public ppsimpl |
261 | (package |
262 | (name "ppsimpl") |
263 | (version "8.7") |
264 | (source (origin |
265 | (method git-fetch) |
266 | (uri (git-reference |
267 | (url "https://scm.gforge.inria.fr/anonscm/git/ppsimpl/ppsimpl.git") |
268 | (commit "86255a47568df58767d1d8e0b9e2da31cf73a5fc"))) |
269 | (file-name (string-append name "-" version)) |
270 | (sha256 |
271 | (base32 |
272 | "0h509w43j2wd2pyx04k3xfd0bsbmqscwqvhf8whzc3cxzl4j6vvq")))) |
273 | ;(uri "https://gforge.inria.fr/frs/download.php/file/37615/ppsimpl-09-07-2018.tar.gz") |
274 | ;(sha256 |
275 | ; (base32 |
276 | ; "010zgskc1wd5v6wmmyxaapvwxjlgbdqqiks2dvf6llx03b07ak59")))) |
277 | (build-system gnu-build-system) |
278 | (arguments |
279 | `(#:test-target "test" |
280 | #:configure-flags |
281 | (list "-R" (string-append (assoc-ref %build-inputs "compcert") "/lib/coq/user-contrib/compcert") "compcert") |
282 | #:make-flags (list "COQC=coqc -R src PP -I src" |
283 | (string-append |
284 | "COQLIBINSTALL=" |
285 | (assoc-ref %outputs "out") |
286 | "/lib/coq/user-contrib")))) |
287 | (inputs |
288 | `(("coq-bignums-8.7" ,coq-bignums-8.7) |
289 | ("compcert" ,compcert))) |
290 | (native-inputs |
291 | `(("coq-8.7" ,coq-8.7) |
292 | ("ocaml" ,ocaml) |
293 | ("ocaml-findlib" ,ocaml-findlib) |
294 | ("camlp4" ,camlp4) |
295 | ("camlp5" ,camlp5) |
296 | ("which" ,which))) |
297 | (home-page "") |
298 | (synopsis "") |
299 | (description "") |
300 | ;; No declared license -> all rights reserved |
301 | (license #f))) |
302 | |
303 | (define-public compcert |
304 | (package |
305 | (name "compcert") |
306 | (version "3.3") |
307 | (source (origin |
308 | (method url-fetch) |
309 | (uri (string-append "http://compcert.inria.fr/release/compcert-" |
310 | version ".tgz")) |
311 | (sha256 |
312 | (base32 |
313 | "16xrqcwak1v1fk5ndx6jf1yvxv3adsr7p7z34gfm2mpggxnq0xwn")))) |
314 | (build-system gnu-build-system) |
315 | (arguments |
316 | `(#:phases |
317 | (modify-phases %standard-phases |
318 | (replace 'configure |
319 | (lambda* (#:key outputs #:allow-other-keys) |
320 | (let ((system ,(match (or (%current-target-system) (%current-system)) |
321 | ("x86_64-linux" "x86_64-linux") |
322 | ("i686-linux" "x86_32-linux") |
323 | ("armhf-linux" "arm-linux")))) |
324 | (format #t "Building for ~a~%" system) |
325 | (invoke "./configure" system "-prefix" |
326 | (assoc-ref outputs "out"))) |
327 | #t)) |
328 | (add-after 'install 'install-lib |
329 | (lambda* (#:key outputs #:allow-other-keys) |
330 | (for-each |
331 | (lambda (file) |
332 | (install-file |
333 | file |
334 | (string-append |
335 | (assoc-ref outputs "out") |
336 | "/lib/coq/user-contrib/compcert/" (dirname file)))) |
337 | (find-files "." ".*.vo$")) |
338 | #t))) |
339 | #:tests? #f)) |
340 | (native-inputs |
341 | `(("ocaml" ,ocaml) |
342 | ("coq" ,coq-8.7))) |
343 | (inputs |
344 | `(("menhir" ,ocaml-menhir))) |
345 | (home-page "http://compcert.inria.fr") |
346 | (synopsis "Certified C compiler") |
347 | (description "CompCert is a certified (with coq) C compiler. Warning: this |
348 | package is not free software!") |
349 | ;; actually the "INRIA Non-Commercial License Agreement" |
350 | ;; a non-free license. |
351 | (license (license:non-copyleft "file:///LICENSE")))) |
352 | |
353 | (define-public ocaml-c2newspeak |
354 | (package |
355 | (name "ocaml-c2newspeak") |
356 | (version "1") |
357 | (source (origin |
358 | (method git-fetch) |
359 | (uri (git-reference |
360 | (url "https://github.com/airbus-seclab/c2newspeak") |
361 | (commit "c97fd380111a49fa7baeb9e49c45238fca627492"))) |
362 | (file-name (string-append name "-" version)) |
363 | (sha256 |
364 | (base32 |
365 | "0fxh868s5jraq61mnig9ilhyjzsq4iw32f20zh3982naanp4p8r6")))) |
366 | (build-system ocaml-build-system) |
367 | (arguments |
368 | `(#:test-target "check" |
369 | #:tests? #f |
370 | #:phases |
371 | (modify-phases %standard-phases |
372 | (delete 'configure) |
373 | (add-after 'install 'install-bin |
374 | (lambda* (#:key outputs #:allow-other-keys) |
375 | (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin"))))))) |
376 | (home-page "https://github.com/airbus-seclab/c2newspeak") |
377 | (synopsis "") |
378 | (description "") |
379 | (license license:lgpl2.1+))) |
380 | |
381 | (define-public ocaml-bincat |
382 | (package |
383 | (name "ocaml-bincat") |
384 | (version "0.8.1") |
385 | (source (origin |
386 | (method url-fetch) |
387 | (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v" |
388 | version ".tar.gz")) |
389 | (file-name (string-append name "-" version ".tar.gz")) |
390 | (sha256 |
391 | (base32 |
392 | "1ncwm1h428x1bs4sq7ql1isrkhw0angglsa9hnsvhhw2i1jsdk7j")))) |
393 | (build-system ocaml-build-system) |
394 | (arguments |
395 | `(#:tests? #f; disabled for now |
396 | #:validate-runpath? #f; disabled for now |
397 | #:make-flags |
398 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) |
399 | "LDCONFIG=true" |
400 | (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml") |
401 | "/lib/ocaml")) |
402 | #:phases |
403 | (modify-phases %standard-phases |
404 | (delete 'configure) |
405 | (add-before 'build 'python-path |
406 | (lambda* (#:key outputs #:allow-other-keys) |
407 | (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH") |
408 | ":../python:" |
409 | (assoc-ref outputs "out") |
410 | "/lib/python2.7/site-packages/")) |
411 | #t)) |
412 | (add-before 'build 'fix-makefiles |
413 | (lambda _ |
414 | (substitute* "ocaml/src/Makefile" |
415 | (("GITVERSION:=.*") "GITVERSION:=0.8.1\n")) |
416 | (substitute* "python/Makefile" |
417 | (("./setup.py install") "./setup.py install --prefix=$(PREFIX)")) |
418 | #t)) |
419 | (add-before 'check 'fix-test |
420 | (lambda _ |
421 | (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src")) |
422 | ;; Remove tests that require an armv8 compiler |
423 | (substitute* "test/Makefile" |
424 | (("eggloader_armv8 eggloader_armv7 eggloader_armv7thumb") "")) |
425 | (chmod "test/eggloader_x86" #o755) |
426 | #t)) |
427 | (add-before 'install 'install-python-dir |
428 | (lambda* (#:key outputs #:allow-other-keys) |
429 | (mkdir-p (string-append (assoc-ref outputs "out") |
430 | "/lib/python2.7/site-packages/"))))))) |
431 | (inputs |
432 | `(("c2newspeak" ,ocaml-c2newspeak) |
433 | ("zarith" ,ocaml-zarith) |
434 | ("menhir" ,ocaml-menhir) |
435 | ("ocamlgraph" ,ocaml-graph) |
436 | ("ocaml-cppo" ,ocaml-cppo) |
437 | ("ocaml-ppx-tools" ,ocaml-ppx-tools) |
438 | ("gmp" ,gmp))) |
439 | (native-inputs |
440 | `(("python" ,python-2) |
441 | ("pytest" ,python2-pytest) |
442 | ("sphinx" ,python2-sphinx) |
443 | ("nasm" ,nasm))) |
444 | (home-page "https://github.com/airbus-seclab/bincat") |
445 | (synopsis "") |
446 | (description "") |
447 | (license license:lgpl2.1+))) |
448 | |
449 | (define-public ocaml-ocplib-simplex |
450 | (package |
451 | (name "ocaml-ocplib-simplex") |
452 | (version "0.4") |
453 | (source (origin |
454 | (method url-fetch) |
455 | (uri (string-append "https://github.com/OCamlPro-Iguernlala/" |
456 | "ocplib-simplex/archive/v" version ".tar.gz")) |
457 | (sha256 |
458 | (base32 |
459 | "0y6q4bgly7fisdklriww48aknqf2vg4dphr7wwnd1wh80l4anzg1")))) |
460 | (build-system gnu-build-system) |
461 | (arguments |
462 | `(#:tests? #f; Compilation error |
463 | #:phases |
464 | (modify-phases %standard-phases |
465 | (add-after 'unpack 'autoreconf |
466 | (lambda _ |
467 | (invoke "autoreconf" "-fiv") |
468 | #t)) |
469 | (add-before 'install 'mkdir |
470 | (lambda* (#:key outputs #:allow-other-keys) |
471 | (let* ((out (assoc-ref outputs "out")) |
472 | (lib (string-append out "/lib"))) |
473 | (mkdir-p lib) |
474 | #t)))))) |
475 | (native-inputs |
476 | `(("autoconf" ,autoconf) |
477 | ("automake" ,automake) |
478 | ("ocaml" ,ocaml) |
479 | ("ocaml-findlib" ,ocaml-findlib) |
480 | ("which" ,which))) |
481 | (home-page "") |
482 | (synopsis "") |
483 | (description "") |
484 | ; lgpl2.1+ with linking exception |
485 | (license license:lgpl2.1+))) |
486 | |
487 | (define-public frama-c |
488 | (package |
489 | (name "frama-c") |
490 | (version "20171101") |
491 | (source (origin |
492 | (method url-fetch) |
493 | (uri (string-append "http://frama-c.com/download/frama-c-Sulfur-" |
494 | version ".tar.gz")) |
495 | (sha256 |
496 | (base32 |
497 | "1vwjfqmm1r36gkybsy3a7m89q5zicf4rnz5vlsn9imnpjpl9gjw1")))) |
498 | (build-system ocaml-build-system) |
499 | (arguments |
500 | `(#:tests? #f; for now |
501 | #:phases |
502 | (modify-phases %standard-phases |
503 | (add-before 'configure 'export-shell |
504 | (lambda* (#:key inputs #:allow-other-keys) |
505 | (setenv "CONFIG_SHELL" (string-append (assoc-ref inputs "bash") |
506 | "/bin/sh"))))))) |
507 | (inputs |
508 | `(("gmp" ,gmp) |
509 | ("ocaml-graph" ,ocaml-graph) |
510 | ("ocaml-zarith" ,ocaml-zarith))) |
511 | (home-page "") |
512 | (synopsis "") |
513 | (description "") |
514 | (license license:lgpl2.1+))) |
515 | |
516 | (define-public coq-io |
517 | (package |
518 | (name "coq-io") |
519 | (version "3.3.0") |
520 | (source (origin |
521 | (method url-fetch) |
522 | (uri (string-append "https://github.com/coq-io/io/archive/" |
523 | version ".tar.gz")) |
524 | (file-name (string-append name "-" version ".tar.gz")) |
525 | (sha256 |
526 | (base32 |
527 | "0k1z8kav3wz5n04g3imm1hqjimb9cf12ga5wkj1skz8l5ccjxprw")))) |
528 | (build-system gnu-build-system) |
529 | (arguments |
530 | `(#:tests? #f; no tests |
531 | #:make-flags |
532 | (list (string-append "COQLIB=" (assoc-ref %outputs "out") "/lib/coq/")) |
533 | #:phases |
534 | (modify-phases %standard-phases |
535 | (replace 'configure |
536 | (lambda _ |
537 | (invoke "./configure.sh") |
538 | #t))))) |
539 | (native-inputs |
540 | `(("coq" ,coq-8.6))) |
541 | (home-page "") |
542 | (synopsis "") |
543 | (description "") |
544 | (license license:lgpl2.1+))) |
545 |