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 utils)
23
  #:use-module (guix build-system gnu)
24
  #:use-module (guix build-system ocaml)
25
  #:use-module ((guix licenses) #:prefix license:)
26
  #:use-module (gnu packages)
27
  #:use-module (gnu packages base)
28
  #:use-module (gnu packages bison)
29
  #:use-module (gnu packages boost)
30
  #:use-module (gnu packages emacs)
31
  #:use-module (gnu packages flex)
32
  #:use-module (gnu packages llvm)
33
  #:use-module (gnu packages multiprecision)
34
  #:use-module (gnu packages ocaml)
35
  #:use-module (gnu packages perl)
36
  #:use-module (gnu packages protobuf)
37
  #:use-module (gnu packages texinfo))
38
39
;; Janestreet packages are found in a similar way and all need the same patch.
40
(define (janestreet-origin name version hash)
41
  (origin (method url-fetch)
42
          (uri (string-append "https://ocaml.janestreet.com/ocaml-core/"
43
                              (version-major+minor version) "/files/"
44
                              name "-" version ".tar.gz"))
45
          (sha256 (base32 hash))
46
          (modules '((guix build utils)))
47
          (snippet
48
           (let ((pattern (string-append "lib/" name)))
49
             `(begin
50
                ;; install.ml contains an invalid reference to the ppx file and
51
                ;; propagates this error to the generated META file.  It
52
                ;; looks for it in the "lib" directory, but it is installed in
53
                ;; "lib/ocaml/site-lib/package".  This substitute does not change
54
                ;; this file for non ppx packages.
55
                (substitute* "install.ml"
56
                  ((,pattern) (string-append "lib/ocaml/site-lib/" ,name)))
57
                ;; The standard Makefile would try to install janestreet modules
58
                ;; in OCaml's directory in the store, which is read-only.
59
                (substitute* "Makefile"
60
                  (("--prefix")
61
                   "--libdir $(LIBDIR) --prefix")))))))
62
63
;; They also require almost the same set of arguments
64
(define janestreet-arguments
65
  `(#:use-make? #t
66
    #:make-flags
67
    (list (string-append "CONFIGUREFLAGS=--prefix "
68
                         (assoc-ref %outputs "out")
69
                         " --enable-tests")
70
          (string-append "LIBDIR="
71
                         (assoc-ref %outputs "out")
72
                         "/lib/ocaml/site-lib")
73
          ;; for ocaml-bin-prot, otherwise ignored
74
          (string-append "OCAML_TOPLEVEL_PATH="
75
                         (assoc-ref %build-inputs "findlib")
76
                         "/lib/ocaml/site-lib"))
77
    #:phases (modify-phases %standard-phases (delete 'configure))))
78
79
(define-public ocaml-ezjsonm
80
  (package
81
    (name "ocaml-ezjsonm")
82
    (version "0.4.3")
83
    (source (origin
84
              (method url-fetch)
85
              (uri (string-append "https://github.com/mirage/ezjsonm/archive/"
86
                                  version ".tar.gz"))
87
              (sha256
88
               (base32
89
                "1kag0z2xlk4rw73a240dmkxh9rj6psxxcxkm7d7z0rrj6hzjajgq"))
90
              (file-name (string-append name "-" version ".tar.gz"))))
91
    (build-system ocaml-build-system)
92
    (native-inputs
93
     `(("alcotest" ,ocaml-alcotest)))
94
    (propagated-inputs
95
     `(("hex" ,ocaml-hex)
96
       ("jsonm" ,ocaml-jsonm)
97
       ("lwt" ,ocaml-lwt)
98
       ("sexplib" ,ocaml-sexplib)))
99
    (arguments
100
     `(#:configure-flags (list "--enable-lwt")
101
       ;; dllcstruct_stubs.so: cannot open shared object file: No such file
102
       ;; or directory. May be fixed?
103
       #:tests? #f))
104
    (home-page "https://github.com/mirage/ezjsonm/")
105
    (synopsis "An easy interface on top of the Jsonm library")
106
    (description "This version provides more convenient (but far less flexible)
107
input and output functions that go to and from [string] values.  This avoids
108
the need to write signal code, which is useful for quick scripts that
109
manipulate JSON.")
110
    (license license:isc)))
111
112
(define-public ocaml-uri
113
  (package
114
    (name "ocaml-uri")
115
    (version "1.9.2")
116
    (source (origin
117
              (method url-fetch)
118
              (uri (string-append "https://github.com/mirage/ocaml-uri/archive/v"
119
                                  version ".tar.gz"))
120
              (sha256
121
               (base32
122
                "02bzrag79prx261rxf9mlak749pwf4flpfl8p012x1xznv9m0clc"))
123
              (file-name (string-append name "-" version ".tar.gz"))))
124
    (build-system ocaml-build-system)
125
    (native-inputs
126
     `(("ounit" ,ocaml-ounit)))
127
    (propagated-inputs
128
     `(("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
129
       ("re" ,ocaml-re)
130
       ("ppx-deriving" ,ocaml-ppx-deriving)
131
       ("sexplib" ,ocaml-sexplib)
132
       ("stringext" ,ocaml-stringext)))
133
    (home-page "https://github.com/mirage/ocaml-uri")
134
    (synopsis "RFC3986 URI/URL parsing library")
135
    (description "RFC3986 URI/URL parsing library.")
136
    (license license:isc)))
137
138
(define-public ocaml-easy-format
139
  (package
140
    (name "ocaml-easy-format")
141
    (version "1.2.0")
142
    (source (origin
143
              (method url-fetch)
144
              (uri (string-append "https://github.com/mjambon/easy-format/"
145
                                  "archive/v" version ".tar.gz"))
146
              (sha256
147
               (base32
148
                "1zcz682y9figa84k7lgdjcab5qbzk3yy14ygfqp2dhhrvjygm252"))
149
              (file-name (string-append name "-" version ".tar.gz"))))
150
    (build-system ocaml-build-system)
151
    (arguments
152
     `(#:phases
153
       (modify-phases %standard-phases
154
         (delete 'configure))
155
       #:tests? #f))
156
    (home-page "https://github.com/mjambon/easy-format")
157
    (synopsis "High-level and functional interface to the Format module of the
158
OCaml standard library")
159
    (description "High-level and functional interface to the Format module of
160
the OCaml standard library.")
161
    (license license:bsd-3)))
162
163
(define-public ocaml-optcomp
164
  (package
165
    (name "ocaml-optcomp")
166
    (version "1.6")
167
    (source (origin
168
              (method url-fetch)
169
              (uri (string-append "https://github.com/diml/optcomp/archive/"
170
                                  version ".tar.gz"))
171
              (sha256
172
               (base32
173
                "0hhhb2gisah1h22zlg5iszbgqxdd7x85cwd57bd4mfkx9l7dh8jh"))
174
              (file-name (string-append name "-" version ".tar.gz"))))
175
    (build-system ocaml-build-system)
176
    (arguments
177
     `(#:use-make? #t
178
	   #:make-flags
179
       (list (string-append "BUILDFLAGS=\"-cflags -I,"
180
                            (assoc-ref %build-inputs "camlp4")
181
                            "/lib/ocaml/site-lib/camlp4/Camlp4Parsers\""))))
182
    (native-inputs `(("camlp4" ,camlp4)))
183
    (propagated-inputs `(("camlp4" ,camlp4)))
184
    (home-page "https://github.com/diml/optcomp")
185
    (synopsis "Optional compilation with cpp-like directives")
186
    (description "Optional compilation with cpp-like directives.")
187
    (license license:bsd-3)))
188
189
(define-public ocaml-piqilib
190
  (package
191
    (name "ocaml-piqilib")
192
    (version "0.6.13")
193
    (source (origin
194
              (method url-fetch)
195
              (uri (string-append "https://github.com/alavrik/piqi/archive/v"
196
                                  version ".tar.gz"))
197
              (sha256
198
               (base32
199
                "1whqr2bb3gds2zmrzqnv8vqka9928w4lx6mi6g244kmbwb2h8d8l"))
200
              (file-name (string-append name "-" version ".tar.gz"))
201
              (patches (search-patches "ocaml-piqilib-fix-makefile.patch"))))
202
    (build-system ocaml-build-system)
203
    (arguments
204
     `(#:phases
205
       (modify-phases %standard-phases
206
         (replace 'configure
207
           (lambda* (#:key outputs #:allow-other-keys)
208
             (let ((out (assoc-ref outputs "out")))
209
               (substitute* "make/OCamlMakefile"
210
                 (("/bin/sh") (which "bash")))
211
               (zero? (system* "./configure" "--prefix" out "--ocaml-libdir"
212
                               (string-append out "/lib/ocaml/site-lib"))))))
213
       (add-after 'build 'build-ocaml
214
         (lambda* (#:key outputs #:allow-other-keys)
215
           (zero? (system* "make" "ocaml")))) 
216
       (add-after 'install 'install-ocaml
217
         (lambda* (#:key outputs #:allow-other-keys)
218
           (zero? (system* "make" "ocaml-install"))))
219
       (add-after 'install-ocaml 'link-stubs
220
         (lambda* (#:key outputs #:allow-other-keys)
221
           (let* ((out (assoc-ref outputs "out"))
222
                  (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
223
                  (lib (string-append out "/lib/ocaml/site-lib/piqilib")))
224
             (mkdir-p stubs)
225
             (symlink (string-append lib "/dllpiqilib_stubs.so")
226
                      (string-append stubs "/dllpiqilib_stubs.so"))))))))
227
    (native-inputs
228
     `(("which" ,which)
229
       ("camlp4" ,camlp4)))
230
    (propagated-inputs
231
     `(("xmlm" ,ocaml-xmlm)
232
       ("ulex" ,ocaml-ulex)
233
       ("optcomp" ,ocaml-optcomp)
234
       ("easy-format" ,ocaml-easy-format)
235
       ("base64" ,ocaml-base64)))
236
    (home-page "http://piqi.org")
237
    (synopsis "Data serialization and conversion library")
238
    (description "Common library used by piqi command-line tool and piqi-ocaml.")
239
    (license license:asl2.0)))
240
241
(define-public ocaml-uuidm
242
  (package
243
    (name "ocaml-uuidm")
244
    (version "0.9.6")
245
    (source (origin
246
              (method url-fetch)
247
              (uri (string-append "http://erratique.ch/software/uuidm/"
248
                                  "releases/uuidm-" version ".tbz"))
249
              (sha256
250
               (base32
251
                "0hz4fdx0x16k0pw9995vkz5d1hmzz6b16wck9li399rcbfnv5jlc"))))
252
    (build-system ocaml-build-system)
253
    (arguments
254
     `(#:tests? #f
255
       #:build-flags
256
       (list "build" "--with-cmdliner" "true")
257
       #:phases
258
       (modify-phases %standard-phases
259
         (delete 'configure))))
260
    (native-inputs
261
     `(("opam" ,opam)))
262
    (propagated-inputs
263
     `(("cmdliner" ,ocaml-cmdliner)
264
       ("topkg" ,ocaml-topkg)))
265
    (home-page "http://erratique.ch/software/uuidm")
266
    (synopsis "Universally unique identifiers (UUIDs) for OCaml")
267
    (description "Uuidm is an OCaml module implementing 128 bits universally
268
unique identifiers version 3, 5 (named based with MD5, SHA-1 hashing) and 4
269
(random based) according to RFC 4122.")
270
    (license license:isc)))
271
272
(define-public ocamlgraph
273
  (package
274
    (name "ocamlgraph")
275
    (version "1.8.7")
276
    (source (origin
277
              (method url-fetch)
278
              (uri (string-append "http://ocamlgraph.lri.fr/download/"
279
                                  "ocamlgraph-" version ".tar.gz"))
280
              (sha256
281
               (base32
282
                "1845r537swjil2fcj7lgbibc2zybfwqqasrd2s7bncajs83cl1nz"))
283
              (patches (search-patches "ocamlgraph-honor-source-date-epoch.patch"))))
284
    (build-system ocaml-build-system)
285
    (arguments
286
     `(#:install-target "install-findlib"
287
       #:phases
288
       (modify-phases %standard-phases
289
         (add-before 'configure 'fix-/bin/sh
290
           (lambda* (#:key inputs #:allow-other-keys)
291
             (substitute* "configure"
292
               (("-/bin/sh") (string-append "-" (assoc-ref inputs "bash")
293
                                            "/bin/sh"))))))))
294
    (inputs `(("lablgtk" ,lablgtk)))
295
    (home-page "http://ocamlgraph.lri.fr/")
296
    (synopsis "A generic graph library for OCaml")
297
    (description "A generic graph library for OCaml.")
298
    (license license:lgpl2.1)))
299
300
(define-public ocaml-piqi
301
  (package
302
    (name "ocaml-piqi")
303
    (version "0.7.5")
304
    (source (origin
305
              (method url-fetch)
306
              (uri (string-append "https://github.com/alavrik/piqi-ocaml/"
307
                                  "archive/v" version ".tar.gz"))
308
              (sha256
309
               (base32
310
                "0ngz6y8i98i5v2ma8nk6mc83pdsmf2z0ks7m3xi6clfg3zqbddrv"))))
311
    (build-system ocaml-build-system)
312
    (arguments
313
     `(#:make-flags
314
       (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
315
       #:phases
316
       (modify-phases %standard-phases
317
         (delete 'configure)
318
         (add-before 'build 'patch-/bin/sh
319
           (lambda _
320
             (substitute* "make/OCamlMakefile"
321
               (("/bin/sh") (which "sh")))
322
             #t)))))
323
    (native-inputs
324
     `(("which" ,which)
325
       ("protobuf" ,protobuf))) ; for tests
326
    (propagated-inputs
327
     `(("piqilib" ,ocaml-piqilib)))
328
    (home-page "https://github.com/alavrik/piqi-ocaml")
329
    (synopsis "Protocol serialization system for OCaml")
330
    (description "Piqi is a multi-format data serialization system for OCaml.
331
It provides a uniform interface for serializing OCaml data structures to JSON,
332
XML and Protocol Buffers formats.")
333
    (license license:asl2.0)))
334
335
(define-public bap
336
  (package
337
    (name "bap")
338
    (version "1.1.0")
339
    (home-page "https://github.com/BinaryAnalysisPlatform/bap")
340
    (source (origin
341
              (method url-fetch)
342
              (uri (string-append home-page "/archive/v" version ".tar.gz"))
343
              (sha256
344
               (base32
345
                "1ms95m4j1qrmy7zqmsn2izh7gq68lnmssl7chyhk977kd3sxj66m"))
346
              (file-name (string-append name "-" version ".tar.gz"))))
347
   (build-system ocaml-build-system)
348
   (native-inputs
349
    `(("oasis" ,ocaml-oasis)
350
      ("clang" ,clang)
351
      ("ounit" ,ocaml-ounit)))
352
   (propagated-inputs
353
    `(("core-kernel" ,ocaml-core-kernel)
354
      ("ppx-driver" ,ocaml-ppx-driver)
355
      ("uri" ,ocaml-uri)
356
      ("llvm" ,llvm)
357
      ("gmp" ,gmp)
358
      ("clang-runtime" ,clang-runtime)
359
      ("fileutils" ,ocaml-fileutils)
360
      ("cmdliner" ,ocaml-cmdliner)
361
      ("zarith" ,ocaml-zarith)
362
      ("uuidm" ,ocaml-uuidm)
363
      ("camlzip" ,camlzip)
364
      ("frontc" ,ocaml-frontc)
365
      ("ezjsonm" ,ocaml-ezjsonm)
366
      ("ocurl" ,ocaml-ocurl)
367
      ("piqi" ,ocaml-piqi)
368
      ("ocamlgraph" ,ocamlgraph)
369
      ("bitstring" ,ocaml-bitstring)
370
      ("ppx-jane" ,ocaml-ppx-jane)
371
      ("re" ,ocaml-re)))
372
   (inputs `(("llvm" ,llvm)))
373
   (arguments
374
    `(#:use-make? #t
375
      #:phases
376
      (modify-phases %standard-phases
377
        (replace 'configure
378
          (lambda* (#:key outputs #:allow-other-keys)
379
            (zero? (system* "./configure" "--prefix"
380
                            (assoc-ref outputs "out")
381
                            "--libdir"
382
                            (string-append
383
                              (assoc-ref outputs "out")
384
                              "/lib/ocaml/site-lib")
385
                            "--with-llvm-version=3.8"
386
                            "--with-llvm-config=llvm-config"
387
                            "--enable-everything"))))
388
        (add-before 'install 'fix-ocamlpath
389
          (lambda* (#:key outputs #:allow-other-keys)
390
            (setenv "OCAMLPATH"
391
                    (string-append
392
                      (getenv "OCAMLPATH") ":"
393
                      (assoc-ref outputs "out")
394
                      "/lib/ocaml/site-lib"))
395
            (setenv "PATH"
396
                    (string-append (getenv "PATH") ":"
397
                                   (assoc-ref outputs "out") "/bin"))))
398
        (add-after 'install 'link-stubs
399
          (lambda* (#:key outputs #:allow-other-keys)
400
            (let* ((out (assoc-ref outputs "out"))
401
                   (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
402
                   (lib (string-append out "/lib/ocaml/site-lib/bap-plugin-llvm")))
403
              (mkdir-p stubs)
404
              (symlink (string-append lib "/dllllvm_plugin_stubs.so")
405
                       (string-append stubs "/dllllvm_plugin_stubs.so"))))))))
406
   (synopsis "Binary Analysis Platform")
407
   (description "Binary Analysis Platform is a framework for writing program
408
analysis tools, that target binary files.  The framework consists of a plethora
409
of libraries, plugins, and frontends.  The libraries provide code reusability,
410
the plugins facilitate extensibility, and the frontends serve as entry points.")
411
   (license license:expat)))
412
413
(define-public ocaml-camomile
414
  (package
415
    (name "ocaml-camomile")
416
    (version "0.8.5")
417
    (home-page "https://github.com/yoriyuki/Camomile")
418
    (source (origin
419
              (method url-fetch)
420
              (uri (string-append home-page "/releases/download/rel-" version
421
                                  "/camomile-" version ".tar.bz2"))
422
              (sha256
423
               (base32
424
                "003ikpvpaliy5hblhckfmln34zqz0mk3y2m1fqvbjngh3h2np045"))))
425
    (build-system ocaml-build-system)
426
    (native-inputs `(("camlp4" ,camlp4)))
427
    (arguments
428
     `(#:phases
429
       (modify-phases %standard-phases
430
         (add-before 'configure 'fix-bin/sh
431
           (lambda* (#:key #:allow-other-keys)
432
             (substitute* "configure"
433
               (("CONFIG_SHELL-/bin/sh")
434
                (string-append "CONFIG_SHELL-" (which "bash")))))))))
435
    (synopsis "Comprehensive Unicode library")
436
    (description "Camomile is a Unicode library for OCaml.  Camomile provides
437
Unicode character type, UTF-8, UTF-16, UTF-32 strings, conversion to/from about
438
200 encodings, collation and locale-sensitive case mappings, and more.  The
439
library is currently designed for Unicode Standard 3.2.")
440
    (license license:lgpl2.0+))) ; with an exception
441
442
(define-public ocaml-zed
443
  (package
444
    (name "ocaml-zed")
445
    (version "1.4")
446
    (source (origin
447
              (method url-fetch)
448
              (uri (string-append "https://github.com/diml/zed/archive/"
449
                                  version ".tar.gz"))
450
              (sha256
451
               (base32
452
                "0pvfq9ikhbkv4ksn3k3vzs6wiwkihjav3n81lhxm54z9931gfwnz"))))
453
    (build-system ocaml-build-system)
454
    (propagated-inputs
455
     `(("camomile" ,ocaml-camomile)
456
       ("react" ,ocaml-react)))
457
    (home-page "https://github.com/diml/zed")
458
    (synopsis "Abstract engine for text edition in OCaml")
459
    (description "Zed is an abstract engine for text edition. It can be used to
460
write text editors, edition widgets, readlines, ...
461
462
Zed uses Camomile to fully support the Unicode specification, and implements an
463
UTF-8 encoded string type with validation, and a rope datastructure to achieve
464
efficient operations on large Unicode buffers. Zed also features a regular
465
expression search on ropes.
466
467
To support efficient text edition capabilities, Zed provides macro recording
468
and cursor management facilities.")
469
    (license license:bsd-3)))
470
471
(define-public ocaml-lambda-term
472
  (package
473
    (name "ocaml-lambda-term")
474
    (version "1.10.1")
475
    (home-page "https://github.com/diml/lambda-term")
476
    (source (origin
477
              (method url-fetch)
478
              (uri (string-append home-page "/archive/" version ".tar.gz"))
479
              (sha256
480
               (base32
481
                "1449glcsavcwbcsxbd7wcjz50y8vvin4zwpmkhq8i6jca3f3sknj"))))
482
    (build-system ocaml-build-system)
483
    (propagated-inputs
484
     `(("zed" ,ocaml-zed)
485
       ("lwt" ,ocaml-lwt)
486
       ("react" ,ocaml-react)))
487
    (arguments
488
     `(#:phases
489
       (modify-phases %standard-phases
490
        (add-after 'install 'link-stubs
491
          (lambda* (#:key outputs #:allow-other-keys)
492
            (let* ((out (assoc-ref outputs "out"))
493
                   (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
494
                   (lib (string-append out "/lib/ocaml/site-lib/lambda-term")))
495
              (mkdir-p stubs)
496
              (symlink (string-append lib "/dlllambda-term_stubs.so")
497
                       (string-append stubs "/dlllambda-term_stubs.so"))))))))
498
    (synopsis "Terminal manipulation library for OCaml")
499
    (description "Lambda-term is a cross-platform library for manipulating the
500
terminal. It provides an abstraction for keys, mouse events, colors, as well as
501
a set of widgets to write curses-like applications.
502
503
The main objective of lambda-term is to provide a higher level functional
504
interface to terminal manipulation than, for example, ncurses, by providing a
505
native OCaml interface instead of bindings to a C library.
506
507
Lambda-term integrates with zed to provide text edition facilities in console
508
applications.")
509
    (license license:bsd-3)))
510
511
(define-public ocaml-utop
512
  (package
513
    (name "ocaml-utop")
514
    (version "1.19.3")
515
    (source (origin
516
              (method url-fetch)
517
              (uri (string-append "https://github.com/diml/utop/archive/"
518
                                  version ".tar.gz"))
519
              (file-name (string-append name "-" version ".tar.gz"))
520
              (sha256
521
               (base32
522
                "16z02vp9n97iax4fqpbi7v86r75vbabxvnd1rirh8w2miixs1g4x"))))
523
    (build-system ocaml-build-system)
524
    (native-inputs
525
     `(("cppo" ,ocaml-cppo)))
526
    (propagated-inputs
527
     `(("lambda-term" ,ocaml-lambda-term)
528
       ("lwt" ,ocaml-lwt)
529
       ("react" ,ocaml-react)))
530
    (home-page "https://github.com/diml/utop")
531
    (synopsis "Universal toplevel for OCaml")
532
    (description "utop is an improved toplevel for OCaml.  It can run in a
533
terminal or in Emacs.  It supports line edition, history, real-time and context
534
sensitive completion, colors, and more.
535
536
It integrates with the tuareg mode in Emacs.")
537
    (license license:bsd-3)))
538
539
(define-public proof-general2
540
  (package
541
    (name "proof-general2")
542
    (version "4.4")
543
    (source (origin
544
              (method url-fetch)
545
              (uri (string-append
546
                    "https://github.com/ProofGeneral/PG/archive/v"
547
                    version ".tar.gz"))
548
              (file-name (string-append name "-" version ".tar.gz"))
549
              (sha256
550
               (base32
551
                "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv"))))
552
    (build-system gnu-build-system)
553
    (native-inputs
554
     `(("which" ,which)
555
       ("emacs" ,emacs-minimal)
556
       ("texinfo" ,texinfo)))
557
    (inputs
558
     `(("host-emacs" ,emacs)
559
       ("perl" ,perl)
560
       ("coq" ,coq)))
561
    (arguments
562
     `(#:tests? #f  ; no check target
563
       #:make-flags (list (string-append "PREFIX=" %output)
564
                          (string-append "DEST_PREFIX=" %output)
565
                          "-j1")
566
       #:modules ((guix build gnu-build-system)
567
                  (guix build utils)
568
                  (guix build emacs-utils))
569
       #:imported-modules (,@%gnu-build-system-modules
570
                           (guix build emacs-utils))
571
       #:phases
572
       (modify-phases %standard-phases
573
         (delete 'configure)
574
         (add-after 'unpack 'disable-byte-compile-error-on-warn
575
                    (lambda _
576
                      (substitute* "Makefile"
577
                        (("\\(setq byte-compile-error-on-warn t\\)")
578
                         "(setq byte-compile-error-on-warn nil)"))
579
                      #t))
580
         (add-after 'unpack 'patch-hardcoded-paths
581
                    (lambda* (#:key inputs outputs #:allow-other-keys)
582
                      (let ((out   (assoc-ref outputs "out"))
583
                            (coq   (assoc-ref inputs "coq"))
584
                            (emacs (assoc-ref inputs "host-emacs")))
585
                        (define (coq-prog name)
586
                          (string-append coq "/bin/" name))
587
                        (substitute* "pgshell/pgshell.el"
588
                          (("/bin/sh") (which "sh")))
589
                        ;(emacs-substitute-variables "coq/coq.el"
590
                        ;  ("coq-prog-name"           (coq-prog "coqtop"))
591
                        ;  ("coq-compiler"            (coq-prog "coqc"))
592
                        ;  ("coq-dependency-analyzer" (coq-prog "coqdep")))
593
                        (substitute* "Makefile"
594
                          (("/sbin/install-info") "install-info"))
595
                        (substitute* "bin/proofgeneral"
596
                          (("^PGHOMEDEFAULT=.*" all)
597
                           (string-append all
598
                                          "PGHOME=$PGHOMEDEFAULT\n"
599
                                          "EMACS=" emacs "/bin/emacs")))
600
                        #t))))))
601
         ;(add-after 'unpack 'clean
602
         ;           (lambda _
603
         ;             ;; Delete the pre-compiled elc files for Emacs 23.
604
         ;             (zero? (system* "make" "clean"))))
605
         ;(add-after 'install 'install-doc
606
         ;           (lambda* (#:key make-flags #:allow-other-keys)
607
         ;             ;; XXX FIXME avoid building/installing pdf files,
608
         ;             ;; due to unresolved errors building them.
609
         ;             (substitute* "Makefile"
610
         ;               ((" [^ ]*\\.pdf") ""))
611
         ;             (zero? (apply system* "make" "install-doc"
612
         ;                           make-flags)))))))
613
    (home-page "http://proofgeneral.inf.ed.ac.uk/")
614
    (synopsis "Generic front-end for proof assistants based on Emacs")
615
    (description
616
     "Proof General is a major mode to turn Emacs into an interactive proof
617
assistant to write formal mathematical proofs using a variety of theorem
618
provers.")
619
    (license license:gpl2+)))
620
621
(define-public ocaml-menhir-fix
622
  (package
623
    (inherit ocaml-menhir)
624
    (version "20170607")
625
    (name "ocaml-menhir-fix")
626
    (source (origin
627
              (method url-fetch)
628
              (uri (string-append
629
                    "http://gallium.inria.fr/~fpottier/menhir/"
630
                    "menhir-" version ".tar.gz"))
631
              (sha256
632
               (base32
633
                "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0"))))))
634
635
(define-public compcert
636
  (package
637
    (name "compcert")
638
    (version "3.0.1")
639
    (source (origin
640
              (method url-fetch)
641
              (uri (string-append "http://compcert.inria.fr/release/compcert-"
642
                                  version ".tgz"))
643
              (sha256
644
               (base32
645
                "0dgrj26dzdy4n3s9b5hwc6lm54vans1v4qx9hdp1q8w1qqcdriq9"))))
646
    (build-system gnu-build-system)
647
    (arguments
648
     `(#:phases
649
       (modify-phases %standard-phases
650
         (replace 'configure
651
           (lambda* (#:key outputs #:allow-other-keys)
652
             (zero? (system* "./configure" "x86_64-linux" "-prefix"
653
                             (assoc-ref outputs "out"))))))
654
       #:tests? #f))
655
    (native-inputs
656
     `(("ocaml" ,ocaml)
657
       ("coq" ,coq-fix)))
658
    (inputs
659
     `(("menhir" ,ocaml-menhir-fix)))
660
    (home-page "http://compcert.inria.fr")
661
    (synopsis "Certified C compiler")
662
    (description "CompCert is a certified (with coq) C compiler.  Warning: this
663
package is not free software!")
664
    ;; actually the "INRIA Non-Commercial License Agreement"
665
    ;; a non-free license.
666
    (license (license:non-copyleft "file:///LICENSE"))))
667
668
;; yet another build system <3
669
;; In this one, the autoconf-generated configure script configures the build and
670
;; builds remake from source, a make-like system specific to this package.
671
(define-public coq-flocq
672
  (package
673
    (name "coq-flocq")
674
    (version "2.5.2")
675
    (source (origin
676
              (method url-fetch)
677
              (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36199/flocq-"
678
                                  version ".tar.gz"))
679
              (sha256
680
               (base32
681
                "0h5mlasirfzc0wwn2isg4kahk384n73145akkpinrxq5jsn5d22h"))))
682
    (build-system gnu-build-system)
683
    (native-inputs
684
     `(("ocaml" ,ocaml)
685
       ("which" ,which)
686
       ("coq" ,coq-fix)))
687
    (arguments
688
     `(#:configure-flags
689
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
690
                            "/lib/coq/user-contrib/Flocq"))
691
       #:phases
692
       (modify-phases %standard-phases
693
         (add-before 'configure 'fix-remake
694
           (lambda _
695
             (substitute* "remake.cpp"
696
               (("/bin/sh") (which "sh")))))
697
         (replace 'build
698
           (lambda _
699
             (zero? (system* "./remake"))))
700
         (replace 'check
701
           (lambda _
702
             (zero? (system* "./remake" "check"))))
703
             ;; TODO: requires coq-gappa and coq-interval.
704
             ;(zero? (system* "./remake" "check-more"))))
705
         (replace 'install
706
           (lambda _
707
             (zero? (system* "./remake" "install")))))))
708
    (home-page "http://flocq.gforge.inria.fr/")
709
    (synopsis "Floating-point formalization for the Coq system")
710
    (description "Flocq (Floats for Coq) is a floating-point formalization for
711
the Coq system.  It provides a comprehensive library of theorems on a multi-radix
712
multi-precision arithmetic.  It also supports efficient numerical computations
713
inside Coq.")
714
    (license license:lgpl3+)))
715
716
(define-public coq-gappa
717
  (package
718
    (name "coq-gappa")
719
    (version "1.3.1")
720
    (source (origin
721
              (method url-fetch)
722
              (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36351/gappa-"
723
                                  version ".tar.gz"))
724
              (sha256
725
               (base32
726
                "0924jr6f15fx22qfsvim5vc0qxqg30ivg9zxj34lf6slbgdl3j39"))))
727
    (build-system gnu-build-system)
728
    (native-inputs
729
     `(("ocaml" ,ocaml)
730
       ("which" ,which)
731
       ("coq" ,coq-fix)
732
       ("bison" ,bison)
733
       ("flex" ,flex)))
734
    (inputs
735
     `(("gmp" ,gmp)
736
       ("mpfr" ,mpfr)
737
       ("boost" ,boost)))
738
    (arguments
739
     `(#:configure-flags
740
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
741
                            "/lib/coq/user-contrib/Gappa"))
742
       #:phases
743
       (modify-phases %standard-phases
744
         (add-before 'configure 'fix-remake
745
           (lambda _
746
             (substitute* "remake.cpp"
747
               (("/bin/sh") (which "sh")))))
748
         (replace 'build
749
           (lambda _
750
             (zero? (system* "./remake"))))
751
         (replace 'check
752
           (lambda _
753
             (zero? (system* "./remake" "check"))))
754
         (replace 'install
755
           (lambda _
756
             (zero? (system* "./remake" "install")))))))
757
    (home-page "http://gappa.gforge.inria.fr/")
758
    (synopsis "Verify and formally prove properties on numerical programs")
759
    (description "Gappa is a tool intended to help verifying and formally proving
760
properties on numerical programs dealing with floating-point or fixed-point
761
arithmetic.  It has been used to write robust floating-point filters for CGAL
762
and it is used to certify elementary functions in CRlibm.  While Gappa is
763
intended to be used directly, it can also act as a backend prover for the Why3
764
software verification plateform or as an automatic tactic for the Coq proof
765
assistant.")
766
    (license (list license:gpl2 license:cecill))))
767
768
(define-public coq-mathcomp
769
  (package
770
    (name "coq-mathcomp")
771
    (version "1.6.1")
772
    (source (origin
773
              (method url-fetch)
774
              (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
775
                                  version ".tar.gz"))
776
              (sha256
777
               (base32
778
                "1j9ylggjzrxz1i2hdl2yhsvmvy5z6l4rprwx7604401080p5sgjw"))))
779
    (build-system gnu-build-system)
780
    (native-inputs
781
     `(("ocaml" ,ocaml)
782
       ("which" ,which)
783
       ("coq" ,coq-fix)))
784
    (arguments
785
     `(#:tests? #f; No need to test formally-verified programs :)
786
       #:phases
787
       (modify-phases %standard-phases
788
         (delete 'configure)
789
         (add-before 'build 'chdir
790
           (lambda _
791
             (chdir "mathcomp")))
792
         (replace 'install
793
           (lambda* (#:key outputs #:allow-other-keys)
794
             (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
795
             (zero? (system* "make" "-f" "Makefile.coq"
796
                             (string-append "COQLIB=" (assoc-ref outputs "out")
797
                                            "/lib/coq/")
798
                             "install")))))))
799
    (home-page "https://math-comp.github.io/math-comp/")
800
    (synopsis "Mathematical Components for Coq")
801
    (description "Mathematical Components for Coq has its origins in the formal
802
proof of the Four Colour Theorem.  Since then it has grown to cover many areas
803
of mathematics and has been used for large scale projects like the formal proof
804
of the Odd Order Theorem.
805
806
The library is written using the Ssreflect proof language that is an integral
807
part of the distribution.")
808
    (license license:cecill-b)))
809
810
(define-public coq-coquelicot
811
  (package
812
    (name "coq-coquelicot")
813
    (version "3.0.0")
814
    (source (origin
815
              (method url-fetch)
816
              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
817
                                  "file/36537/coquelicot-" version ".tar.gz"))
818
              (sha256
819
               (base32
820
                "0fx99bvsbdizj00gx2im8939y4wwl05f4qhw184j90kcx5vjxxv9"))))
821
    (build-system gnu-build-system)
822
    (native-inputs
823
     `(("ocaml" ,ocaml)
824
       ("which" ,which)
825
       ("coq" ,coq-fix)))
826
    (propagated-inputs
827
     `(("mathcomp" ,coq-mathcomp)))
828
    (arguments
829
     `(#:configure-flags
830
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
831
                            "/lib/coq/user-contrib/Coquelicot"))
832
       #:phases
833
       (modify-phases %standard-phases
834
         (add-before 'configure 'fix-remake
835
           (lambda _
836
             (substitute* "remake.cpp"
837
               (("/bin/sh") (which "sh")))))
838
         (replace 'build
839
           (lambda _
840
             (zero? (system* "./remake"))))
841
         (replace 'check
842
           (lambda _
843
             (zero? (system* "./remake" "check"))))
844
         (replace 'install
845
           (lambda _
846
             (zero? (system* "./remake" "install")))))))
847
    (home-page "http://coquelicot.saclay.inria.fr/index.html")
848
    (synopsis "Coq library for Reals")
849
    (description "Coquelicot is an easier way of writing formulas and theorem
850
statements, achieved by relying on total functions in place of dependent types
851
for limits, derivatives, integrals, power series, and so on.  To help with the
852
proof process, the library comes with a comprehensive set of theorems that cover
853
not only these notions, but also some extensions such as parametric integrals,
854
two-dimensional differentiability, asymptotic behaviors.  It also offers some
855
automations for performing differentiability proofs.  Moreover, Coquelicot is a
856
conservative extension of Coq's standard library and provides correspondence
857
theorems between the two libraries.")
858
    (license license:lgpl3+)))
859
860
(define-public coq-interval
861
  (package
862
    (name "coq-interval")
863
    (version "3.2.0")
864
    (source (origin
865
              (method url-fetch)
866
              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
867
                                  "file/36538/interval-" version ".tar.gz"))
868
              (sha256
869
               (base32
870
                "16ir7mizl18kwa1ls8fwjih6r87894bvc1r6lh85cd43la7nriq3"))))
871
    (build-system gnu-build-system)
872
    (native-inputs
873
     `(("ocaml" ,ocaml)
874
       ("which" ,which)
875
       ("coq" ,coq-fix)))
876
    (propagated-inputs
877
     `(("flocq" ,coq-flocq)
878
       ("coquelicot" ,coq-coquelicot)
879
       ("mathcomp" ,coq-mathcomp)))
880
    (arguments
881
     `(#:configure-flags
882
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
883
                            "/lib/coq/user-contrib/Gappa"))
884
       #:phases
885
       (modify-phases %standard-phases
886
         (add-before 'configure 'fix-remake
887
           (lambda _
888
             (substitute* "remake.cpp"
889
               (("/bin/sh") (which "sh")))))
890
         (replace 'build
891
           (lambda _
892
             (zero? (system* "./remake"))))
893
         (replace 'check
894
           (lambda _
895
             (zero? (system* "./remake" "check"))))
896
         (replace 'install
897
           (lambda _
898
             (zero? (system* "./remake" "install")))))))
899
    (home-page "http://coq-interval.gforge.inria.fr/")
900
    (synopsis "Coq tactics to simplify inequality proofs")
901
    (description "Interval provides vernacular files containing tactics for
902
simplifying the proofs of inequalities on expressions of real numbers for the
903
Coq proof assistant.")
904
    (license license:cecill-c)))
905
906
(define-public coq-fix
907
  (package
908
    (inherit coq)
909
    (name "coq-fix")
910
    (version "8.6")
911
    (source (origin
912
              (method url-fetch)
913
              (uri (string-append "https://coq.inria.fr/distrib/V" version
914
                                  "/files/coq-" version ".tar.gz"))
915
              (sha256
916
               (base32
917
                "1pw1xvy1657l1k69wrb911iqqflzhhp8wwsjvihbgc72r3skqg3f"))))
918
    (native-search-paths
919
      (list (search-path-specification
920
              (variable "COQPATH")
921
              (files (list "lib/coq/user-contrib")))))))
922