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 ocaml-4.07 |
56 | (package |
57 | (inherit ocaml) |
58 | (version "4.07.0") |
59 | (source (origin |
60 | (method url-fetch) |
61 | (uri (string-append |
62 | "http://caml.inria.fr/pub/distrib/ocaml-" |
63 | (version-major+minor version) |
64 | "/ocaml-" version ".tar.xz")) |
65 | (sha256 |
66 | (base32 |
67 | "03wzkzv6w4rdiiva20g5amz0n4x75swpjl8d80468p6zm8hgfnzl")))) |
68 | (arguments |
69 | `(#:phases |
70 | (modify-phases %standard-phases |
71 | (add-after 'unpack 'patch-/bin/sh-references |
72 | (lambda* (#:key inputs #:allow-other-keys) |
73 | (let* ((sh (string-append (assoc-ref inputs "bash") |
74 | "/bin/sh")) |
75 | (quoted-sh (string-append "\"" sh "\""))) |
76 | (with-fluids ((%default-port-encoding #f)) |
77 | (for-each |
78 | (lambda (file) |
79 | (substitute* file |
80 | (("\"/bin/sh\"") |
81 | (begin |
82 | (format (current-error-port) "\ |
83 | patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%" |
84 | file quoted-sh) |
85 | quoted-sh)))) |
86 | (find-files "." "\\.ml$")) |
87 | #t)))) |
88 | (replace 'configure |
89 | (lambda* (#:key outputs #:allow-other-keys) |
90 | (let* ((out (assoc-ref outputs "out")) |
91 | (mandir (string-append out "/share/man"))) |
92 | ;; Custom configure script doesn't recognize |
93 | ;; --prefix=<PREFIX> syntax (with equals sign). |
94 | (invoke "./configure" |
95 | "--prefix" out |
96 | "--mandir" mandir)) |
97 | #t)) |
98 | (replace 'build |
99 | (lambda _ |
100 | (invoke "make" "-j" (number->string |
101 | (parallel-job-count)) |
102 | "world.opt") |
103 | #t)) |
104 | (delete 'check) |
105 | (add-after 'install 'check |
106 | (lambda _ |
107 | (with-directory-excursion "testsuite" |
108 | (invoke "make" "all")) |
109 | #t))))))) |
110 | |
111 | (define-public ocaml-fix |
112 | (package |
113 | (inherit ocaml) |
114 | (version "4.06.0") |
115 | (source (origin |
116 | (method url-fetch) |
117 | (uri (string-append |
118 | "http://caml.inria.fr/pub/distrib/ocaml-" |
119 | (version-major+minor version) |
120 | "/ocaml-" version ".tar.xz")) |
121 | (sha256 |
122 | (base32 |
123 | "1dy542yfnnw10zvh5s9qzswliq11mg7l0bcyss3501qw3vwvadhj")))) |
124 | (arguments |
125 | `(#:modules ((guix build gnu-build-system) |
126 | (guix build utils) |
127 | (web server)) |
128 | #:phases |
129 | (modify-phases %standard-phases |
130 | (add-after 'unpack 'patch-/bin/sh-references |
131 | (lambda* (#:key inputs #:allow-other-keys) |
132 | (let* ((sh (string-append (assoc-ref inputs "bash") |
133 | "/bin/sh")) |
134 | (quoted-sh (string-append "\"" sh "\""))) |
135 | (with-fluids ((%default-port-encoding #f)) |
136 | (for-each |
137 | (lambda (file) |
138 | (substitute* file |
139 | (("\"/bin/sh\"") |
140 | (begin |
141 | (format (current-error-port) "\ |
142 | patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%" |
143 | file quoted-sh) |
144 | quoted-sh)))) |
145 | (find-files "." "\\.ml$")) |
146 | #t)))) |
147 | (replace 'configure |
148 | (lambda* (#:key outputs #:allow-other-keys) |
149 | (let* ((out (assoc-ref outputs "out")) |
150 | (mandir (string-append out "/share/man"))) |
151 | ;; Custom configure script doesn't recognize |
152 | ;; --prefix=<PREFIX> syntax (with equals sign). |
153 | (invoke "./configure" |
154 | "--prefix" out |
155 | "--mandir" mandir)) |
156 | #t)) |
157 | (replace 'build |
158 | (lambda _ |
159 | (invoke "make" "-j1" ;; fails to build otherwise |
160 | "world.opt") |
161 | #t)) |
162 | (delete 'check) |
163 | (add-after 'install 'check |
164 | (lambda _ |
165 | (with-directory-excursion "testsuite" |
166 | (invoke "make" "all")) |
167 | #t))))))) |
168 | |
169 | (define-public proof-general2 |
170 | (package |
171 | (name "proof-general2") |
172 | (version "4.4") |
173 | (source (origin |
174 | (method url-fetch) |
175 | (uri (string-append |
176 | "https://github.com/ProofGeneral/PG/archive/v" |
177 | version ".tar.gz")) |
178 | (file-name (string-append name "-" version ".tar.gz")) |
179 | (sha256 |
180 | (base32 |
181 | "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv")))) |
182 | (build-system gnu-build-system) |
183 | (native-inputs |
184 | `(("which" ,which) |
185 | ("emacs" ,emacs-minimal) |
186 | ("texinfo" ,texinfo))) |
187 | (inputs |
188 | `(("host-emacs" ,emacs) |
189 | ("perl" ,perl) |
190 | ("coq" ,coq))) |
191 | (arguments |
192 | `(#:tests? #f ; no check target |
193 | #:make-flags (list (string-append "PREFIX=" %output) |
194 | (string-append "DEST_PREFIX=" %output) |
195 | "-j1") |
196 | #:modules ((guix build gnu-build-system) |
197 | (guix build utils) |
198 | (guix build emacs-utils)) |
199 | #:imported-modules (,@%gnu-build-system-modules |
200 | (guix build emacs-utils)) |
201 | #:phases |
202 | (modify-phases %standard-phases |
203 | (delete 'configure) |
204 | (add-after 'unpack 'disable-byte-compile-error-on-warn |
205 | (lambda _ |
206 | (substitute* "Makefile" |
207 | (("\\(setq byte-compile-error-on-warn t\\)") |
208 | "(setq byte-compile-error-on-warn nil)")) |
209 | #t)) |
210 | (add-after 'unpack 'patch-hardcoded-paths |
211 | (lambda* (#:key inputs outputs #:allow-other-keys) |
212 | (let ((out (assoc-ref outputs "out")) |
213 | (coq (assoc-ref inputs "coq")) |
214 | (emacs (assoc-ref inputs "host-emacs"))) |
215 | (define (coq-prog name) |
216 | (string-append coq "/bin/" name)) |
217 | (substitute* "pgshell/pgshell.el" |
218 | (("/bin/sh") (which "sh"))) |
219 | ;(emacs-substitute-variables "coq/coq.el" |
220 | ; ("coq-prog-name" (coq-prog "coqtop")) |
221 | ; ("coq-compiler" (coq-prog "coqc")) |
222 | ; ("coq-dependency-analyzer" (coq-prog "coqdep"))) |
223 | (substitute* "Makefile" |
224 | (("/sbin/install-info") "install-info")) |
225 | (substitute* "bin/proofgeneral" |
226 | (("^PGHOMEDEFAULT=.*" all) |
227 | (string-append all |
228 | "PGHOME=$PGHOMEDEFAULT\n" |
229 | "EMACS=" emacs "/bin/emacs"))) |
230 | #t)))))) |
231 | ;(add-after 'unpack 'clean |
232 | ; (lambda _ |
233 | ; ;; Delete the pre-compiled elc files for Emacs 23. |
234 | ; (zero? (system* "make" "clean")))) |
235 | ;(add-after 'install 'install-doc |
236 | ; (lambda* (#:key make-flags #:allow-other-keys) |
237 | ; ;; XXX FIXME avoid building/installing pdf files, |
238 | ; ;; due to unresolved errors building them. |
239 | ; (substitute* "Makefile" |
240 | ; ((" [^ ]*\\.pdf") "")) |
241 | ; (zero? (apply system* "make" "install-doc" |
242 | ; make-flags))))))) |
243 | (home-page "http://proofgeneral.inf.ed.ac.uk/") |
244 | (synopsis "Generic front-end for proof assistants based on Emacs") |
245 | (description |
246 | "Proof General is a major mode to turn Emacs into an interactive proof |
247 | assistant to write formal mathematical proofs using a variety of theorem |
248 | provers.") |
249 | (license license:gpl2+))) |
250 | |
251 | (define-public ocaml-build |
252 | (package |
253 | (name "ocaml-build") |
254 | (version "0.11.0") |
255 | (source (origin |
256 | (method url-fetch) |
257 | (uri (string-append "https://github.com/ocaml/ocamlbuild/archive/" |
258 | version ".tar.gz")) |
259 | (file-name (string-append name "-" version ".tar.gz")) |
260 | (sha256 |
261 | (base32 |
262 | "1vh30731gv1brr4ljfzd6m5lni44ifyb1w8hwir81ff9874fs5qp")))) |
263 | (build-system gnu-build-system) |
264 | (arguments |
265 | `(#:test-target "test" |
266 | #:tests? #f; FIXME: tests fail to find Findlib |
267 | #:make-flags |
268 | (list (string-append "OCAMLBUILD_PREFIX=" (assoc-ref %outputs "out")) |
269 | (string-append "OCAMLBUILD_BINDIR=" (assoc-ref %outputs "out") "/bin") |
270 | (string-append "OCAMLBUILD_LIBDIR=" (assoc-ref %outputs "out") "/lib") |
271 | (string-append "OCAMLBUILD_MANDIR=" (assoc-ref %outputs "out") "/share/man")) |
272 | #:phases |
273 | (modify-phases %standard-phases |
274 | (delete 'bootstrap) |
275 | (delete 'configure) |
276 | ;(replace 'configure |
277 | ; (lambda* (#:key outputs #:allow-other-keys) |
278 | ; (let ((out (assoc-ref %outputs "out"))) |
279 | ; (zero? (system* "make" "-f" "configure.make" "all"))))) |
280 | (add-before 'build 'findlib-environment |
281 | (lambda* (#:key outputs #:allow-other-keys) |
282 | (let* ((out (assoc-ref outputs "out"))) |
283 | (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib")) |
284 | (setenv "OCAMLFIND_LDCONF" "ignore") |
285 | #t)))))) |
286 | (native-inputs |
287 | `(("ocaml" ,ocaml-fix))) |
288 | (home-page "") |
289 | (synopsis "") |
290 | (description "") |
291 | (license license:lgpl2.1+))) |
292 | |
293 | (define-public camlp4-fix |
294 | (package |
295 | (inherit camlp4) |
296 | (name "camlp4") |
297 | (version "4.06+1") |
298 | (source (origin |
299 | (method url-fetch) |
300 | (uri (string-append "https://github.com/ocaml/camlp4/archive/" |
301 | version ".tar.gz")) |
302 | (file-name (string-append name "-" version ".tar.gz")) |
303 | (sha256 |
304 | (base32 |
305 | "08mrp8jjaayv0s50kmhjkafxqykff5dq3073hrl7ylx0km253k5i")))) |
306 | (inputs `(("ocaml" ,ocaml-fix))) |
307 | (native-inputs |
308 | `(("ocaml" ,ocaml-fix) |
309 | ("which" ,which) |
310 | ("build" ,ocaml-build))))) |
311 | |
312 | (define-public ocaml-findlib-fix |
313 | (package |
314 | (inherit ocaml-findlib) |
315 | (version "1.7.3") |
316 | (source (origin |
317 | (method url-fetch) |
318 | (uri (string-append "http://download.camlcity.org/download/findlib-" |
319 | version ".tar.gz")) |
320 | (sha256 |
321 | (base32 |
322 | "12xx8si1qv3xz90qsrpazjjk4lc1989fzm97rsmc4diwla7n15ni")))) |
323 | (arguments |
324 | (substitute-keyword-arguments (package-arguments ocaml-findlib) |
325 | ((#:phases phases) |
326 | `(modify-phases ,phases |
327 | (add-before 'build 'fix-findlib-makefile |
328 | (lambda* (#:key outputs #:allow-other-keys) |
329 | (substitute* "src/findlib/Makefile" |
330 | (("\\$\\(prefix\\)\\$\\(OCAML_CORE_STDLIB\\)") |
331 | (string-append (assoc-ref outputs "out") "/lib/ocaml/site-lib"))) |
332 | #t)))))) |
333 | (native-inputs |
334 | `(("camlp4" ,camlp4-fix) |
335 | ("ocaml" ,ocaml-fix) |
336 | ("m4" ,m4))))) |
337 | |
338 | (define-public camlp5-fix |
339 | (package |
340 | (inherit camlp5) |
341 | (name "camlp5") |
342 | (version "7.03") |
343 | (source (origin |
344 | (method url-fetch) |
345 | (uri (string-append "https://github.com/camlp5/camlp5/archive/rel" |
346 | (string-delete #\. version) ".tar.gz")) |
347 | (sha256 |
348 | (base32 |
349 | "06pj7l75r586gngam7nspd1a13ay7cj2bjh035z64w4fgaahlgf1")))) |
350 | (inputs |
351 | `(("ocaml" ,ocaml-fix))))) |
352 | |
353 | (define-public lablgtk-fix |
354 | (package |
355 | (inherit lablgtk) |
356 | (version "2.18.6") |
357 | (source (origin |
358 | (method url-fetch) |
359 | (uri (ocaml-forge-uri "lablgtk" version 1726)) |
360 | (sha256 |
361 | (base32 |
362 | "1y38fdvswy6hmppm65qvgdk4pb3ghhnvz7n4ialf46340r1s5p2d")))) |
363 | (arguments |
364 | `(#:tests? #f ; no check target |
365 | |
366 | ;; opt: also install cmxa files |
367 | #:make-flags (list "all" "opt" |
368 | "OCAMLFIND=ocamlfind" |
369 | "OCAMLLDCONF=ld.conf" |
370 | (string-append "FINDLIBDIR=" |
371 | (assoc-ref %outputs "out") |
372 | "/lib/ocaml")) |
373 | ;; Occasionally we would get "Error: Unbound module GtkThread" when |
374 | ;; compiling 'gtkThInit.ml', with 'make -j'. So build sequentially. |
375 | #:parallel-build? #f |
376 | |
377 | #:phases |
378 | (modify-phases %standard-phases |
379 | (add-before 'install 'prepare-install |
380 | (lambda* (#:key inputs outputs #:allow-other-keys) |
381 | (let ((out (assoc-ref outputs "out")) |
382 | (ocaml (assoc-ref inputs "ocaml"))) |
383 | ;; Install into the output and not the ocaml directory. |
384 | (mkdir-p (string-append out "/lib/ocaml")) |
385 | (substitute* "config.make" |
386 | ((ocaml) out)) |
387 | #t)))))) |
388 | (home-page "http://lablgtk.forge.ocamlcore.org/") |
389 | (native-inputs |
390 | `(("ocaml" ,ocaml-fix) |
391 | ("build" ,ocaml-build) |
392 | ("camlp4" ,camlp4-fix) |
393 | ("findlib" ,ocaml-findlib-fix) |
394 | ("pkg-config" ,pkg-config))))) |
395 | |
396 | (define-public ocaml-menhir-fix |
397 | (package |
398 | (inherit ocaml-menhir) |
399 | (version "20170607") |
400 | (name "ocaml-menhir-fix") |
401 | (source (origin |
402 | (method url-fetch) |
403 | (uri (string-append |
404 | "http://gallium.inria.fr/~fpottier/menhir/" |
405 | "menhir-" version ".tar.gz")) |
406 | (sha256 |
407 | (base32 |
408 | "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0")))) |
409 | (inputs |
410 | `(("ocaml" ,ocaml-fix) |
411 | ("ocamlbuild" ,ocaml-build))))) |
412 | |
413 | (define-public ocaml-num |
414 | (package |
415 | (name "ocaml-num") |
416 | (version "1.1") |
417 | (source (origin |
418 | (method url-fetch) |
419 | (uri (string-append "https://github.com/ocaml/num/archive/v" |
420 | version ".tar.gz")) |
421 | (file-name (string-append name "-" version ".tar.gz")) |
422 | (sha256 |
423 | (base32 |
424 | "1xlkd0svc0mgq5s7nrm2rjrsvg15i9wxqkc1kvwjp6sv8vv8bb04")))) |
425 | (build-system ocaml-build-system) |
426 | (arguments |
427 | `(#:ocaml ,ocaml-fix |
428 | #:findlib ,ocaml-findlib-fix |
429 | #:phases |
430 | (modify-phases %standard-phases |
431 | (delete 'configure) |
432 | (add-before 'build 'fix-makefile |
433 | (lambda* (#:key outputs #:allow-other-keys) |
434 | ;; This package supposes we install to the same directory as |
435 | ;; the ocaml package. |
436 | (substitute* "src/META" |
437 | (("\"\\^\"") (string-append "\"" (assoc-ref outputs "out") |
438 | "/lib/ocaml/site-lib\""))) |
439 | (substitute* "src/Makefile" |
440 | (("\\) \\$\\(STDLIBDIR\\)") |
441 | (string-append ") " (assoc-ref outputs "out") |
442 | "/lib/ocaml/site-lib"))) |
443 | #t))))) |
444 | (home-page "https://github.com/ocaml/num") |
445 | (synopsis "") |
446 | (description "") |
447 | (license license:lgpl2.1+))); with linking exception |
448 | |
449 | (define-public coq-8.7 |
450 | (package |
451 | (inherit coq) |
452 | (name "coq") |
453 | (version "8.7.2") |
454 | (source (origin |
455 | (method url-fetch) |
456 | (uri (string-append "https://github.com/coq/coq/archive/V" |
457 | version ".tar.gz")) |
458 | (file-name (string-append name "-" version ".tar.gz")) |
459 | (sha256 |
460 | (base32 |
461 | "1lkqvs7ayzv5kkg26y837pg0d6r2b5hbjxl71ba93f39kybw69gg")))) |
462 | (native-inputs |
463 | `(("ocamlbuild" ,ocaml-build) |
464 | ("hevea" ,hevea) |
465 | ("texlive" ,texlive))) |
466 | (inputs |
467 | `(("lablgtk" ,lablgtk-fix) |
468 | ("python" ,python-2) |
469 | ("camlp5" ,camlp5-fix) |
470 | ;; ocaml-num was removed from the ocaml package in 4.06. |
471 | ("ocaml-num" ,ocaml-num))) |
472 | (arguments |
473 | `(#:ocaml ,ocaml-fix |
474 | #:findlib ,ocaml-findlib-fix |
475 | #:phases |
476 | (modify-phases %standard-phases |
477 | (replace 'configure |
478 | (lambda* (#:key outputs #:allow-other-keys) |
479 | (let* ((out (assoc-ref outputs "out")) |
480 | (mandir (string-append out "/share/man")) |
481 | (browser "icecat -remote \"OpenURL(%s,new-tab)\"")) |
482 | (invoke "./configure" |
483 | "-prefix" out |
484 | "-mandir" mandir |
485 | "-browser" browser |
486 | "-coqide" "opt")) |
487 | #t)) |
488 | (replace 'build |
489 | (lambda* (#:key inputs #:allow-other-keys) |
490 | (substitute* "ide/ideutils.ml" |
491 | (("Bytes.unsafe_to_string read_string") "read_string")) |
492 | (invoke "make" "-j" (number->string |
493 | (parallel-job-count)) |
494 | (string-append |
495 | "USERFLAGS=-I " |
496 | (assoc-ref inputs "ocaml-num") |
497 | "/lib/ocaml/site-lib") |
498 | "world") |
499 | #t)) |
500 | (delete 'check) |
501 | (add-after 'install 'check |
502 | (lambda _ |
503 | (with-directory-excursion "test-suite" |
504 | ;; These two tests fail. |
505 | ;; This one fails because the output is not formatted as expected. |
506 | (delete-file-recursively "coq-makefile/timing") |
507 | ;; This one fails because we didn't build coqtop.byte. |
508 | (delete-file-recursively "coq-makefile/findlib-package") |
509 | (invoke "make")) |
510 | #t))))))) |
511 | |
512 | (define-public coq-fix |
513 | (package |
514 | (inherit coq) |
515 | (native-inputs |
516 | `(("ocamlbuild" ,ocaml-build) |
517 | ("hevea" ,hevea) |
518 | ("texlive" ,texlive))) |
519 | (inputs |
520 | `(("lablgtk" ,lablgtk-fix) |
521 | ("python" ,python-2) |
522 | ("camlp5" ,camlp5-fix) |
523 | ;; ocaml-num was removed from the ocaml package in 4.06. |
524 | ("ocaml-num" ,ocaml-num))) |
525 | (arguments |
526 | `(#:ocaml ,ocaml-fix |
527 | #:findlib ,ocaml-findlib-fix |
528 | #:phases |
529 | (modify-phases %standard-phases |
530 | (replace 'configure |
531 | (lambda* (#:key outputs #:allow-other-keys) |
532 | (let* ((out (assoc-ref outputs "out")) |
533 | (mandir (string-append out "/share/man")) |
534 | (browser "icecat -remote \"OpenURL(%s,new-tab)\"")) |
535 | (invoke "./configure" |
536 | "-prefix" out |
537 | "-mandir" mandir |
538 | "-browser" browser |
539 | "-coqide" "opt")) |
540 | #t)) |
541 | (replace 'build |
542 | (lambda* (#:key inputs #:allow-other-keys) |
543 | (substitute* "ide/ideutils.ml" |
544 | (("Bytes.unsafe_to_string read_string") "read_string")) |
545 | (invoke "make" "-j" (number->string |
546 | (parallel-job-count)) |
547 | (string-append |
548 | "USERFLAGS=-I " |
549 | (assoc-ref inputs "ocaml-num") |
550 | "/lib/ocaml/site-lib") |
551 | "world") |
552 | #t)) |
553 | (delete 'check) |
554 | (add-after 'install 'check |
555 | (lambda _ |
556 | (with-directory-excursion "test-suite" |
557 | ;; These two tests fail. |
558 | ;; This one fails because the output is not formatted as expected. |
559 | (delete-file-recursively "coq-makefile/timing") |
560 | ;; This one fails because we didn't build coqtop.byte. |
561 | (delete-file-recursively "coq-makefile/findlib-package") |
562 | (invoke "make")) |
563 | #t))))))) |
564 | |
565 | (define-public coq-bignums-8.7 |
566 | (package |
567 | (inherit coq-bignums) |
568 | (name "coq-bignums") |
569 | (version "8.7.0") |
570 | (source (origin |
571 | (method url-fetch) |
572 | (uri (string-append "https://github.com/coq/bignums/archive/V" |
573 | version ".tar.gz")) |
574 | (file-name (string-append name "-" version ".tar.gz")) |
575 | (sha256 |
576 | (base32 |
577 | "03iw9jiwq9jx45gsvp315y3lxr8m9ksppmcjvxs5c23qnky6zqjx")))) |
578 | (native-inputs |
579 | `(("ocaml-fix" ,ocaml-fix) |
580 | ("coq-8.7" ,coq-8.7))) |
581 | (inputs |
582 | `(("camlp5-fix" ,camlp5-fix))))) |
583 | |
584 | (define-public ppsimpl |
585 | (package |
586 | (name "ppsimpl") |
587 | (version "8.7") |
588 | (source (origin |
589 | (method git-fetch) |
590 | (uri (git-reference |
591 | (url "https://scm.gforge.inria.fr/anonscm/git/ppsimpl/ppsimpl.git") |
592 | (commit "86255a47568df58767d1d8e0b9e2da31cf73a5fc"))) |
593 | (file-name (string-append name "-" version)) |
594 | (sha256 |
595 | (base32 |
596 | "0h509w43j2wd2pyx04k3xfd0bsbmqscwqvhf8whzc3cxzl4j6vvq")))) |
597 | ;(uri "https://gforge.inria.fr/frs/download.php/file/37615/ppsimpl-09-07-2018.tar.gz") |
598 | ;(sha256 |
599 | ; (base32 |
600 | ; "010zgskc1wd5v6wmmyxaapvwxjlgbdqqiks2dvf6llx03b07ak59")))) |
601 | (build-system gnu-build-system) |
602 | (arguments |
603 | `(#:test-target "test" |
604 | #:configure-flags |
605 | (list "-R" (string-append (assoc-ref %build-inputs "compcert") "/lib/coq/user-contrib/compcert") "compcert") |
606 | #:make-flags (list "COQC=coqc -R src PP -I src" |
607 | (string-append |
608 | "COQLIBINSTALL=" |
609 | (assoc-ref %outputs "out") |
610 | "/lib/coq/user-contrib")))) |
611 | (inputs |
612 | `(("coq-bignums-8.7" ,coq-bignums-8.7) |
613 | ("compcert" ,compcert))) |
614 | (native-inputs |
615 | `(("coq-8.7" ,coq-8.7) |
616 | ("ocaml-fix" ,ocaml-fix) |
617 | ("ocaml-findlib-fix" ,ocaml-findlib-fix) |
618 | ("camlp4-fix" ,camlp4-fix) |
619 | ("camlp5-fix" ,camlp5-fix) |
620 | ("which" ,which))) |
621 | (home-page "") |
622 | (synopsis "") |
623 | (description "") |
624 | ;; No declared license -> all rights reserved |
625 | (license #f))) |
626 | |
627 | (define-public compcert |
628 | (package |
629 | (name "compcert") |
630 | (version "3.3") |
631 | (source (origin |
632 | (method url-fetch) |
633 | (uri (string-append "http://compcert.inria.fr/release/compcert-" |
634 | version ".tgz")) |
635 | (sha256 |
636 | (base32 |
637 | "16xrqcwak1v1fk5ndx6jf1yvxv3adsr7p7z34gfm2mpggxnq0xwn")))) |
638 | (build-system gnu-build-system) |
639 | (arguments |
640 | `(#:phases |
641 | (modify-phases %standard-phases |
642 | (replace 'configure |
643 | (lambda* (#:key outputs #:allow-other-keys) |
644 | (let ((system ,(match (or (%current-target-system) (%current-system)) |
645 | ("x86_64-linux" "x86_64-linux") |
646 | ("i686-linux" "x86_32-linux") |
647 | ("armhf-linux" "arm-linux")))) |
648 | (format #t "Building for ~a~%" system) |
649 | (invoke "./configure" system "-prefix" |
650 | (assoc-ref outputs "out"))) |
651 | #t)) |
652 | (add-after 'install 'install-lib |
653 | (lambda* (#:key outputs #:allow-other-keys) |
654 | (for-each |
655 | (lambda (file) |
656 | (install-file |
657 | file |
658 | (string-append |
659 | (assoc-ref outputs "out") |
660 | "/lib/coq/user-contrib/compcert/" (dirname file)))) |
661 | (find-files "." ".*.vo$")) |
662 | #t))) |
663 | #:tests? #f)) |
664 | (native-inputs |
665 | `(("ocaml" ,ocaml-fix) |
666 | ("coq" ,coq-8.7))) |
667 | (inputs |
668 | `(("menhir" ,ocaml-menhir-fix))) |
669 | (home-page "http://compcert.inria.fr") |
670 | (synopsis "Certified C compiler") |
671 | (description "CompCert is a certified (with coq) C compiler. Warning: this |
672 | package is not free software!") |
673 | ;; actually the "INRIA Non-Commercial License Agreement" |
674 | ;; a non-free license. |
675 | (license (license:non-copyleft "file:///LICENSE")))) |
676 | |
677 | (define-public cubicle |
678 | (package |
679 | (name "cubicle") |
680 | (version "1.1.1") |
681 | (source (origin |
682 | (method url-fetch) |
683 | (uri (string-append "http://cubicle.lri.fr/cubicle-" |
684 | version ".tar.gz")) |
685 | (sha256 |
686 | (base32 |
687 | "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h")))) |
688 | (build-system gnu-build-system) |
689 | (native-inputs |
690 | `(("ocaml" ,ocaml) |
691 | ("which" ,which))) |
692 | (propagated-inputs |
693 | `(("z3" ,z3))) |
694 | (arguments |
695 | `(#:configure-flags (list "--with-z3") |
696 | #:tests? #f |
697 | #:phases |
698 | (modify-phases %standard-phases |
699 | (add-before 'configure 'configure-for-release |
700 | (lambda _ |
701 | (substitute* "Makefile.in" |
702 | (("SVNREV=") "#SVNREV=")))) |
703 | (add-before 'configure 'fix-/bin/sh |
704 | (lambda _ |
705 | (substitute* "configure" |
706 | (("/bin/sh") (which "sh"))))) |
707 | (add-before 'configure 'fix-smt-z3wrapper.ml |
708 | (lambda _ |
709 | (substitute* "Makefile.in" |
710 | (("\\\\n") ""))))))) |
711 | (home-page "http://cubicle.lri.fr/") |
712 | (synopsis "Model checker for array-based systems") |
713 | (description "Cubicle is an open source model checker for verifying safety |
714 | properties of array-based systems. This is a syntactically restricted class of |
715 | parametrized transition systems with states represented as arrays indexed by an |
716 | arbitrary number of processes. Cache coherence protocols and mutual exclusion |
717 | algorithms are typical examples of such systems.") |
718 | (license license:asl2.0))) |
719 | |
720 | (define-public ocaml-c2newspeak |
721 | (package |
722 | (name "ocaml-c2newspeak") |
723 | (version "1") |
724 | (source (origin |
725 | (method git-fetch) |
726 | (uri (git-reference |
727 | (url "https://github.com/airbus-seclab/c2newspeak") |
728 | (commit "c97fd380111a49fa7baeb9e49c45238fca627492"))) |
729 | (file-name (string-append name "-" version)) |
730 | (sha256 |
731 | (base32 |
732 | "0fxh868s5jraq61mnig9ilhyjzsq4iw32f20zh3982naanp4p8r6")))) |
733 | (build-system ocaml-build-system) |
734 | (arguments |
735 | `(#:test-target "check" |
736 | #:tests? #f |
737 | #:phases |
738 | (modify-phases %standard-phases |
739 | (delete 'configure) |
740 | (add-after 'install 'install-bin |
741 | (lambda* (#:key outputs #:allow-other-keys) |
742 | (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin"))))))) |
743 | (home-page "https://github.com/airbus-seclab/c2newspeak") |
744 | (synopsis "") |
745 | (description "") |
746 | (license license:lgpl2.1+))) |
747 | |
748 | (define-public ocaml-bincat |
749 | (package |
750 | (name "ocaml-bincat") |
751 | (version "0.8.1") |
752 | (source (origin |
753 | (method url-fetch) |
754 | (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v" |
755 | version ".tar.gz")) |
756 | (file-name (string-append name "-" version ".tar.gz")) |
757 | (sha256 |
758 | (base32 |
759 | "1ncwm1h428x1bs4sq7ql1isrkhw0angglsa9hnsvhhw2i1jsdk7j")))) |
760 | (build-system ocaml-build-system) |
761 | (arguments |
762 | `(#:tests? #f; disabled for now |
763 | #:validate-runpath? #f; disabled for now |
764 | #:make-flags |
765 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) |
766 | "LDCONFIG=true" |
767 | (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml") |
768 | "/lib/ocaml")) |
769 | #:phases |
770 | (modify-phases %standard-phases |
771 | (delete 'configure) |
772 | (add-before 'build 'python-path |
773 | (lambda* (#:key outputs #:allow-other-keys) |
774 | (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH") |
775 | ":../python:" |
776 | (assoc-ref outputs "out") |
777 | "/lib/python2.7/site-packages/")) |
778 | #t)) |
779 | (add-before 'build 'fix-makefiles |
780 | (lambda _ |
781 | (substitute* "ocaml/src/Makefile" |
782 | (("GITVERSION:=.*") "GITVERSION:=0.8.1\n")) |
783 | (substitute* "python/Makefile" |
784 | (("./setup.py install") "./setup.py install --prefix=$(PREFIX)")) |
785 | #t)) |
786 | (add-before 'check 'fix-test |
787 | (lambda _ |
788 | (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src")) |
789 | ;; Remove tests that require an armv8 compiler |
790 | (substitute* "test/Makefile" |
791 | (("eggloader_armv8 eggloader_armv7 eggloader_armv7thumb") "")) |
792 | (chmod "test/eggloader_x86" #o755) |
793 | #t)) |
794 | (add-before 'install 'install-python-dir |
795 | (lambda* (#:key outputs #:allow-other-keys) |
796 | (mkdir-p (string-append (assoc-ref outputs "out") |
797 | "/lib/python2.7/site-packages/"))))))) |
798 | (inputs |
799 | `(("c2newspeak" ,ocaml-c2newspeak) |
800 | ("zarith" ,ocaml-zarith) |
801 | ("menhir" ,ocaml-menhir) |
802 | ("ocamlgraph" ,ocaml-graph) |
803 | ("ocaml-cppo" ,ocaml-cppo) |
804 | ("ocaml-ppx-tools" ,ocaml-ppx-tools) |
805 | ("gmp" ,gmp))) |
806 | (native-inputs |
807 | `(("python" ,python-2) |
808 | ("pytest" ,python2-pytest) |
809 | ("sphinx" ,python2-sphinx) |
810 | ("nasm" ,nasm))) |
811 | (home-page "https://github.com/airbus-seclab/bincat") |
812 | (synopsis "") |
813 | (description "") |
814 | (license license:lgpl2.1+))) |
815 | |
816 | (define-public ocaml-ocplib-simplex |
817 | (package |
818 | (name "ocaml-ocplib-simplex") |
819 | (version "0.4") |
820 | (source (origin |
821 | (method url-fetch) |
822 | (uri (string-append "https://github.com/OCamlPro-Iguernlala/" |
823 | "ocplib-simplex/archive/v" version ".tar.gz")) |
824 | (sha256 |
825 | (base32 |
826 | "0y6q4bgly7fisdklriww48aknqf2vg4dphr7wwnd1wh80l4anzg1")))) |
827 | (build-system gnu-build-system) |
828 | (arguments |
829 | `(#:tests? #f; Compilation error |
830 | #:phases |
831 | (modify-phases %standard-phases |
832 | (add-after 'unpack 'autoreconf |
833 | (lambda _ |
834 | (invoke "autoreconf" "-fiv") |
835 | #t)) |
836 | (add-before 'install 'mkdir |
837 | (lambda* (#:key outputs #:allow-other-keys) |
838 | (let* ((out (assoc-ref outputs "out")) |
839 | (lib (string-append out "/lib"))) |
840 | (mkdir-p lib) |
841 | #t)))))) |
842 | (native-inputs |
843 | `(("autoconf" ,autoconf) |
844 | ("automake" ,automake) |
845 | ("ocaml" ,ocaml) |
846 | ("ocaml-findlib" ,ocaml-findlib) |
847 | ("which" ,which))) |
848 | (home-page "") |
849 | (synopsis "") |
850 | (description "") |
851 | ; lgpl2.1+ with linking exception |
852 | (license license:lgpl2.1+))) |
853 | |
854 | (define-public frama-c |
855 | (package |
856 | (name "frama-c") |
857 | (version "20171101") |
858 | (source (origin |
859 | (method url-fetch) |
860 | (uri (string-append "http://frama-c.com/download/frama-c-Sulfur-" |
861 | version ".tar.gz")) |
862 | (sha256 |
863 | (base32 |
864 | "1vwjfqmm1r36gkybsy3a7m89q5zicf4rnz5vlsn9imnpjpl9gjw1")))) |
865 | (build-system ocaml-build-system) |
866 | (arguments |
867 | `(#:tests? #f; for now |
868 | #:phases |
869 | (modify-phases %standard-phases |
870 | (add-before 'configure 'export-shell |
871 | (lambda* (#:key inputs #:allow-other-keys) |
872 | (setenv "CONFIG_SHELL" (string-append (assoc-ref inputs "bash") |
873 | "/bin/sh"))))))) |
874 | (inputs |
875 | `(("gmp" ,gmp) |
876 | ("ocaml-graph" ,ocaml-graph) |
877 | ("ocaml-zarith" ,ocaml-zarith))) |
878 | (home-page "") |
879 | (synopsis "") |
880 | (description "") |
881 | (license license:lgpl2.1+))) |
882 |