guix-more/more/packages/ocaml.scm

ocaml.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017-2019 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages ocaml)
20
  #:use-module (guix packages)
21
  #:use-module (guix download)
22
  #:use-module (guix git-download)
23
  #:use-module (guix utils)
24
  #:use-module (guix build-system dune)
25
  #:use-module (guix build-system gnu)
26
  #:use-module (guix build-system ocaml)
27
  #:use-module ((guix licenses) #:prefix license:)
28
  #:use-module (gnu packages)
29
  #:use-module (gnu packages assembly)
30
  #:use-module (gnu packages autotools)
31
  #:use-module (gnu packages base)
32
  #:use-module (gnu packages bison)
33
  #:use-module (gnu packages boost)
34
  #:use-module (gnu packages check)
35
  #:use-module (gnu packages compression)
36
  #:use-module (gnu packages coq)
37
  #:use-module (gnu packages emacs)
38
  #:use-module (gnu packages flex)
39
  #:use-module (gnu packages llvm)
40
  #:use-module (gnu packages m4)
41
  #:use-module (gnu packages maths)
42
  #:use-module (gnu packages multiprecision)
43
  #:use-module (gnu packages ocaml)
44
  #:use-module (gnu packages perl)
45
  #:use-module (gnu packages pkg-config)
46
  #:use-module (gnu packages protobuf)
47
  #:use-module (gnu packages python)
48
  #:use-module (gnu packages python-xyz)
49
  #:use-module (gnu packages tex)
50
  #:use-module (gnu packages texinfo)
51
  #:use-module (more packages smt)
52
  #:use-module (ice-9 match))
53
54
(define (ocaml-forge-uri name version file-number)
55
  (string-append "https://forge.ocamlcore.org/frs/download.php/"
56
                 (number->string file-number) "/" name "-" version
57
                 ".tar.gz"))
