guix-more/more/packages/ocaml.scm

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