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 compcert
622
  (package
623
    (name "compcert")
624
    (version "3.0")
625
    (source (origin
626
              (method url-fetch)
627
              (uri (string-append "http://compcert.inria.fr/release/compcert-"
628
                                  version ".tgz"))
629
              (sha256
630
               (base32
631
                "03fxf01acvy0akzb1czk33jsfmv2rka0m0jc1a2gmzs9i192rr7m"))))
632
    (build-system gnu-build-system)
633
    (arguments
634
     `(#:phases
635
       (modify-phases %standard-phases
636
         (replace 'configure
637
           (lambda* (#:key outputs #:allow-other-keys)
638
             (zero? (system* "./configure" "x86_64-linux" "-prefix"
639
                             (assoc-ref outputs "out"))))))
640
       #:tests? #f))
641
    (native-inputs
642
     `(("ocaml" ,ocaml)
643
       ("coq" ,coq)))
644
    (inputs
645
     `(("menhir" ,ocaml-menhir)))
646
    (home-page "http://compcert.inria.fr")
647
    (synopsis "Certified C compiler")
648
    (description "CompCert is a certified (with coq) C compiler.  Warning: this
649
package is not free software!")
650
    ;; actually the "INRIA Non-Commercial License Agreement"
651
    ;; a non-free license.
652
    (license (license:non-copyleft "file:///LICENSE"))))
653
654
;; yet another build system <3
655
;; In this one, the autoconf-generated configure script configures the build and
656
;; builds remake from source, a make-like system specific to this package.
657
(define-public coq-flocq
658
  (package
659
    (name "coq-flocq")
660
    (version "2.5.2")
661
    (source (origin
662
              (method url-fetch)
663
              (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36199/flocq-"
664
                                  version ".tar.gz"))
665
              (sha256
666
               (base32
667
                "0h5mlasirfzc0wwn2isg4kahk384n73145akkpinrxq5jsn5d22h"))))
668
    (build-system gnu-build-system)
669
    (native-inputs
670
     `(("ocaml" ,ocaml)
671
       ("which" ,which)
672
       ("coq" ,coq-fix)))
673
    (arguments
674
     `(#:configure-flags
675
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
676
                            "/lib/coq/user-contrib/Flocq"))
677
       #:phases
678
       (modify-phases %standard-phases
679
         (add-before 'configure 'fix-remake
680
           (lambda _
681
             (substitute* "remake.cpp"
682
               (("/bin/sh") (which "sh")))))
683
         (replace 'build
684
           (lambda _
685
             (zero? (system* "./remake"))))
686
         (replace 'check
687
           (lambda _
688
             (zero? (system* "./remake" "check"))))
689
             ;; TODO: requires coq-gappa and coq-interval.
690
             ;(zero? (system* "./remake" "check-more"))))
691
         (replace 'install
692
           (lambda _
693
             (zero? (system* "./remake" "install")))))))
694
    (home-page "http://flocq.gforge.inria.fr/")
695
    (synopsis "Floating-point formalization for the Coq system")
696
    (description "Flocq (Floats for Coq) is a floating-point formalization for
697
the Coq system.  It provides a comprehensive library of theorems on a multi-radix
698
multi-precision arithmetic.  It also supports efficient numerical computations
699
inside Coq.")
700
    (license license:lgpl3+)))
701
702
(define-public coq-gappa
703
  (package
704
    (name "coq-gappa")
705
    (version "1.3.1")
706
    (source (origin
707
              (method url-fetch)
708
              (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36351/gappa-"
709
                                  version ".tar.gz"))
710
              (sha256
711
               (base32
712
                "0924jr6f15fx22qfsvim5vc0qxqg30ivg9zxj34lf6slbgdl3j39"))))
713
    (build-system gnu-build-system)
714
    (native-inputs
715
     `(("ocaml" ,ocaml)
716
       ("which" ,which)
717
       ("coq" ,coq-fix)
718
       ("bison" ,bison)
719
       ("flex" ,flex)))
720
    (inputs
721
     `(("gmp" ,gmp)
722
       ("mpfr" ,mpfr)
723
       ("boost" ,boost)))
724
    (arguments
725
     `(#:configure-flags
726
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
727
                            "/lib/coq/user-contrib/Gappa"))
728
       #:phases
729
       (modify-phases %standard-phases
730
         (add-before 'configure 'fix-remake
731
           (lambda _
732
             (substitute* "remake.cpp"
733
               (("/bin/sh") (which "sh")))))
734
         (replace 'build
735
           (lambda _
736
             (zero? (system* "./remake"))))
737
         (replace 'check
738
           (lambda _
739
             (zero? (system* "./remake" "check"))))
740
         (replace 'install
741
           (lambda _
742
             (zero? (system* "./remake" "install")))))))
