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 base) |
30 | #:use-module (gnu packages bison) |
31 | #:use-module (gnu packages boost) |
32 | #:use-module (gnu packages emacs) |
33 | #:use-module (gnu packages flex) |
34 | #:use-module (gnu packages llvm) |
35 | #:use-module (gnu packages m4) |
36 | #:use-module (gnu packages maths) |
37 | #:use-module (gnu packages multiprecision) |
38 | #:use-module (gnu packages ocaml) |
39 | #:use-module (gnu packages perl) |
40 | #:use-module (gnu packages protobuf) |
41 | #:use-module (gnu packages python) |
42 | #:use-module (gnu packages texinfo) |
43 | #:use-module (more packages smt)) |
44 | |
45 | ;; Janestreet packages are found in a similar way and all need the same patch. |
46 | (define (janestreet-origin name version hash) |
47 | (origin (method url-fetch) |
48 | (uri (string-append "https://ocaml.janestreet.com/ocaml-core/" |
49 | (version-major+minor version) "/files/" |
50 | name "-" version ".tar.gz")) |
51 | (sha256 (base32 hash)) |
52 | (modules '((guix build utils))) |
53 | (snippet |
54 | (let ((pattern (string-append "lib/" name))) |
55 | `(begin |
56 | ;; install.ml contains an invalid reference to the ppx file and |
57 | ;; propagates this error to the generated META file. It |
58 | ;; looks for it in the "lib" directory, but it is installed in |
59 | ;; "lib/ocaml/site-lib/package". This substitute does not change |
60 | ;; this file for non ppx packages. |
61 | (substitute* "install.ml" |
62 | ((,pattern) (string-append "lib/ocaml/site-lib/" ,name))) |
63 | ;; The standard Makefile would try to install janestreet modules |
64 | ;; in OCaml's directory in the store, which is read-only. |
65 | (substitute* "Makefile" |
66 | (("--prefix") |
67 | "--libdir $(LIBDIR) --prefix"))))))) |
68 | |
69 | ;; They also require almost the same set of arguments |
70 | (define janestreet-arguments |
71 | `(#:use-make? #t |
72 | #:make-flags |
73 | (list (string-append "CONFIGUREFLAGS=--prefix " |
74 | (assoc-ref %outputs "out") |
75 | " --enable-tests") |
76 | (string-append "LIBDIR=" |
77 | (assoc-ref %outputs "out") |
78 | "/lib/ocaml/site-lib") |
79 | ;; for ocaml-bin-prot, otherwise ignored |
80 | (string-append "OCAML_TOPLEVEL_PATH=" |
81 | (assoc-ref %build-inputs "findlib") |
82 | "/lib/ocaml/site-lib")) |
83 | #:phases (modify-phases %standard-phases (delete 'configure)))) |
84 | |
85 | (define-public ocaml-fix |
86 | (package |
87 | (inherit ocaml) |
88 | (version "4.05.0") |
89 | (source (origin |
90 | (method url-fetch) |
91 | (uri (string-append |
92 | "http://caml.inria.fr/pub/distrib/ocaml-" |
93 | (version-major+minor version) |
94 | "/ocaml-" version ".tar.xz")) |
95 | (sha256 |
96 | (base32 |
97 | "1y9fw1ci9pwnbbrr9nwr8cq8vypcxwdf4akvxard3mxl2jx2g984")))) |
98 | (arguments |
99 | `(#:modules ((guix build gnu-build-system) |
100 | (guix build utils) |
101 | (web server)) |
102 | #:phases |
103 | (modify-phases %standard-phases |
104 | (add-after 'unpack 'patch-/bin/sh-references |
105 | (lambda* (#:key inputs #:allow-other-keys) |
106 | (let* ((sh (string-append (assoc-ref inputs "bash") |
107 | "/bin/sh")) |
108 | (quoted-sh (string-append "\"" sh "\""))) |
109 | (with-fluids ((%default-port-encoding #f)) |
110 | (for-each |
111 | (lambda (file) |
112 | (substitute* file |
113 | (("\"/bin/sh\"") |
114 | (begin |
115 | (format (current-error-port) "\ |
116 | patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%" |
117 | file quoted-sh) |
118 | quoted-sh)))) |
119 | (find-files "." "\\.ml$")) |
120 | #t)))) |
121 | (replace 'configure |
122 | (lambda* (#:key outputs #:allow-other-keys) |
123 | (let* ((out (assoc-ref outputs "out")) |
124 | (mandir (string-append out "/share/man"))) |
125 | ;; Custom configure script doesn't recognize |
126 | ;; --prefix=<PREFIX> syntax (with equals sign). |
127 | (zero? (system* "./configure" |
128 | "--prefix" out |
129 | "--mandir" mandir))))) |
130 | (replace 'build |
131 | (lambda _ |
132 | (zero? (system* "make" "-j1" ;; fails to build otherwise |
133 | "world.opt")))) |
134 | (delete 'check) |
135 | (add-after 'install 'check |
136 | (lambda _ |
137 | (with-directory-excursion "testsuite" |
138 | (zero? (system* "make" "all")))))))))) |
139 | |
140 | (define-public ocaml-zed |
141 | (package |
142 | (name "ocaml-zed") |
143 | (version "1.4") |
144 | (source (origin |
145 | (method url-fetch) |
146 | (uri (string-append "https://github.com/diml/zed/archive/" |
147 | version ".tar.gz")) |
148 | (sha256 |
149 | (base32 |
150 | "0pvfq9ikhbkv4ksn3k3vzs6wiwkihjav3n81lhxm54z9931gfwnz")))) |
151 | (build-system ocaml-build-system) |
152 | (propagated-inputs |
153 | `(("camomile" ,ocaml-camomile) |
154 | ("react" ,ocaml-react))) |
155 | (home-page "https://github.com/diml/zed") |
156 | (synopsis "Abstract engine for text edition in OCaml") |
157 | (description "Zed is an abstract engine for text edition. It can be used to |
158 | write text editors, edition widgets, readlines, ... |
159 | |
160 | Zed uses Camomile to fully support the Unicode specification, and implements an |
161 | UTF-8 encoded string type with validation, and a rope datastructure to achieve |
162 | efficient operations on large Unicode buffers. Zed also features a regular |
163 | expression search on ropes. |
164 | |
165 | To support efficient text edition capabilities, Zed provides macro recording |
166 | and cursor management facilities.") |
167 | (license license:bsd-3))) |
168 | |
169 | (define-public ocaml-lambda-term |
170 | (package |
171 | (name "ocaml-lambda-term") |
172 | (version "1.10.1") |
173 | (home-page "https://github.com/diml/lambda-term") |
174 | (source (origin |
175 | (method url-fetch) |
176 | (uri (string-append home-page "/archive/" version ".tar.gz")) |
177 | (sha256 |
178 | (base32 |
179 | "1449glcsavcwbcsxbd7wcjz50y8vvin4zwpmkhq8i6jca3f3sknj")))) |
180 | (build-system ocaml-build-system) |
181 | (propagated-inputs |
182 | `(("zed" ,ocaml-zed) |
183 | ("lwt" ,ocaml-lwt) |
184 | ("react" ,ocaml-react))) |
185 | (arguments |
186 | `(#:phases |
187 | (modify-phases %standard-phases |
188 | (add-after 'install 'link-stubs |
189 | (lambda* (#:key outputs #:allow-other-keys) |
190 | (let* ((out (assoc-ref outputs "out")) |
191 | (stubs (string-append out "/lib/ocaml/site-lib/stubslibs")) |
192 | (lib (string-append out "/lib/ocaml/site-lib/lambda-term"))) |
193 | (mkdir-p stubs) |
194 | (symlink (string-append lib "/dlllambda-term_stubs.so") |
195 | (string-append stubs "/dlllambda-term_stubs.so")))))))) |
196 | (synopsis "Terminal manipulation library for OCaml") |
197 | (description "Lambda-term is a cross-platform library for manipulating the |
198 | terminal. It provides an abstraction for keys, mouse events, colors, as well as |
199 | a set of widgets to write curses-like applications. |
200 | |
201 | The main objective of lambda-term is to provide a higher level functional |
202 | interface to terminal manipulation than, for example, ncurses, by providing a |
203 | native OCaml interface instead of bindings to a C library. |
204 | |
205 | Lambda-term integrates with zed to provide text edition facilities in console |
206 | applications.") |
207 | (license license:bsd-3))) |
208 | |
209 | (define-public ocaml-utop |
210 | (package |
211 | (name "ocaml-utop") |
212 | (version "1.19.3") |
213 | (source (origin |
214 | (method url-fetch) |
215 | (uri (string-append "https://github.com/diml/utop/archive/" |
216 | version ".tar.gz")) |
217 | (file-name (string-append name "-" version ".tar.gz")) |
218 | (sha256 |
219 | (base32 |
220 | "16z02vp9n97iax4fqpbi7v86r75vbabxvnd1rirh8w2miixs1g4x")))) |
221 | (build-system ocaml-build-system) |
222 | (native-inputs |
223 | `(("cppo" ,ocaml-cppo))) |
224 | (propagated-inputs |
225 | `(("lambda-term" ,ocaml-lambda-term) |
226 | ("lwt" ,ocaml-lwt) |
227 | ("react" ,ocaml-react))) |
228 | (home-page "https://github.com/diml/utop") |
229 | (synopsis "Universal toplevel for OCaml") |
230 | (description "utop is an improved toplevel for OCaml. It can run in a |
231 | terminal or in Emacs. It supports line edition, history, real-time and context |
232 | sensitive completion, colors, and more. |
233 | |
234 | It integrates with the tuareg mode in Emacs.") |
235 | (license license:bsd-3))) |
236 | |
237 | (define-public proof-general2 |
238 | (package |
239 | (name "proof-general2") |
240 | (version "4.4") |
241 | (source (origin |
242 | (method url-fetch) |
243 | (uri (string-append |
244 | "https://github.com/ProofGeneral/PG/archive/v" |
245 | version ".tar.gz")) |
246 | (file-name (string-append name "-" version ".tar.gz")) |
247 | (sha256 |
248 | (base32 |
249 | "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv")))) |
250 | (build-system gnu-build-system) |
251 | (native-inputs |
252 | `(("which" ,which) |
253 | ("emacs" ,emacs-minimal) |
254 | ("texinfo" ,texinfo))) |
255 | (inputs |
256 | `(("host-emacs" ,emacs) |
257 | ("perl" ,perl) |
258 | ("coq" ,coq))) |
259 | (arguments |
260 | `(#:tests? #f ; no check target |
261 | #:make-flags (list (string-append "PREFIX=" %output) |
262 | (string-append "DEST_PREFIX=" %output) |
263 | "-j1") |
264 | #:modules ((guix build gnu-build-system) |
265 | (guix build utils) |
266 | (guix build emacs-utils)) |
267 | #:imported-modules (,@%gnu-build-system-modules |
268 | (guix build emacs-utils)) |
269 | #:phases |
270 | (modify-phases %standard-phases |
271 | (delete 'configure) |
272 | (add-after 'unpack 'disable-byte-compile-error-on-warn |
273 | (lambda _ |
274 | (substitute* "Makefile" |
275 | (("\\(setq byte-compile-error-on-warn t\\)") |
276 | "(setq byte-compile-error-on-warn nil)")) |
277 | #t)) |
278 | (add-after 'unpack 'patch-hardcoded-paths |
279 | (lambda* (#:key inputs outputs #:allow-other-keys) |
280 | (let ((out (assoc-ref outputs "out")) |
281 | (coq (assoc-ref inputs "coq")) |
282 | (emacs (assoc-ref inputs "host-emacs"))) |
283 | (define (coq-prog name) |
284 | (string-append coq "/bin/" name)) |
285 | (substitute* "pgshell/pgshell.el" |
286 | (("/bin/sh") (which "sh"))) |
287 | ;(emacs-substitute-variables "coq/coq.el" |
288 | ; ("coq-prog-name" (coq-prog "coqtop")) |
289 | ; ("coq-compiler" (coq-prog "coqc")) |
290 | ; ("coq-dependency-analyzer" (coq-prog "coqdep"))) |
291 | (substitute* "Makefile" |
292 | (("/sbin/install-info") "install-info")) |
293 | (substitute* "bin/proofgeneral" |
294 | (("^PGHOMEDEFAULT=.*" all) |
295 | (string-append all |
296 | "PGHOME=$PGHOMEDEFAULT\n" |
297 | "EMACS=" emacs "/bin/emacs"))) |
298 | #t)))))) |
299 | ;(add-after 'unpack 'clean |
300 | ; (lambda _ |
301 | ; ;; Delete the pre-compiled elc files for Emacs 23. |
302 | ; (zero? (system* "make" "clean")))) |
303 | ;(add-after 'install 'install-doc |
304 | ; (lambda* (#:key make-flags #:allow-other-keys) |
305 | ; ;; XXX FIXME avoid building/installing pdf files, |
306 | ; ;; due to unresolved errors building them. |
307 | ; (substitute* "Makefile" |
308 | ; ((" [^ ]*\\.pdf") "")) |
309 | ; (zero? (apply system* "make" "install-doc" |
310 | ; make-flags))))))) |
311 | (home-page "http://proofgeneral.inf.ed.ac.uk/") |
312 | (synopsis "Generic front-end for proof assistants based on Emacs") |
313 | (description |
314 | "Proof General is a major mode to turn Emacs into an interactive proof |
315 | assistant to write formal mathematical proofs using a variety of theorem |
316 | provers.") |
317 | (license license:gpl2+))) |
318 | |
319 | (define-public ocaml-findlib-fix |
320 | (package |
321 | (inherit ocaml-findlib) |
322 | (native-inputs |
323 | `(("camlp4" ,camlp4) |
324 | ("ocaml" ,ocaml-fix) |
325 | ("m4" ,m4))))) |
326 | |
327 | (define-public ocaml-build |
328 | (package |
329 | (name "ocaml-build") |
330 | (version "0.11.0") |
331 | (source (origin |
332 | (method url-fetch) |
333 | (uri (string-append "https://github.com/ocaml/ocamlbuild/archive/" |
334 | version ".tar.gz")) |
335 | (file-name (string-append name "-" version ".tar.gz")) |
336 | (sha256 |
337 | (base32 |
338 | "1vh30731gv1brr4ljfzd6m5lni44ifyb1w8hwir81ff9874fs5qp")))) |
339 | (build-system gnu-build-system) |
340 | (arguments |
341 | `(#:test-target "test" |
342 | #:tests? #f; FIXME: tests fail to find Findlib |
343 | #:make-flags |
344 | (list (string-append "OCAMLBUILD_PREFIX=" (assoc-ref %outputs "out")) |
345 | (string-append "OCAMLBUILD_BINDIR=" (assoc-ref %outputs "out") "/bin") |
346 | (string-append "OCAMLBUILD_LIBDIR=" (assoc-ref %outputs "out") "/lib") |
347 | (string-append "OCAMLBUILD_MANDIR=" (assoc-ref %outputs "out") "/share/man")) |
348 | #:phases |
349 | (modify-phases %standard-phases |
350 | (delete 'configure) |
351 | ;(replace 'configure |
352 | ; (lambda* (#:key outputs #:allow-other-keys) |
353 | ; (let ((out (assoc-ref %outputs "out"))) |
354 | ; (zero? (system* "make" "-f" "configure.make" "all"))))) |
355 | (add-before 'build 'findlib-environment |
356 | (lambda* (#:key outputs #:allow-other-keys) |
357 | (let* ((out (assoc-ref outputs "out"))) |
358 | (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib")) |
359 | (setenv "OCAMLFIND_LDCONF" "ignore") |
360 | #t)))))) |
361 | (native-inputs |
362 | `(("ocaml" ,ocaml-fix) |
363 | ("findlib" ,ocaml-findlib-fix))) |
364 | (home-page "") |
365 | (synopsis "") |
366 | (description "") |
367 | (license license:lgpl2.1+))) |
368 | |
369 | (define-public ocaml-menhir-fix |
370 | (package |
371 | (inherit ocaml-menhir) |
372 | (version "20170607") |
373 | (name "ocaml-menhir-fix") |
374 | (source (origin |
375 | (method url-fetch) |
376 | (uri (string-append |
377 | "http://gallium.inria.fr/~fpottier/menhir/" |
378 | "menhir-" version ".tar.gz")) |
379 | (sha256 |
380 | (base32 |
381 | "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0")))) |
382 | (inputs |
383 | `(("ocaml" ,ocaml-fix) |
384 | ("ocamlbuild" ,ocaml-build))))) |
385 | |
386 | (define-public compcert |
387 | (package |
388 | (name "compcert") |
389 | (version "3.0.1") |
390 | (source (origin |
391 | (method url-fetch) |
392 | (uri (string-append "http://compcert.inria.fr/release/compcert-" |
393 | version ".tgz")) |
394 | (sha256 |
395 | (base32 |
396 | "0dgrj26dzdy4n3s9b5hwc6lm54vans1v4qx9hdp1q8w1qqcdriq9")))) |
397 | (build-system gnu-build-system) |
398 | (arguments |
399 | `(#:phases |
400 | (modify-phases %standard-phases |
401 | (replace 'configure |
402 | (lambda* (#:key outputs #:allow-other-keys) |
403 | (zero? (system* "./configure" "x86_64-linux" "-prefix" |
404 | (assoc-ref outputs "out")))))) |
405 | #:tests? #f)) |
406 | (native-inputs |
407 | `(("ocaml" ,ocaml-fix) |
408 | ("coq" ,coq-fix))) |
409 | (inputs |
410 | `(("menhir" ,ocaml-menhir-fix))) |
411 | (home-page "http://compcert.inria.fr") |
412 | (synopsis "Certified C compiler") |
413 | (description "CompCert is a certified (with coq) C compiler. Warning: this |
414 | package is not free software!") |
415 | ;; actually the "INRIA Non-Commercial License Agreement" |
416 | ;; a non-free license. |
417 | (license (license:non-copyleft "file:///LICENSE")))) |
418 | |
419 | ;; yet another build system <3 |
420 | ;; In this one, the autoconf-generated configure script configures the build and |
421 | ;; builds remake from source, a make-like system specific to this package. |
422 | (define-public coq-flocq |
423 | (package |
424 | (name "coq-flocq") |
425 | (version "2.5.2") |
426 | (source (origin |
427 | (method url-fetch) |
428 | (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36199/flocq-" |
429 | version ".tar.gz")) |
430 | (sha256 |
431 | (base32 |
432 | "0h5mlasirfzc0wwn2isg4kahk384n73145akkpinrxq5jsn5d22h")))) |
433 | (build-system gnu-build-system) |
434 | (native-inputs |
435 | `(("ocaml" ,ocaml) |
436 | ("which" ,which) |
437 | ("coq" ,coq-fix))) |
438 | (arguments |
439 | `(#:configure-flags |
440 | (list (string-append "--libdir=" (assoc-ref %outputs "out") |
441 | "/lib/coq/user-contrib/Flocq")) |
442 | #:phases |
443 | (modify-phases %standard-phases |
444 | (add-before 'configure 'fix-remake |
445 | (lambda _ |
446 | (substitute* "remake.cpp" |
447 | (("/bin/sh") (which "sh"))))) |
448 | (replace 'build |
449 | (lambda _ |
450 | (zero? (system* "./remake")))) |
451 | (replace 'check |
452 | (lambda _ |
453 | (zero? (system* "./remake" "check")))) |
454 | ;; TODO: requires coq-gappa and coq-interval. |
455 | ;(zero? (system* "./remake" "check-more")))) |
456 | (replace 'install |
457 | (lambda _ |
458 | (zero? (system* "./remake" "install"))))))) |
459 | (home-page "http://flocq.gforge.inria.fr/") |
460 | (synopsis "Floating-point formalization for the Coq system") |
461 | (description "Flocq (Floats for Coq) is a floating-point formalization for |
462 | the Coq system. It provides a comprehensive library of theorems on a multi-radix |
463 | multi-precision arithmetic. It also supports efficient numerical computations |
464 | inside Coq.") |
465 | (license license:lgpl3+))) |
466 | |
467 | (define-public coq-gappa |
468 | (package |
469 | (name "coq-gappa") |
470 | (version "1.3.1") |
471 | (source (origin |
472 | (method url-fetch) |
473 | (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36351/gappa-" |
474 | version ".tar.gz")) |
475 | (sha256 |
476 | (base32 |
477 | "0924jr6f15fx22qfsvim5vc0qxqg30ivg9zxj34lf6slbgdl3j39")))) |
478 | (build-system gnu-build-system) |
479 | (native-inputs |
480 | `(("ocaml" ,ocaml) |
481 | ("which" ,which) |
482 | ("coq" ,coq-fix) |
483 | ("bison" ,bison) |
484 | ("flex" ,flex))) |
485 | (inputs |
486 | `(("gmp" ,gmp) |
487 | ("mpfr" ,mpfr) |
488 | ("boost" ,boost))) |
489 | (arguments |
490 | `(#:configure-flags |
491 | (list (string-append "--libdir=" (assoc-ref %outputs "out") |
492 | "/lib/coq/user-contrib/Gappa")) |
493 | #:phases |
494 | (modify-phases %standard-phases |
495 | (add-before 'configure 'fix-remake |
496 | (lambda _ |
497 | (substitute* "remake.cpp" |
498 | (("/bin/sh") (which "sh"))))) |
499 | (replace 'build |
500 | (lambda _ |
501 | (zero? (system* "./remake")))) |
502 | (replace 'check |
503 | (lambda _ |
504 | (zero? (system* "./remake" "check")))) |
505 | (replace 'install |
506 | (lambda _ |
507 | (zero? (system* "./remake" "install"))))))) |
508 | (home-page "http://gappa.gforge.inria.fr/") |
509 | (synopsis "Verify and formally prove properties on numerical programs") |
510 | (description "Gappa is a tool intended to help verifying and formally proving |
511 | properties on numerical programs dealing with floating-point or fixed-point |
512 | arithmetic. It has been used to write robust floating-point filters for CGAL |
513 | and it is used to certify elementary functions in CRlibm. While Gappa is |
514 | intended to be used directly, it can also act as a backend prover for the Why3 |
515 | software verification plateform or as an automatic tactic for the Coq proof |
516 | assistant.") |
517 | (license (list license:gpl2 license:cecill)))) |
518 | |
519 | (define-public coq-mathcomp |
520 | (package |
521 | (name "coq-mathcomp") |
522 | (version "1.6.1") |
523 | (source (origin |
524 | (method url-fetch) |
525 | (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-" |
526 | version ".tar.gz")) |
527 | (sha256 |
528 | (base32 |
529 | "1j9ylggjzrxz1i2hdl2yhsvmvy5z6l4rprwx7604401080p5sgjw")))) |
530 | (build-system gnu-build-system) |
531 | (native-inputs |
532 | `(("ocaml" ,ocaml) |
533 | ("which" ,which) |
534 | ("coq" ,coq-fix))) |
535 | (arguments |
536 | `(#:tests? #f; No need to test formally-verified programs :) |
537 | #:phases |
538 | (modify-phases %standard-phases |
539 | (delete 'configure) |
540 | (add-before 'build 'chdir |
541 | (lambda _ |
542 | (chdir "mathcomp"))) |
543 | (replace 'install |
544 | (lambda* (#:key outputs #:allow-other-keys) |
545 | (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/")) |
546 | (zero? (system* "make" "-f" "Makefile.coq" |
547 | (string-append "COQLIB=" (assoc-ref outputs "out") |
548 | "/lib/coq/") |
549 | "install"))))))) |
550 | (home-page "https://math-comp.github.io/math-comp/") |
551 | (synopsis "Mathematical Components for Coq") |
552 | (description "Mathematical Components for Coq has its origins in the formal |
553 | proof of the Four Colour Theorem. Since then it has grown to cover many areas |
554 | of mathematics and has been used for large scale projects like the formal proof |
555 | of the Odd Order Theorem. |
556 | |
557 | The library is written using the Ssreflect proof language that is an integral |
558 | part of the distribution.") |
559 | (license license:cecill-b))) |
560 | |
561 | (define-public coq-coquelicot |
562 | (package |
563 | (name "coq-coquelicot") |
564 | (version "3.0.0") |
565 | (source (origin |
566 | (method url-fetch) |
567 | (uri (string-append "https://gforge.inria.fr/frs/download.php/" |
568 | "file/36537/coquelicot-" version ".tar.gz")) |
569 | (sha256 |
570 | (base32 |
571 | "0fx99bvsbdizj00gx2im8939y4wwl05f4qhw184j90kcx5vjxxv9")))) |
572 | (build-system gnu-build-system) |
573 | (native-inputs |
574 | `(("ocaml" ,ocaml) |
575 | ("which" ,which) |
576 | ("coq" ,coq-fix))) |
577 | (propagated-inputs |
578 | `(("mathcomp" ,coq-mathcomp))) |
579 | (arguments |
580 | `(#:configure-flags |
581 | (list (string-append "--libdir=" (assoc-ref %outputs "out") |
582 | "/lib/coq/user-contrib/Coquelicot")) |
583 | #:phases |
584 | (modify-phases %standard-phases |
585 | (add-before 'configure 'fix-remake |
586 | (lambda _ |
587 | (substitute* "remake.cpp" |
588 | (("/bin/sh") (which "sh"))))) |
589 | (replace 'build |
590 | (lambda _ |
591 | (zero? (system* "./remake")))) |
592 | (replace 'check |
593 | (lambda _ |
594 | (zero? (system* "./remake" "check")))) |
595 | (replace 'install |
596 | (lambda _ |
597 | (zero? (system* "./remake" "install"))))))) |
598 | (home-page "http://coquelicot.saclay.inria.fr/index.html") |
599 | (synopsis "Coq library for Reals") |
600 | (description "Coquelicot is an easier way of writing formulas and theorem |
601 | statements, achieved by relying on total functions in place of dependent types |
602 | for limits, derivatives, integrals, power series, and so on. To help with the |
603 | proof process, the library comes with a comprehensive set of theorems that cover |
604 | not only these notions, but also some extensions such as parametric integrals, |
605 | two-dimensional differentiability, asymptotic behaviors. It also offers some |
606 | automations for performing differentiability proofs. Moreover, Coquelicot is a |
607 | conservative extension of Coq's standard library and provides correspondence |
608 | theorems between the two libraries.") |
609 | (license license:lgpl3+))) |
610 | |
611 | (define-public coq-interval |
612 | (package |
613 | (name "coq-interval") |
614 | (version "3.2.0") |
615 | (source (origin |
616 | (method url-fetch) |
617 | (uri (string-append "https://gforge.inria.fr/frs/download.php/" |
618 | "file/36538/interval-" version ".tar.gz")) |
619 | (sha256 |
620 | (base32 |
621 | "16ir7mizl18kwa1ls8fwjih6r87894bvc1r6lh85cd43la7nriq3")))) |
622 | (build-system gnu-build-system) |
623 | (native-inputs |
624 | `(("ocaml" ,ocaml) |
625 | ("which" ,which) |
626 | ("coq" ,coq-fix))) |
627 | (propagated-inputs |
628 | `(("flocq" ,coq-flocq) |
629 | ("coquelicot" ,coq-coquelicot) |
630 | ("mathcomp" ,coq-mathcomp))) |
631 | (arguments |
632 | `(#:configure-flags |
633 | (list (string-append "--libdir=" (assoc-ref %outputs "out") |
634 | "/lib/coq/user-contrib/Gappa")) |
635 | #:phases |
636 | (modify-phases %standard-phases |
637 | (add-before 'configure 'fix-remake |
638 | (lambda _ |
639 | (substitute* "remake.cpp" |
640 | (("/bin/sh") (which "sh"))))) |
641 | (replace 'build |
642 | (lambda _ |
643 | (zero? (system* "./remake")))) |
644 | (replace 'check |
645 | (lambda _ |
646 | (zero? (system* "./remake" "check")))) |
647 | (replace 'install |
648 | (lambda _ |
649 | (zero? (system* "./remake" "install"))))))) |
650 | (home-page "http://coq-interval.gforge.inria.fr/") |
651 | (synopsis "Coq tactics to simplify inequality proofs") |
652 | (description "Interval provides vernacular files containing tactics for |
653 | simplifying the proofs of inequalities on expressions of real numbers for the |
654 | Coq proof assistant.") |
655 | (license license:cecill-c))) |
656 | |
657 | (define-public coq-fix |
658 | (package |
659 | (inherit coq) |
660 | (name "coq-fix") |
661 | (version "8.6") |
662 | (source (origin |
663 | (method url-fetch) |
664 | (uri (string-append "https://coq.inria.fr/distrib/V" version |
665 | "/files/coq-" version ".tar.gz")) |
666 | (sha256 |
667 | (base32 |
668 | "1pw1xvy1657l1k69wrb911iqqflzhhp8wwsjvihbgc72r3skqg3f")))) |
669 | (native-search-paths |
670 | (list (search-path-specification |
671 | (variable "COQPATH") |
672 | (files (list "lib/coq/user-contrib"))))))) |
673 | |
674 | (define-public cubicle |
675 | (package |
676 | (name "cubicle") |
677 | (version "1.1.1") |
678 | (source (origin |
679 | (method url-fetch) |
680 | (uri (string-append "http://cubicle.lri.fr/cubicle-" |
681 | version ".tar.gz")) |
682 | (sha256 |
683 | (base32 |
684 | "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h")))) |
685 | (build-system gnu-build-system) |
686 | (native-inputs |
687 | `(("ocaml" ,ocaml) |
688 | ("which" ,which))) |
689 | (propagated-inputs |
690 | `(("z3" ,z3))) |
691 | (arguments |
692 | `(#:configure-flags (list "--with-z3") |
693 | #:tests? #f |
694 | #:phases |
695 | (modify-phases %standard-phases |
696 | (add-before 'configure 'configure-for-release |
697 | (lambda _ |
698 | (substitute* "Makefile.in" |
699 | (("SVNREV=") "#SVNREV=")))) |
700 | (add-before 'configure 'fix-/bin/sh |
701 | (lambda _ |
702 | (substitute* "configure" |
703 | (("/bin/sh") (which "sh"))))) |
704 | (add-before 'configure 'fix-smt-z3wrapper.ml |
705 | (lambda _ |
706 | (substitute* "Makefile.in" |
707 | (("\\\\n") ""))))))) |
708 | (home-page "http://cubicle.lri.fr/") |
709 | (synopsis "Model checker for array-based systems") |
710 | (description "Cubicle is an open source model checker for verifying safety |
711 | properties of array-based systems. This is a syntactically restricted class of |
712 | parametrized transition systems with states represented as arrays indexed by an |
713 | arbitrary number of processes. Cache coherence protocols and mutual exclusion |
714 | algorithms are typical examples of such systems.") |
715 | (license license:asl2.0))) |
716 | |
717 | (define-public ocaml-c2newspeak |
718 | (package |
719 | (name "ocaml-c2newspeak") |
720 | (version "1") |
721 | (source (origin |
722 | (method git-fetch) |
723 | (uri (git-reference |
724 | (url "https://github.com/airbus-seclab/c2newspeak") |
725 | (commit "6f7adf13fefb7f8d4dc668b8290226e3c6a30063"))) |
726 | (file-name (string-append name "-" version)) |
727 | (sha256 |
728 | (base32 |
729 | "1apaz0b84865xfba0mxbskbnaq6llqsn3qhy8b0sssbdxzw5w1x4")))) |
730 | (build-system ocaml-build-system) |
731 | (arguments |
732 | `(#:test-target "check" |
733 | #:tests? #f |
734 | #:phases |
735 | (modify-phases %standard-phases |
736 | (delete 'configure) |
737 | (add-before 'install 'modify-installed-file-list |
738 | (lambda _ |
739 | (substitute* "src/newspeak.Makefile" |
740 | (("c2newspeak/typedC.cmi") |
741 | "c2newspeak/typedC.cmi c2newspeak/typedC.cmx c2newspeak/typedC.o")))) |
742 | (add-after 'install 'install-bin |
743 | (lambda* (#:key outputs #:allow-other-keys) |
744 | (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin"))))))) |
745 | (home-page "https://github.com/airbus-seclab/c2newspeak") |
746 | (synopsis "") |
747 | (description "") |
748 | (license license:lgpl2.1+))) |
749 | |
750 | (define-public ocaml-bincat |
751 | (package |
752 | (name "ocaml-bincat") |
753 | (version "0.6") |
754 | (source (origin |
755 | (method url-fetch) |
756 | (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v" |
757 | version ".tar.gz")) |
758 | (file-name (string-append name "-" version ".tar.gz")) |
759 | (sha256 |
760 | (base32 |
761 | "1762wrvf7fv16kxfvpblj4b0pwbwny1b39263q4jnqni12474djl")))) |
762 | (build-system ocaml-build-system) |
763 | (arguments |
764 | `(#:tests? #f; some failures for unknown reasons |
765 | #:make-flags |
766 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) |
767 | "LDCONFIG=true" |
768 | (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml") |
769 | "/lib/ocaml")) |
770 | #:phases |
771 | (modify-phases %standard-phases |
772 | (delete 'configure) |
773 | (add-before 'build 'python-path |
774 | (lambda _ |
775 | (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH") |
776 | ":../python")))) |
777 | (add-before 'build 'fix-makefile |
778 | (lambda _ |
779 | (substitute* "ocaml/src/Makefile" |
780 | (("GITVERSION:=.*") "GITVERSION:=0.6\n") |
781 | ;; typedC library is embedded in newspeak.cmxa |
782 | (("typedC.cmx") "")))) |
783 | (add-before 'check 'fix-test |
784 | (lambda _ |
785 | (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src")) |
786 | (chmod "test/eggloader_x86" #o755)))))) |
787 | (inputs |
788 | `(("c2newspeak" ,ocaml-c2newspeak) |
789 | ("zarith" ,ocaml-zarith) |
790 | ("menhir" ,ocaml-menhir) |
791 | ("ocamlgraph" ,ocaml-graph) |
792 | ("gmp" ,gmp))) |
793 | (native-inputs |
794 | `(("python" ,python-2) |
795 | ("pytest" ,python2-pytest) |
796 | ("sphinx" ,python2-sphinx) |
797 | ("nasm" ,nasm))) |
798 | (home-page "https://github.com/airbus-seclab/bincat") |
799 | (synopsis "") |
800 | (description "") |
801 | (license license:lgpl2.1+))) |
802 | |
803 |