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