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