743
    (home-page "http://gappa.gforge.inria.fr/")
744
    (synopsis "Verify and formally prove properties on numerical programs")
745
    (description "Gappa is a tool intended to help verifying and formally proving
746
properties on numerical programs dealing with floating-point or fixed-point
747
arithmetic.  It has been used to write robust floating-point filters for CGAL
748
and it is used to certify elementary functions in CRlibm.  While Gappa is
749
intended to be used directly, it can also act as a backend prover for the Why3
750
software verification plateform or as an automatic tactic for the Coq proof
751
assistant.")
752
    (license (list license:gpl2 license:cecill))))
753
754
(define-public coq-mathcomp
755
  (package
756
    (name "coq-mathcomp")
757
    (version "1.6.1")
758
    (source (origin
759
              (method url-fetch)
760
              (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
761
                                  version ".tar.gz"))
762
              (sha256
763
               (base32
764
                "1j9ylggjzrxz1i2hdl2yhsvmvy5z6l4rprwx7604401080p5sgjw"))))
765
    (build-system gnu-build-system)
766
    (native-inputs
767
     `(("ocaml" ,ocaml)
768
       ("which" ,which)
769
       ("coq" ,coq-fix)))
770
    (arguments
771
     `(#:tests? #f; No need to test formally-verified programs :)
772
       #:phases
773
       (modify-phases %standard-phases
774
         (delete 'configure)
775
         (add-before 'build 'chdir
776
           (lambda _
777
             (chdir "mathcomp")))
778
         (replace 'install
779
           (lambda* (#:key outputs #:allow-other-keys)
780
             (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
781
             (zero? (system* "make" "-f" "Makefile.coq"
782
                             (string-append "COQLIB=" (assoc-ref outputs "out")
783
                                            "/lib/coq/")
784
                             "install")))))))
785
    (home-page "https://math-comp.github.io/math-comp/")
786
    (synopsis "Mathematical Components for Coq")
787
    (description "Mathematical Components for Coq has its origins in the formal
788
proof of the Four Colour Theorem.  Since then it has grown to cover many areas
789
of mathematics and has been used for large scale projects like the formal proof
790
of the Odd Order Theorem.
791
792
The library is written using the Ssreflect proof language that is an integral
793
part of the distribution.")
794
    (license license:cecill-b)))
795
796
(define-public coq-coquelicot
797
  (package
798
    (name "coq-coquelicot")
799
    (version "3.0.0")
800
    (source (origin
801
              (method url-fetch)
802
              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
803
                                  "file/36537/coquelicot-" version ".tar.gz"))
804
              (sha256
805
               (base32
806
                "0fx99bvsbdizj00gx2im8939y4wwl05f4qhw184j90kcx5vjxxv9"))))
807
    (build-system gnu-build-system)
808
    (native-inputs
809
     `(("ocaml" ,ocaml)
810
       ("which" ,which)
811
       ("coq" ,coq-fix)))
812
    (propagated-inputs
813
     `(("mathcomp" ,coq-mathcomp)))
814
    (arguments
815
     `(#:configure-flags
816
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
817
                            "/lib/coq/user-contrib/Coquelicot"))
818
       #:phases
819
       (modify-phases %standard-phases
820
         (add-before 'configure 'fix-remake
821
           (lambda _
822
             (substitute* "remake.cpp"
823
               (("/bin/sh") (which "sh")))))
824
         (replace 'build
825
           (lambda _
826
             (zero? (system* "./remake"))))
827
         (replace 'check
828
           (lambda _
829
             (zero? (system* "./remake" "check"))))
830
         (replace 'install
831
           (lambda _
832
             (zero? (system* "./remake" "install")))))))
833
    (home-page "http://coquelicot.saclay.inria.fr/index.html")
834
    (synopsis "Coq library for Reals")
835
    (description "Coquelicot is an easier way of writing formulas and theorem
836
statements, achieved by relying on total functions in place of dependent types
837
for limits, derivatives, integrals, power series, and so on.  To help with the
838
proof process, the library comes with a comprehensive set of theorems that cover
839
not only these notions, but also some extensions such as parametric integrals,
840
two-dimensional differentiability, asymptotic behaviors.  It also offers some
841
automations for performing differentiability proofs.  Moreover, Coquelicot is a
842
conservative extension of Coq's standard library and provides correspondence
843
theorems between the two libraries.")
844
    (license license:lgpl3+)))
845
846
(define-public coq-interval
847
  (package
848
    (name "coq-interval")
849
    (version "3.2.0")
850
    (source (origin
851
              (method url-fetch)
852
              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
853
                                  "file/36538/interval-" version ".tar.gz"))
854
              (sha256
855
               (base32
856
                "16ir7mizl18kwa1ls8fwjih6r87894bvc1r6lh85cd43la7nriq3"))))
857
    (build-system gnu-build-system)
858
    (native-inputs
859
     `(("ocaml" ,ocaml)
860
       ("which" ,which)
861
       ("coq" ,coq-fix)))
862
    (propagated-inputs
863
     `(("flocq" ,coq-flocq)
864
       ("coquelicot" ,coq-coquelicot)
865
       ("mathcomp" ,coq-mathcomp)))
866
    (arguments
867
     `(#:configure-flags
868
       (list (string-append "--libdir=" (assoc-ref %outputs "out")
869
                            "/lib/coq/user-contrib/Gappa"))
870
       #:phases
871
       (modify-phases %standard-phases
872
         (add-before 'configure 'fix-remake
873
           (lambda _
874
             (substitute* "remake.cpp"
875
               (("/bin/sh") (which "sh")))))
876
         (replace 'build
877
           (lambda _
878
             (zero? (system* "./remake"))))
879
         (replace 'check
880
           (lambda _
881
             (zero? (system* "./remake" "check"))))
882
         (replace 'install
883
           (lambda _
884
             (zero? (system* "./remake" "install")))))))
885
    (home-page "http://coq-interval.gforge.inria.fr/")
886
    (synopsis "Coq tactics to simplify inequality proofs")
887
    (description "Interval provides vernacular files containing tactics for
888
simplifying the proofs of inequalities on expressions of real numbers for the
889
Coq proof assistant.")
890
    (license license:cecill-c)))
891
892
(define-public coq-fix
893
  (package
894
    (inherit coq)
895
    (name "coq-fix")
896
    (version "8.6")
897
    (source (origin
898
              (method url-fetch)
899
              (uri (string-append "https://coq.inria.fr/distrib/V" version
900
                                  "/files/coq-" version ".tar.gz"))
901
              (sha256
902
               (base32
903
                "1pw1xvy1657l1k69wrb911iqqflzhhp8wwsjvihbgc72r3skqg3f"))))
904
    (native-search-paths
905
      (list (search-path-specification
906
              (variable "COQPATH")
907
              (files (list "lib/coq/user-contrib")))))))
908