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 | ;; Janestreet packages are found in a similar way and all need the same patch. |
48 | (define (janestreet-origin name version hash) |
49 | (origin (method url-fetch) |
50 | (uri (string-append "https://ocaml.janestreet.com/ocaml-core/" |
51 | (version-major+minor version) "/files/" |
52 | name "-" version ".tar.gz")) |
53 | (sha256 (base32 hash)) |
54 | (modules '((guix build utils))) |
55 | (snippet |
56 | (let ((pattern (string-append "lib/" name))) |
57 | `(begin |
58 | ;; install.ml contains an invalid reference to the ppx file and |
59 | ;; propagates this error to the generated META file. It |
60 | ;; looks for it in the "lib" directory, but it is installed in |
61 | ;; "lib/ocaml/site-lib/package". This substitute does not change |
62 | ;; this file for non ppx packages. |
63 | (substitute* "install.ml" |
64 | ((,pattern) (string-append "lib/ocaml/site-lib/" ,name))) |
65 | ;; The standard Makefile would try to install janestreet modules |
66 | ;; in OCaml's directory in the store, which is read-only. |
67 | (substitute* "Makefile" |
68 | (("--prefix") |
69 | "--libdir $(LIBDIR) --prefix"))))))) |
70 | |
71 | ;; They also require almost the same set of arguments |
72 | (define janestreet-arguments |
73 | `(#:use-make? #t |
74 | #:make-flags |
75 | (list (string-append "CONFIGUREFLAGS=--prefix " |
76 | (assoc-ref %outputs "out") |
77 | " --enable-tests") |
78 | (string-append "LIBDIR=" |
79 | (assoc-ref %outputs "out") |
80 | "/lib/ocaml/site-lib") |
81 | ;; for ocaml-bin-prot, otherwise ignored |
82 | (string-append "OCAML_TOPLEVEL_PATH=" |
83 | (assoc-ref %build-inputs "findlib") |
84 | "/lib/ocaml/site-lib")) |
85 | #:phases (modify-phases %standard-phases (delete 'configure)))) |
86 | |
87 | (define-public ocaml-fix |
88 | (package |
89 | (inherit ocaml) |
90 | (version "4.05.0") |
91 | (source (origin |
92 | (method url-fetch) |
93 | (uri (string-append |
94 | "http://caml.inria.fr/pub/distrib/ocaml-" |
95 | (version-major+minor version) |
96 | "/ocaml-" version ".tar.xz")) |
97 | (sha256 |
98 | (base32 |
99 | "1y9fw1ci9pwnbbrr9nwr8cq8vypcxwdf4akvxard3mxl2jx2g984")))) |
100 | (arguments |
101 | `(#:modules ((guix build gnu-build-system) |
102 | (guix build utils) |
103 | (web server)) |
104 | #:phases |
105 | (modify-phases %standard-phases |
106 | (add-after 'unpack 'patch-/bin/sh-references |
107 | (lambda* (#:key inputs #:allow-other-keys) |
108 | (let* ((sh (string-append (assoc-ref inputs "bash") |
109 | "/bin/sh")) |
110 | (quoted-sh (string-append "\"" sh "\""))) |
111 | (with-fluids ((%default-port-encoding #f)) |
112 | (for-each |
113 | (lambda (file) |
114 | (substitute* file |
115 | (("\"/bin/sh\"") |
116 | (begin |
117 | (format (current-error-port) "\ |
118 | patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%" |
119 | file quoted-sh) |
120 | quoted-sh)))) |
121 | (find-files "." "\\.ml$")) |
122 | #t)))) |
123 | (replace 'configure |
124 | (lambda* (#:key outputs #:allow-other-keys) |
125 | (let* ((out (assoc-ref outputs "out")) |
126 | (mandir (string-append out "/share/man"))) |
127 | ;; Custom configure script doesn't recognize |
128 | ;; --prefix=<PREFIX> syntax (with equals sign). |
129 | (zero? (system* "./configure" |
130 | "--prefix" out |
131 | "--mandir" mandir))))) |
132 | (replace 'build |
133 | (lambda _ |
134 | (zero? (system* "make" "-j1" ;; fails to build otherwise |
135 | "world.opt")))) |
136 | (delete 'check) |
137 | (add-after 'install 'check |
138 | (lambda _ |
139 | (with-directory-excursion "testsuite" |
140 | (zero? (system* "make" "all")))))))))) |
141 | |
142 | (define-public ocaml-zed |
143 | (package |
144 | (name "ocaml-zed") |
145 | (version "1.4") |
146 | (source (origin |
147 | (method url-fetch) |
148 | (uri (string-append "https://github.com/diml/zed/archive/" |
149 | version ".tar.gz")) |
150 | (sha256 |
151 | (base32 |
152 | "0pvfq9ikhbkv4ksn3k3vzs6wiwkihjav3n81lhxm54z9931gfwnz")))) |
153 | (build-system ocaml-build-system) |
154 | (propagated-inputs |
155 | `(("camomile" ,ocaml-camomile) |
156 | ("react" ,ocaml-react))) |
157 | (home-page "https://github.com/diml/zed") |
158 | (synopsis "Abstract engine for text edition in OCaml") |
159 | (description "Zed is an abstract engine for text edition. It can be used to |
160 | write text editors, edition widgets, readlines, ... |
161 | |
162 | Zed uses Camomile to fully support the Unicode specification, and implements an |
163 | UTF-8 encoded string type with validation, and a rope datastructure to achieve |
164 | efficient operations on large Unicode buffers. Zed also features a regular |
165 | expression search on ropes. |
166 | |
167 | To support efficient text edition capabilities, Zed provides macro recording |
168 | and cursor management facilities.") |
169 | (license license:bsd-3))) |
170 | |
171 | (define-public ocaml-lambda-term |
172 | (package |
173 | (name "ocaml-lambda-term") |
174 | (version "1.10.1") |
175 | (home-page "https://github.com/diml/lambda-term") |
176 | (source (origin |
177 | (method url-fetch) |
178 | (uri (string-append home-page "/archive/" version ".tar.gz")) |
179 | (sha256 |
180 | (base32 |
181 | "1449glcsavcwbcsxbd7wcjz50y8vvin4zwpmkhq8i6jca3f3sknj")))) |
182 | (build-system ocaml-build-system) |
183 | (propagated-inputs |
184 | `(("zed" ,ocaml-zed) |
185 | ("lwt" ,ocaml-lwt) |
186 | ("react" ,ocaml-react))) |
187 | (arguments |
188 | `(#:phases |
189 | (modify-phases %standard-phases |
190 | (add-after 'install 'link-stubs |
191 | (lambda* (#:key outputs #:allow-other-keys) |
192 | (let* ((out (assoc-ref outputs "out")) |
193 | (stubs (string-append out "/lib/ocaml/site-lib/stubslibs")) |
194 | (lib (string-append out "/lib/ocaml/site-lib/lambda-term"))) |
195 | (mkdir-p stubs) |
196 | (symlink (string-append lib "/dlllambda-term_stubs.so") |
197 | (string-append stubs "/dlllambda-term_stubs.so")))))))) |
198 | (synopsis "Terminal manipulation library for OCaml") |
199 | (description "Lambda-term is a cross-platform library for manipulating the |
200 | terminal. It provides an abstraction for keys, mouse events, colors, as well as |
201 | a set of widgets to write curses-like applications. |
202 | |
203 | The main objective of lambda-term is to provide a higher level functional |
204 | interface to terminal manipulation than, for example, ncurses, by providing a |
205 | native OCaml interface instead of bindings to a C library. |
206 | |
207 | Lambda-term integrates with zed to provide text edition facilities in console |
208 | applications.") |
209 | (license license:bsd-3))) |
210 | |
211 | (define-public ocaml-utop |
212 | (package |
213 | (name "ocaml-utop") |
214 | (version "1.19.3") |
215 | (source (origin |
216 | (method url-fetch) |
217 | (uri (string-append "https://github.com/diml/utop/archive/" |
218 | version ".tar.gz")) |
219 | (file-name (string-append name "-" version ".tar.gz")) |
220 | (sha256 |
221 | (base32 |
222 | "16z02vp9n97iax4fqpbi7v86r75vbabxvnd1rirh8w2miixs1g4x")))) |
223 | (build-system ocaml-build-system) |
224 | (native-inputs |
225 | `(("cppo" ,ocaml-cppo))) |
226 | (propagated-inputs |
227 | `(("lambda-term" ,ocaml-lambda-term) |
228 | ("lwt" ,ocaml-lwt) |
229 | ("react" ,ocaml-react))) |
230 | (home-page "https://github.com/diml/utop") |
231 | (synopsis "Universal toplevel for OCaml") |
232 | (description "utop is an improved toplevel for OCaml. It can run in a |
233 | terminal or in Emacs. It supports line edition, history, real-time and context |
234 | sensitive completion, colors, and more. |
235 | |
236 | It integrates with the tuareg mode in Emacs.") |
237 | (license license:bsd-3))) |
238 | |
239 | (define-public proof-general2 |
240 | (package |
241 | (name "proof-general2") |
242 | (version "4.4") |
243 | (source (origin |
244 | (method url-fetch) |
245 | (uri (string-append |
246 | "https://github.com/ProofGeneral/PG/archive/v" |
247 | version ".tar.gz")) |
248 | (file-name (string-append name "-" version ".tar.gz")) |
249 | (sha256 |
250 | (base32 |
251 | "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv")))) |
252 | (build-system gnu-build-system) |
253 | (native-inputs |
254 | `(("which" ,which) |
255 | ("emacs" ,emacs-minimal) |
256 | ("texinfo" ,texinfo))) |
257 | (inputs |
258 | `(("host-emacs" ,emacs) |
259 | ("perl" ,perl) |
260 | ("coq" ,coq))) |
261 | (arguments |
262 | `(#:tests? #f ; no check target |
263 | #:make-flags (list (string-append "PREFIX=" %output) |
264 | (string-append "DEST_PREFIX=" %output) |
265 | "-j1") |
266 | #:modules ((guix build gnu-build-system) |
267 | (guix build utils) |
268 | (guix build emacs-utils)) |
269 | #:imported-modules (,@%gnu-build-system-modules |
270 | (guix build emacs-utils)) |
271 | #:phases |
272 | (modify-phases %standard-phases |
273 | (delete 'configure) |
274 | (add-after 'unpack 'disable-byte-compile-error-on-warn |
275 | (lambda _ |
276 | (substitute* "Makefile" |
277 | (("\\(setq byte-compile-error-on-warn t\\)") |
278 | "(setq byte-compile-error-on-warn nil)")) |
279 | #t)) |
280 | (add-after 'unpack 'patch-hardcoded-paths |
281 | (lambda* (#:key inputs outputs #:allow-other-keys) |
282 | (let ((out (assoc-ref outputs "out")) |
283 | (coq (assoc-ref inputs "coq")) |
284 | (emacs (assoc-ref inputs "host-emacs"))) |
285 | (define (coq-prog name) |
286 | (string-append coq "/bin/" name)) |
287 | (substitute* "pgshell/pgshell.el" |
288 | (("/bin/sh") (which "sh"))) |
289 | ;(emacs-substitute-variables "coq/coq.el" |
290 | ; ("coq-prog-name" (coq-prog "coqtop")) |
291 | ; ("coq-compiler" (coq-prog "coqc")) |
292 | ; ("coq-dependency-analyzer" (coq-prog "coqdep"))) |
293 | (substitute* "Makefile" |
294 | (("/sbin/install-info") "install-info")) |
295 | (substitute* "bin/proofgeneral" |
296 | (("^PGHOMEDEFAULT=.*" all) |
297 | (string-append all |
298 | "PGHOME=$PGHOMEDEFAULT\n" |
299 | "EMACS=" emacs "/bin/emacs"))) |
300 | #t)))))) |
301 | ;(add-after 'unpack 'clean |
302 | ; (lambda _ |
303 | ; ;; Delete the pre-compiled elc files for Emacs 23. |
304 | ; (zero? (system* "make" "clean")))) |
305 | ;(add-after 'install 'install-doc |
306 | ; (lambda* (#:key make-flags #:allow-other-keys) |
307 | ; ;; XXX FIXME avoid building/installing pdf files, |
308 | ; ;; due to unresolved errors building them. |
309 | ; (substitute* "Makefile" |
310 | ; ((" [^ ]*\\.pdf") "")) |
311 | ; (zero? (apply system* "make" "install-doc" |
312 | ; make-flags))))))) |
313 | (home-page "http://proofgeneral.inf.ed.ac.uk/") |
314 | (synopsis "Generic front-end for proof assistants based on Emacs") |
315 | (description |
316 | "Proof General is a major mode to turn Emacs into an interactive proof |
317 | assistant to write formal mathematical proofs using a variety of theorem |
318 | provers.") |
319 | (license license:gpl2+))) |
320 | |
321 | (define-public ocaml-build |
322 | (package |
323 | (name "ocaml-build") |
324 | (version "0.11.0") |
325 | (source (origin |
326 | (method url-fetch) |
327 | (uri (string-append "https://github.com/ocaml/ocamlbuild/archive/" |
328 | version ".tar.gz")) |
329 | (file-name (string-append name "-" version ".tar.gz")) |
330 | (sha256 |
331 | (base32 |
332 | "1vh30731gv1brr4ljfzd6m5lni44ifyb1w8hwir81ff9874fs5qp")))) |
333 | (build-system gnu-build-system) |
334 | (arguments |
335 | `(#:test-target "test" |
336 | #:tests? #f; FIXME: tests fail to find Findlib |
337 | #:make-flags |
338 | (list (string-append "OCAMLBUILD_PREFIX=" (assoc-ref %outputs "out")) |
339 | (string-append "OCAMLBUILD_BINDIR=" (assoc-ref %outputs "out") "/bin") |
340 | (string-append "OCAMLBUILD_LIBDIR=" (assoc-ref %outputs "out") "/lib") |
341 | (string-append "OCAMLBUILD_MANDIR=" (assoc-ref %outputs "out") "/share/man")) |
342 | #:phases |
343 | (modify-phases %standard-phases |
344 | (delete 'configure) |
345 | ;(replace 'configure |
346 | ; (lambda* (#:key outputs #:allow-other-keys) |
347 | ; (let ((out (assoc-ref %outputs "out"))) |
348 | ; (zero? (system* "make" "-f" "configure.make" "all"))))) |
349 | (add-before 'build 'findlib-environment |
350 | (lambda* (#:key outputs #:allow-other-keys) |
351 | (let* ((out (assoc-ref outputs "out"))) |
352 | (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib")) |
353 | (setenv "OCAMLFIND_LDCONF" "ignore") |
354 | #t)))))) |
355 | (native-inputs |
356 | `(("ocaml" ,ocaml-fix))) |
357 | (home-page "") |
358 | (synopsis "") |
359 | (description "") |
360 | (license license:lgpl2.1+))) |
361 | |
362 | (define-public camlp4-fix |
363 | (package |
364 | (inherit camlp4) |
365 | (name "camlp4") |
366 | (version "4.05+2") |
367 | (source (origin |
368 | (method url-fetch) |
369 | (uri (string-append "https://github.com/ocaml/camlp4/archive/" |
370 | version ".tar.gz")) |
371 | (file-name (string-append name "-" version ".tar.gz")) |
372 | (sha256 |
373 | (base32 |
374 | "0dd9scf50y0928syvxflljwry2dzm35n903fgpfdkpcn907jq96v")))) |
375 | (inputs `(("ocaml" ,ocaml-fix))) |
376 | (native-inputs |
377 | `(("ocaml" ,ocaml-fix) |
378 | ("which" ,which) |
379 | ("build" ,ocaml-build))))) |
380 | |
381 | (define-public ocaml-findlib-fix |
382 | (package |
383 | (inherit ocaml-findlib) |
384 | (native-inputs |
385 | `(("camlp4" ,camlp4-fix) |
386 | ("ocaml" ,ocaml-fix) |
387 | ("m4" ,m4))))) |
388 | |
389 | (define-public camlp5-fix |
390 | (package |
391 | (inherit camlp5) |
392 | (name "camlp5") |
393 | (version "7.03") |
394 | (source (origin |
395 | (method url-fetch) |
396 | (uri (string-append "https://github.com/camlp5/camlp5/archive/rel" |
397 | (string-delete #\. version) ".tar.gz")) |
398 | (sha256 |
399 | (base32 |
400 | "06pj7l75r586gngam7nspd1a13ay7cj2bjh035z64w4fgaahlgf1")))) |
401 | (inputs |
402 | `(("ocaml" ,ocaml-fix))))) |
403 | |
404 | (define-public lablgtk-fix |
405 | (package |
406 | (inherit lablgtk) |
407 | (native-inputs |
408 | `(("ocaml" ,ocaml-fix) |
409 | ("build" ,ocaml-build) |
410 | ("camlp4" ,camlp4-fix) |
411 | ("findlib" ,ocaml-findlib-fix) |
412 | ("pkg-config" ,pkg-config))))) |
413 | |
414 | (define-public ocaml-menhir-fix |
415 | (package |
416 | (inherit ocaml-menhir) |
417 | (version "20170607") |
418 | (name "ocaml-menhir-fix") |
419 | (source (origin |
420 | (method url-fetch) |
421 | (uri (string-append |
422 | "http://gallium.inria.fr/~fpottier/menhir/" |
423 | "menhir-" version ".tar.gz")) |
424 | (sha256 |
425 | (base32 |
426 | "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0")))) |
427 | (inputs |
428 | `(("ocaml" ,ocaml-fix) |
429 | ("ocamlbuild" ,ocaml-build))))) |
430 | |
431 | (define-public coq-fix |
432 | (package |
433 | (inherit coq) |
434 | (native-inputs |
435 | `(("ocamlbuild" ,ocaml-build) |
436 | ("hevea" ,hevea) |
437 | ("texlive" ,texlive))) |
438 | (inputs |
439 | `(("lablgtk" ,lablgtk-fix) |
440 | ("python" ,python-2) |
441 | ("camlp5" ,camlp5-fix))) |
442 | (arguments |
443 | `(#:ocaml ,ocaml-fix |
444 | #:findlib ,ocaml-findlib-fix |
445 | ,@(package-arguments coq))))) |
446 | |
447 | (define-public compcert |
448 | (package |
449 | (name "compcert") |
450 | (version "3.0.1") |
451 | (source (origin |
452 | (method url-fetch) |
453 | (uri (string-append "http://compcert.inria.fr/release/compcert-" |
454 | version ".tgz")) |
455 | (sha256 |
456 | (base32 |
457 | "0dgrj26dzdy4n3s9b5hwc6lm54vans1v4qx9hdp1q8w1qqcdriq9")))) |
458 | (build-system gnu-build-system) |
459 | (arguments |
460 | `(#:phases |
461 | (modify-phases %standard-phases |
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 "6f7adf13fefb7f8d4dc668b8290226e3c6a30063"))) |
532 | (file-name (string-append name "-" version)) |
533 | (sha256 |
534 | (base32 |
535 | "1apaz0b84865xfba0mxbskbnaq6llqsn3qhy8b0sssbdxzw5w1x4")))) |
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-before 'install 'modify-installed-file-list |
544 | (lambda _ |
545 | (substitute* "src/newspeak.Makefile" |
546 | (("c2newspeak/typedC.cmi") |
547 | "c2newspeak/typedC.cmi c2newspeak/typedC.cmx c2newspeak/typedC.o")))) |
548 | (add-after 'install 'install-bin |
549 | (lambda* (#:key outputs #:allow-other-keys) |
550 | (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin"))))))) |
551 | (home-page "https://github.com/airbus-seclab/c2newspeak") |
552 | (synopsis "") |
553 | (description "") |
554 | (license license:lgpl2.1+))) |
555 | |
556 | (define-public ocaml-bincat |
557 | (package |
558 | (name "ocaml-bincat") |
559 | (version "0.6") |
560 | (source (origin |
561 | (method url-fetch) |
562 | (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v" |
563 | version ".tar.gz")) |
564 | (file-name (string-append name "-" version ".tar.gz")) |
565 | (sha256 |
566 | (base32 |
567 | "1762wrvf7fv16kxfvpblj4b0pwbwny1b39263q4jnqni12474djl")))) |
568 | (build-system ocaml-build-system) |
569 | (arguments |
570 | `(#:tests? #f; some failures for unknown reasons |
571 | #:make-flags |
572 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) |
573 | "LDCONFIG=true" |
574 | (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml") |
575 | "/lib/ocaml")) |
576 | #:phases |
577 | (modify-phases %standard-phases |
578 | (delete 'configure) |
579 | (add-before 'build 'python-path |
580 | (lambda _ |
581 | (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH") |
582 | ":../python")))) |
583 | (add-before 'build 'fix-makefile |
584 | (lambda _ |
585 | (substitute* "ocaml/src/Makefile" |
586 | (("GITVERSION:=.*") "GITVERSION:=0.6\n") |
587 | ;; typedC library is embedded in newspeak.cmxa |
588 | (("typedC.cmx") "")))) |
589 | (add-before 'check 'fix-test |
590 | (lambda _ |
591 | (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src")) |
592 | (chmod "test/eggloader_x86" #o755)))))) |
593 | (inputs |
594 | `(("c2newspeak" ,ocaml-c2newspeak) |
595 | ("zarith" ,ocaml-zarith) |
596 | ("menhir" ,ocaml-menhir) |
597 | ("ocamlgraph" ,ocaml-graph) |
598 | ("gmp" ,gmp))) |
599 | (native-inputs |
600 | `(("python" ,python-2) |
601 | ("pytest" ,python2-pytest) |
602 | ("sphinx" ,python2-sphinx) |
603 | ("nasm" ,nasm))) |
604 | (home-page "https://github.com/airbus-seclab/bincat") |
605 | (synopsis "") |
606 | (description "") |
607 | (license license:lgpl2.1+))) |
608 | |
609 |