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