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