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