58
59
(define-public proof-general2
60
  (package
61
    (name "proof-general2")
62
    (version "4.4")
63
    (source (origin
64
              (method url-fetch)
65
              (uri (string-append
66
                    "https://github.com/ProofGeneral/PG/archive/v"
67
                    version ".tar.gz"))
68
              (file-name (string-append name "-" version ".tar.gz"))
69
              (sha256
70
               (base32
71
                "0zif2fv6mm4pv75nh10q3p37n293495rvx470bx7ma382zc3d8hv"))))
72
    (build-system gnu-build-system)
73
    (native-inputs
74
     `(("which" ,which)
75
       ("emacs" ,emacs-minimal)
76
       ("texinfo" ,texinfo)))
77
    (inputs
78
     `(("host-emacs" ,emacs)
79
       ("perl" ,perl)
80
       ("coq" ,coq)))
81
    (arguments
82
     `(#:tests? #f  ; no check target
83
       #:make-flags (list (string-append "PREFIX=" %output)
84
                          (string-append "DEST_PREFIX=" %output)
85
                          "-j1")
86
       #:modules ((guix build gnu-build-system)
87
                  (guix build utils)
88
                  (guix build emacs-utils))
89
       #:imported-modules (,@%gnu-build-system-modules
90
                           (guix build emacs-utils))
91
       #:phases
92
       (modify-phases %standard-phases
93
         (delete 'configure)
94
         (add-after 'unpack 'disable-byte-compile-error-on-warn
95
                    (lambda _
96
                      (substitute* "Makefile"
97
                        (("\\(setq byte-compile-error-on-warn t\\)")
98
                         "(setq byte-compile-error-on-warn nil)"))
99
                      #t))
100
         (add-after 'unpack 'patch-hardcoded-paths
101
                    (lambda* (#:key inputs outputs #:allow-other-keys)
102
                      (let ((out   (assoc-ref outputs "out"))
103
                            (coq   (assoc-ref inputs "coq"))
104
                            (emacs (assoc-ref inputs "host-emacs")))
105
                        (define (coq-prog name)
106
                          (string-append coq "/bin/" name))
107
                        (substitute* "pgshell/pgshell.el"
108
                          (("/bin/sh") (which "sh")))
109
                        ;(emacs-substitute-variables "coq/coq.el"
110
                        ;  ("coq-prog-name"           (coq-prog "coqtop"))
111
                        ;  ("coq-compiler"            (coq-prog "coqc"))
112
                        ;  ("coq-dependency-analyzer" (coq-prog "coqdep")))
113
                        (substitute* "Makefile"
114
                          (("/sbin/install-info") "install-info"))
115
                        (substitute* "bin/proofgeneral"
116
                          (("^PGHOMEDEFAULT=.*" all)
117
                           (string-append all
118
                                          "PGHOME=$PGHOMEDEFAULT\n"
119
                                          "EMACS=" emacs "/bin/emacs")))
120
                        #t))))))
121
         ;(add-after 'unpack 'clean
122
         ;           (lambda _
123
         ;             ;; Delete the pre-compiled elc files for Emacs 23.
124
         ;             (zero? (system* "make" "clean"))))
125
         ;(add-after 'install 'install-doc
126
         ;           (lambda* (#:key make-flags #:allow-other-keys)
127
         ;             ;; XXX FIXME avoid building/installing pdf files,
128
         ;             ;; due to unresolved errors building them.
129
         ;             (substitute* "Makefile"
130
         ;               ((" [^ ]*\\.pdf") ""))
131
         ;             (zero? (apply system* "make" "install-doc"
132
         ;                           make-flags)))))))
133
    (home-page "http://proofgeneral.inf.ed.ac.uk/")
134
    (synopsis "Generic front-end for proof assistants based on Emacs")
135
    (description
136
     "Proof General is a major mode to turn Emacs into an interactive proof
137
assistant to write formal mathematical proofs using a variety of theorem
138
provers.")
139
    (license license:gpl2+)))
140
141
(define-public coq-8.6
142
  (package
143
    (inherit coq)
144
    (name "coq")
145
    (version "8.6.1")
146
    (source (origin
147
              (method url-fetch)
148
              (uri (string-append "https://github.com/coq/coq/archive/V"
149
                                  version ".tar.gz"))
150
              (file-name (string-append name "-" version ".tar.gz"))
151
              (sha256
152
               (base32
153
                "02nm5sn79hrb9fdmkhyclk80jydadf4jcafmr3idwr5h4z56qbms"))))
154
    (arguments
155
     `(#:phases
156
       (modify-phases %standard-phases
157
         (add-before 'configure 'fix-latest-ocaml
158
           (lambda* (#:key inputs #:allow-other-keys)
159
             (substitute* "Makefile.build"
160
               (("MLINCLUDES=") (string-append
161
                                  "MLINCLUDES=-I "
162
                                  (assoc-ref inputs "ocaml-num")
163
                                  "/lib/ocaml/site-lib ")))
164
             (substitute* "configure.ml"
165
               (("CAMLFLAGS=") "CAMLFLAGS=-unsafe-string -package num "))
166
             (substitute* "ide/ideutils.ml"
167
               (("String.blit") "Bytes.blit"))
168
             (substitute* "tools/coqmktop.ml"
169
               (("nums") (string-append (assoc-ref inputs "ocaml-num")
170
                                        "/lib/ocaml/site-lib/nums"))
171
               (("\"-linkall\"") "\"-linkall\" :: \"-package\" :: \"num\""))
172
             #t))
173
         (replace 'configure
174
           (lambda* (#:key outputs #:allow-other-keys)
175
             (let* ((out (assoc-ref outputs "out"))
176
                    (mandir (string-append out "/share/man"))
177
                    (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
178
               (invoke "./configure"
179
                       "-prefix" out
180
                       "-mandir" mandir
181
                       "-browser" browser
182
                       "-coqide" "opt"))
183
             #t))
184
         (replace 'build
185
           (lambda* (#:key inputs #:allow-other-keys)
186
             (invoke "make" "-j" (number->string
187
                                  (parallel-job-count))
188
                     "world")
189
             #t))
190
         (delete 'check)
191
         (add-after 'install 'check
192
           (lambda _
193
             (with-directory-excursion "test-suite"
194
               (invoke "make"))
195
             #t)))))
196
    (native-inputs '())
197
    (inputs
198
     `(("lablgtk" ,lablgtk)
199
       ("python" ,python-2)
200
       ("camlp5" ,camlp5)
201
       ("ocaml-num" ,ocaml-num)))))
202
203
(define-public coq-8.7
204
  (package
205
    (inherit coq)
206
    (name "coq")
207
    (version "8.7.2")
208
    (source (origin
209
              (method url-fetch)
210
              (uri (string-append "https://github.com/coq/coq/archive/V"
211
                                  version ".tar.gz"))
212
              (file-name (string-append name "-" version ".tar.gz"))
213
              (sha256
214
               (base32
215
                "1lkqvs7ayzv5kkg26y837pg0d6r2b5hbjxl71ba93f39kybw69gg"))))
216
    (arguments
217
     `(#:phases
218
       (modify-phases %standard-phases
219
         (replace 'configure
220
           (lambda* (#:key outputs #:allow-other-keys)
221
             (let* ((out (assoc-ref outputs "out"))
222
                    (mandir (string-append out "/share/man"))
223
                    (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
224
               (invoke "./configure"
225
                       "-prefix" out
226
                       "-mandir" mandir
227
                       "-browser" browser
228
                       "-coqide" "opt"))
229
             #t))
230
         (replace 'build
231
           (lambda* (#:key inputs #:allow-other-keys)
232
             (substitute* "ide/ideutils.ml"
233
               (("Bytes.unsafe_to_string read_string") "read_string"))
234
             (invoke "make" "-j" (number->string
235
                                  (parallel-job-count))
236
                     (string-append
237
                       "USERFLAGS=-I "
238
                       (assoc-ref inputs "ocaml-num")
239
                       "/lib/ocaml/site-lib")
240
                     "world")
241
             #t))
242
         (delete 'check)
243
         (add-after 'install 'check
244
           (lambda _
245
             (with-directory-excursion "test-suite"
246
               ;; These two tests fail.
247
               ;; This one fails because the output is not formatted as expected.
248
               (delete-file-recursively "coq-makefile/timing")
249
               ;; This one fails because we didn't build coqtop.byte.
250
               (delete-file-recursively "coq-makefile/findlib-package")
251
               (invoke "make"))
252
             #t)))))))
253
254
(define-public coq-8.8
255
  (package
256
    (inherit coq)
257
    (name "coq")
258
    (version "8.8.2")
259
    (source (origin
260
              (method url-fetch)
261
              (uri (string-append "https://github.com/coq/coq/archive/V"
262
                                  version ".tar.gz"))
263
              (file-name (string-append name "-" version ".tar.gz"))
264
              (sha256
265
               (base32
266
                "0i2hs0i6rp27cy8zd0mx7jscqw5cx2y0diw0pxgij66s3yr47y7r"))))
267
    (native-inputs
268
     `(("ocaml-ounit" ,ocaml-ounit)
269
       ,@(package-native-inputs coq)))))
270
271
(define-public coq-bignums-8.7
272
  (package
273
    (inherit coq-bignums)
274
    (name "coq-bignums")
275
    (version "8.7.0")
276
    (source (origin
277
              (method url-fetch)
278
              (uri (string-append "https://github.com/coq/bignums/archive/V"
279
                                  version ".tar.gz"))
280
              (file-name (string-append name "-" version ".tar.gz"))
281
              (sha256
282
               (base32
283
                "03iw9jiwq9jx45gsvp315y3lxr8m9ksppmcjvxs5c23qnky6zqjx"))))
284
    (native-inputs
285
     `(("ocaml" ,ocaml)
286
       ("coq-8.7" ,coq-8.7)))
287
    (inputs
288
     `(("camlp5" ,camlp5)))))
289
290
(define-public ppsimpl
291
  (package
292
    (name "ppsimpl")
293
    (version "8.7")
294
    (source (origin
295
              (method git-fetch)
296
              (uri (git-reference
297
                     (url "https://scm.gforge.inria.fr/anonscm/git/ppsimpl/ppsimpl.git")
298
                     (commit "86255a47568df58767d1d8e0b9e2da31cf73a5fc")))
299
              (file-name (string-append name "-" version))
300
              (sha256
301
               (base32
302
                "0h509w43j2wd2pyx04k3xfd0bsbmqscwqvhf8whzc3cxzl4j6vvq"))))
303
              ;(uri "https://gforge.inria.fr/frs/download.php/file/37615/ppsimpl-09-07-2018.tar.gz")
304
              ;(sha256
305
              ; (base32
306
              ;  "010zgskc1wd5v6wmmyxaapvwxjlgbdqqiks2dvf6llx03b07ak59"))))
307
    (build-system gnu-build-system)
308
    (arguments
309
     `(#:test-target "test"
310
       #:configure-flags
311
       (list "-R" (string-append (assoc-ref %build-inputs "compcert") "/lib/coq/user-contrib/compcert") "compcert")
312
       #:make-flags (list "COQC=coqc -R src PP -I src"
313
                          (string-append
314
                            "COQLIBINSTALL="
315
                            (assoc-ref %outputs "out")
316
                            "/lib/coq/user-contrib"))))
317
    (inputs
318
     `(("coq-bignums-8.7" ,coq-bignums-8.7)
319
       ("compcert" ,compcert)))
320
    (native-inputs
321
     `(("coq-8.7" ,coq-8.7)
322
       ("ocaml" ,ocaml)
323
       ("ocaml-findlib" ,ocaml-findlib)
324
       ("camlp4" ,camlp4)
325
       ("camlp5" ,camlp5)
326
       ("which" ,which)))
327
    (home-page "")
328
    (synopsis "")
329
    (description "")
330
    ;; No declared license -> all rights reserved
331
    (license #f)))
332
333
(define-public compcert
334
  (package
335
    (name "compcert")
336
    (version "3.5")
337
    (source (origin
338
              (method url-fetch)
339
              (uri (string-append "http://compcert.inria.fr/release/compcert-"
340
                                  version ".tgz"))
341
              (sha256
342
               (base32
343
                "02dmd4iw6b5i38svaycjsywlpmg0kaypc01vxi6ndyywx6giz80y"))))
344
    (build-system gnu-build-system)
345
    (arguments
346
     `(#:phases
347
       (modify-phases %standard-phases
348
         (replace 'configure
349
           (lambda* (#:key outputs #:allow-other-keys)
350
             (let ((system ,(match (or (%current-target-system) (%current-system))
351
                              ("x86_64-linux" "x86_64-linux")
352
                              ("i686-linux" "x86_32-linux")
353
                              ("armhf-linux" "arm-linux"))))
354
               (format #t "Building for ~a~%" system)
355
               (invoke "./configure" system "-prefix"
356
                       (assoc-ref outputs "out")))
357
             #t))
358
         (add-after 'install 'install-lib
359
           (lambda* (#:key outputs #:allow-other-keys)
360
             (for-each
361
               (lambda (file)
362
                 (install-file
363
                   file
364
                   (string-append
365
                     (assoc-ref outputs "out")
366
                     "/lib/coq/user-contrib/compcert/" (dirname file))))
367
               (find-files "." ".*.vo$"))
368
             #t)))
369
       #:tests? #f))
370
    (native-inputs
371
     `(("ocaml" ,ocaml)
372
       ("ocaml-findlib" ,ocaml-findlib); for menhir --suggest-menhirlib
373
       ("coq" ,coq)))
374
    (inputs
375
     `(("menhir" ,ocaml-menhir)))
376
    (home-page "http://compcert.inria.fr")
377
    (synopsis "Certified C compiler")
378
    (description "CompCert is a certified (with coq) C compiler.  Warning: this
379
package is not free software!")
380
    ;; actually the "INRIA Non-Commercial License Agreement"
381
    ;; a non-free license.
382
    (license (license:non-copyleft "file:///LICENSE"))))
383
384
(define-public ocaml-c2newspeak
385
  (package
386
    (name "ocaml-c2newspeak")
387
    (version "1")
388
    (source (origin
389
              (method git-fetch)
390
              (uri (git-reference
391
                     (url "https://github.com/airbus-seclab/c2newspeak")
392
                     (commit "c97fd380111a49fa7baeb9e49c45238fca627492")))
393
              (file-name (string-append name "-" version))
394
              (sha256
395
               (base32
396
                "0fxh868s5jraq61mnig9ilhyjzsq4iw32f20zh3982naanp4p8r6"))))
397
    (build-system ocaml-build-system)
398
    (arguments
399
     `(#:test-target "check"
400
       #:tests? #f
401
       #:phases
402
       (modify-phases %standard-phases
403
         (delete 'configure)
404
         (add-after 'install 'install-bin
405
           (lambda* (#:key outputs #:allow-other-keys)
406
             (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin")))))))
407
    (home-page "https://github.com/airbus-seclab/c2newspeak")
408
    (synopsis "")
409
    (description "")
410
    (license license:lgpl2.1+)))
411
412
(define-public ocaml-bincat
413
  (package
414
    (name "ocaml-bincat")
415
    (version "0.8.1")
416
    (source (origin
417
              (method url-fetch)
418
              (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v"
419
                                  version ".tar.gz"))
420
              (file-name (string-append name "-" version ".tar.gz"))
421
              (sha256
422
               (base32
423
                "1ncwm1h428x1bs4sq7ql1isrkhw0angglsa9hnsvhhw2i1jsdk7j"))))
424
    (build-system ocaml-build-system)
425
    (arguments
426
     `(#:tests? #f; disabled for now
427
       #:validate-runpath? #f; disabled for now
428
       #:make-flags
429
       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
430
             "LDCONFIG=true"
431
             (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml")
432
                            "/lib/ocaml"))
433
       #:phases
434
       (modify-phases %standard-phases
435
         (delete 'configure)
436
         (add-before 'build 'python-path
437
           (lambda* (#:key outputs #:allow-other-keys)
438
             (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH")
439
                                                 ":../python:"
440
                                                 (assoc-ref outputs "out")
441
                                                 "/lib/python2.7/site-packages/"))
442
             #t))
443
         (add-before 'build 'fix-makefiles
444
           (lambda _
445
             (substitute* "ocaml/src/Makefile"
446
               (("GITVERSION:=.*") "GITVERSION:=0.8.1\n"))
447
             (substitute* "python/Makefile"
448
               (("./setup.py install") "./setup.py install --prefix=$(PREFIX)"))
449
             #t))
450
         (add-before 'check 'fix-test
451
           (lambda _
452
             (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src"))
453
             ;; Remove tests that require an armv8 compiler
454
             (substitute* "test/Makefile"
455
               (("eggloader_armv8 eggloader_armv7 eggloader_armv7thumb") ""))
456
             (chmod "test/eggloader_x86" #o755)
457
             #t))
458
         (add-before 'install 'install-python-dir
459
           (lambda* (#:key outputs #:allow-other-keys)
460
             (mkdir-p (string-append (assoc-ref outputs "out")
461
                                     "/lib/python2.7/site-packages/")))))))
462
    (inputs
463
     `(("c2newspeak" ,ocaml-c2newspeak)
464
       ("zarith" ,ocaml-zarith)
465
       ("menhir" ,ocaml-menhir)
466
       ("ocamlgraph" ,ocaml-graph)
467
       ("ocaml-cppo" ,ocaml-cppo)
468
       ("ocaml-ppx-tools" ,ocaml-ppx-tools)
469
       ("gmp" ,gmp)))
470
    (native-inputs
471
     `(("python" ,python-2)
472
       ("pytest" ,python2-pytest)
473
       ("sphinx" ,python2-sphinx)
474
       ("nasm" ,nasm)))
475
    (home-page "https://github.com/airbus-seclab/bincat")
476
    (synopsis "")
477
    (description "")
478
    (license license:lgpl2.1+)))
479
480
(define-public ocaml-ocplib-simplex
481
  (package
482
    (name "ocaml-ocplib-simplex")
483
    (version "0.4")
484
    (source (origin
485
              (method url-fetch)
486
              (uri (string-append "https://github.com/OCamlPro-Iguernlala/"
487
                                  "ocplib-simplex/archive/v" version ".tar.gz"))
488
              (sha256
489
               (base32
490
                "0y6q4bgly7fisdklriww48aknqf2vg4dphr7wwnd1wh80l4anzg1"))))
491
    (build-system gnu-build-system)
492
    (arguments
493
     `(#:tests? #f; Compilation error
494
       #:phases
495
       (modify-phases %standard-phases
496
         (add-after 'unpack 'autoreconf
497
           (lambda _
498
             (invoke "autoreconf" "-fiv")
499
             #t))
500
         (add-before 'install 'mkdir
501
           (lambda* (#:key outputs #:allow-other-keys)
502
             (let* ((out (assoc-ref outputs "out"))
503
                    (lib (string-append out "/lib")))
504
               (mkdir-p lib)
505
               #t))))))
506
    (native-inputs
507
     `(("autoconf" ,autoconf)
508
       ("automake" ,automake)
509
       ("ocaml" ,ocaml)
510
       ("ocaml-findlib" ,ocaml-findlib)
511
       ("which" ,which)))
512
    (home-page "")
513
    (synopsis "")
514
    (description "")
515
    ; lgpl2.1+ with linking exception
516
    (license license:lgpl2.1+)))
517
518
(define-public frama-c
519
  (package
520
    (name "frama-c")
521
    (version "20171101")
522
    (source (origin
523
              (method url-fetch)
524
              (uri (string-append "http://frama-c.com/download/frama-c-Sulfur-"
525
                                  version ".tar.gz"))
526
              (sha256
527
               (base32
528
                "1vwjfqmm1r36gkybsy3a7m89q5zicf4rnz5vlsn9imnpjpl9gjw1"))))
529
    (build-system ocaml-build-system)
530
    (arguments
531
     `(#:tests? #f; for now
532
       #:phases
533
       (modify-phases %standard-phases
534
         (add-before 'configure 'export-shell
535
           (lambda* (#:key inputs #:allow-other-keys)
536
             (setenv "CONFIG_SHELL" (string-append (assoc-ref inputs "bash")
537
                                                   "/bin/sh")))))))
538
    (inputs
539
     `(("gmp" ,gmp)
540
       ("ocaml-graph" ,ocaml-graph)
541
       ("ocaml-zarith" ,ocaml-zarith)))
542
    (home-page "")
543
    (synopsis "")
544
    (description "")
545
    (license license:lgpl2.1+)))
546
547
(define-public coq-io
548
  (package
549
    (name "coq-io")
550
    (version "3.3.0")
551
    (source (origin
552
              (method url-fetch)
553
              (uri (string-append "https://github.com/coq-io/io/archive/"
554
                                  version ".tar.gz"))
555
              (file-name (string-append name "-" version ".tar.gz"))
556
              (sha256
557
               (base32
558
                "0k1z8kav3wz5n04g3imm1hqjimb9cf12ga5wkj1skz8l5ccjxprw"))))
559
    (build-system gnu-build-system)
560
    (arguments
561
     `(#:tests? #f; no tests
562
       #:make-flags
563
       (list (string-append "COQLIB=" (assoc-ref %outputs "out") "/lib/coq/"))
564
       #:phases
565
       (modify-phases %standard-phases
566
         (replace 'configure
567
           (lambda _
568
             (invoke "./configure.sh")
569
             #t)))))
570
    (native-inputs
571
     `(("coq" ,coq-8.6)))
572
    (home-page "")
573
    (synopsis "")
574
    (description "")
575
    (license license:lgpl2.1+)))
576
577
(define-public ocaml-optint
578
  (package
579
    (name "ocaml-optint")
580
    (version "0.0.2")
581
    (source
582
      (origin
583
        (method url-fetch)
584
        (uri "https://github.com/dinosaure/optint/releases/download/v0.0.2/optint-v0.0.2.tbz")
585
        (sha256
586
          (base32
587
            "1lmb7nycmkr05y93slqi98i1lcs1w4kcngjzjwz7i230qqjpw9w1"))))
588
    (build-system dune-build-system)
589
    (arguments
590
     `(#:test-target "."))
591
    (home-page "https://github.com/dinosaure/optint")
592
    (synopsis
593
      "Abstract type on integer between x64 and x86 architecture")
594
    (description
595
      "This library provide one module `Optint` which use internally an `int` if you
596
are in a x64 architecture or an `int32` (boxed value) if you are in a x86
597
architecture. This module is __really__ unsafe and does not care some details
598
(like the sign bit) for any cast.
599
600
## Goal
601
602
The main difference between an `int` and an `int32` is the second is boxed.
603
About performance this is not the best. However, you can not ensure to be in an
604
x64 architecture where you can use directly an `int` instead an `int32` (and
605
improve performance).
606
607
So, this library provide an abstraction about a real `int32`. In a x64
608
architecture, internally, we use a `int` and in a x86 architure, we use a
609
`int32`. By this way, we ensure to have in any platform 32 free bits in
610
`Optint.t`.")
611
    (license #f)))
612
613
(define-public ocaml-checkseum
614
  (package
615
    (name "ocaml-checkseum")
616
    (version "0.0.3")
617
    (source
618
      (origin
619
        (method url-fetch)
620
        (uri "https://github.com/dinosaure/checkseum/releases/download/v0.0.3/checkseum-v0.0.3.tbz")
621
        (sha256
622
          (base32
623
            "12j45zsvil1ynwx1x8fbddhqacc8r1zf7f6h576y3f3yvbg7l1fm"))))
624
    (build-system dune-build-system)
625
    (propagated-inputs
626
      `(("ocaml-optint" ,ocaml-optint)
627
        ("ocaml-fmt" ,ocaml-fmt)
628
        ("ocaml-rresult" ,ocaml-rresult)
629
        ("ocaml-cmdliner" ,ocaml-cmdliner)))
630
    (native-inputs
631
      `(("ocaml-alcotest" ,ocaml-alcotest)))
632
    (home-page
633
      "https://github.com/dinosaure/checkseum")
634
    (synopsis
635
      "Adler-32, CRC32 and CRC32-C implementation in C and OCaml")
636
    (description
637
      "Checkseum is a library to provide implementation of Adler-32, CRC32 and CRC32-C in C and OCaml.
638
639
This library use the linking trick to choose between the C implementation (checkseum.c) or the OCaml implementation (checkseum.ocaml).
640
This library is on top of optint to get the best representation of an int32.
641
")
642
    (license #f)))
643
644
; not the latest but imagelib requires 0.7
645
(define-public ocaml-decompress
646
  (package
647
    (name "ocaml-decompress")
648
    (version "0.7")
649
    (source
650
      (origin
651
        (method url-fetch)
652
        (uri "https://github.com/mirage/decompress/releases/download/v0.7/decompress-0.7.tbz")
653
        (sha256
654
          (base32
655
            "1q96q4bhrlz13c33jj82qn6706m8dbn4azc6yja8lbavpy4q5zpy"))))
656
    (build-system ocaml-build-system)
657
    (arguments
658
     ;; Tets need some path modification
659
     `(#:tests? #f
660
       #:phases
661
       (modify-phases %standard-phases
662
         (delete 'configure)
663
         (replace 'build
664
           (lambda _
665
             (invoke "ocaml" "pkg/pkg.ml" "build")))
666
         (add-before 'build 'set-topfind
667
           (lambda* (#:key inputs #:allow-other-keys)
668
             ;; add the line #directory ".." at the top of each file
669
             ;; using #use "topfind";; to be able to find topfind
670
             (let* ((findlib-path (assoc-ref inputs "findlib"))
671
                    (findlib-libdir
672
                     (string-append findlib-path "/lib/ocaml/site-lib")))
673
               (substitute* '("pkg/pkg.ml")
674
                 (("#use       \"topfind\";;" all)
675
                  (string-append "#directory \"" findlib-libdir "\"\n"
676
                                 all))))
677
             #t)))))
678
    (propagated-inputs
679
     `(("ocaml-optint" ,ocaml-optint)
680
        ("ocaml-checkseum" ,ocaml-checkseum)
681
        ("ocaml-cmdliner" ,ocaml-cmdliner)))
682
    (native-inputs
683
      `(("camlzip" ,camlzip)
684
        ("ocaml-re" ,ocaml-re)
685
        ("ocaml-topkg" ,ocaml-topkg)
686
        ("ocamlbuild" ,ocamlbuild)
687
        ("ocaml-alcotest" ,ocaml-alcotest)
688
        ("opam" ,opam)))
689
    (inputs
690
     `(("zlib" ,zlib)))
691
    (home-page
692
      "https://github.com/mirage/decompress")
693
    (synopsis "Implementation of Zlib in OCaml")
694
    (description
695
      "Decompress is an implementation of Zlib in OCaml
696
697
It provides a pure non-blocking interface to inflate and deflate data flow.
698
")
699
    (license #f)))
700
701
(define-public ocaml-imagelib
702
  (package
703
    (name "ocaml-imagelib")
704
    (version "20180522")
705
    (source
706
      (origin
707
        (method url-fetch)
708
        (uri "https://github.com/rlepigre/ocaml-imagelib/archive/ocaml-imagelib_20180522.tar.gz")
709
        (sha256
710
          (base32
711
            "06l724fj8yirp5jbf782r2xl3lrcff2i1b3c3pf80kbgngw6kakg"))))
712
    (build-system ocaml-build-system)
713
    (arguments
714
     `(#:tests? #f
715
       #:phases
716
       (modify-phases %standard-phases
717
         (delete 'configure)
718
         (replace 'build
719
           (lambda _
720
             (invoke "make")))
721
         (replace 'install
722
           (lambda _
723
             (invoke "make" "install"))))))
724
    (propagated-inputs
725
      `(("ocaml-decompress" ,ocaml-decompress)
726
        ("which" ,which)))
727
    (native-inputs
728
      `(("ocamlbuild" ,ocamlbuild)))
729
    (home-page "http://lepigre.fr")
730
    (synopsis
731
      "The imagelib library implements image formats such as PNG and PPM")
732
    (description
733
      "The imagelib library implements image formats such as PNG and PPM in
734
OCaml, relying on only one external dependency: 'decompress'.
735
736
Supported image formats:
737
 - PNG (full implementation of RFC 2083),
738
 - PPM, PGM, PBM, ... (fully supported),
739
 - JPG (only image size natively, conversion to PNG otherwise),
740
 - GIF (only image size natively, conversion to PNG otherwise),
741
 - XCF (only image size natively, conversion to PNG otherwise),
742
 - Other formats rely on 'convert' (imagemagick).
743
744
As imagelib only requires 'decompress', it can be used together with
745
js_of_ocaml to compile projects to Javascript. Note that some of the
746
features of imagelib require the convert binary  (and thus cannot be
747
used from Javascript).")
748
    (license #f)))
749
750
751
(define-public patoline
752
  (package
753
    (name "patoline")
754
    (version "0.2")
755
    (source (origin
756
              (method url-fetch)
757
              (uri (string-append "https://github.com/patoline/patoline/archive/"
758
                                  version ".tar.gz"))
759
              (file-name (string-append name "-" version ".tar.gz"))
760
              (sha256
761
               (base32
762
                "1qlxcf8k83lcyamyg19838j3f1js068skxgab94axv2gv4ylhhfb"))))
763
    (build-system dune-build-system)
764
    (arguments
765
     `(#:test-target "."
766
       #:phases
767
       (modify-phases %standard-phases
768
         (add-before 'build 'set-dirs
769
           (lambda* (#:key outputs #:allow-other-keys)
770
             (let ((out (assoc-ref outputs "out")))
771
               (substitute* '("unicodelib/config.ml"
772
                              "patconfig/patDefault.ml")
773
                 (("/usr/local/share") (string-append out "/share"))))
774
             #t)))))
775
    (propagated-inputs
776
     `(("camlzip" ,camlzip)
777
       ("ocaml-earley" ,ocaml-earley)
778
       ("ocaml-imagelib" ,ocaml-imagelib)
779
       ("ocaml-sqlite3" ,ocaml-sqlite3)))
780
    (inputs
781
     `(("zlib" ,zlib)))
782
    (home-page "")
783
    (synopsis "")
784
    (description "")
785
    (license license:gpl2+)))
786