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 ocaml4.02-camlp5
142
  (package
143
    (inherit camlp5)
144
    (inputs
145
     `(("ocaml" ,ocaml-4.02)))))
146
147
(define-public coq-8.6
148
  (package
149
    (inherit coq)
150
    (name "coq")
151
    (version "8.6.1")
152
    (source (origin
153
              (method url-fetch)
154
              (uri (string-append "https://github.com/coq/coq/archive/V"
155
                                  version ".tar.gz"))
156
              (file-name (string-append name "-" version ".tar.gz"))
157
              (sha256
158
               (base32
159
                "02nm5sn79hrb9fdmkhyclk80jydadf4jcafmr3idwr5h4z56qbms"))))
160
    (arguments
161
     `(#:ocaml ,ocaml-4.02
162
       #:findlib ,ocaml4.02-findlib
163
       #:phases
164
       (modify-phases %standard-phases
165
         (replace 'configure
166
           (lambda* (#:key outputs #:allow-other-keys)
167
             (let* ((out (assoc-ref outputs "out"))
168
                    (mandir (string-append out "/share/man"))
169
                    (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
170
               (invoke "./configure"
171
                       "-prefix" out
172
                       "-mandir" mandir
173
                       "-browser" browser
174
                       "-coqide" "opt"))
175
             #t))
176
         (replace 'build
177
           (lambda* (#:key inputs #:allow-other-keys)
178
             (invoke "make" "-j" (number->string
179
                                  (parallel-job-count))
180
                     "world")
181
             #t))
182
         (delete 'check)
183
         (add-after 'install 'check
184
           (lambda _
185
             (with-directory-excursion "test-suite"
186
               (invoke "make"))
187
             #t)))))
188
    (native-inputs '())
189
    (inputs
190
     `(("lablgtk" ,ocaml4.02-lablgtk)
191
       ("python" ,python-2)
192
       ("camlp5" ,ocaml4.02-camlp5)))))
193
194
(define-public coq-8.7
195
  (package
196
    (inherit coq)
197
    (name "coq")
198
    (version "8.7.2")
199
    (source (origin
200
              (method url-fetch)
201
              (uri (string-append "https://github.com/coq/coq/archive/V"
202
                                  version ".tar.gz"))
203
              (file-name (string-append name "-" version ".tar.gz"))
204
              (sha256
205
               (base32
206
                "1lkqvs7ayzv5kkg26y837pg0d6r2b5hbjxl71ba93f39kybw69gg"))))
207
    (arguments
208
     `(#:phases
209
       (modify-phases %standard-phases
210
         (replace 'configure
211
           (lambda* (#:key outputs #:allow-other-keys)
212
             (let* ((out (assoc-ref outputs "out"))
213
                    (mandir (string-append out "/share/man"))
214
                    (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
215
               (invoke "./configure"
216
                       "-prefix" out
217
                       "-mandir" mandir
218
                       "-browser" browser
219
                       "-coqide" "opt"))
220
             #t))
221
         (replace 'build
222
           (lambda* (#:key inputs #:allow-other-keys)
223
             (substitute* "ide/ideutils.ml"
224
               (("Bytes.unsafe_to_string read_string") "read_string"))
225
             (invoke "make" "-j" (number->string
226
                                  (parallel-job-count))
227
                     (string-append
228
                       "USERFLAGS=-I "
229
                       (assoc-ref inputs "ocaml-num")
230
                       "/lib/ocaml/site-lib")
231
                     "world")
232
             #t))
233
         (delete 'check)
234
         (add-after 'install 'check
235
           (lambda _
236
             (with-directory-excursion "test-suite"
237
               ;; These two tests fail.
238
               ;; This one fails because the output is not formatted as expected.
239
               (delete-file-recursively "coq-makefile/timing")
240
               ;; This one fails because we didn't build coqtop.byte.
241
               (delete-file-recursively "coq-makefile/findlib-package")
242
               (invoke "make"))
243
             #t)))))))
244
245
(define-public coq-8.9
246
  (package
247
    (inherit coq)
248
    (name "coq")
249
    (version "8.9.0")
250
    (source (origin
251
              (method url-fetch)
252
              (uri (string-append "https://github.com/coq/coq/archive/V"
253
                                  version ".tar.gz"))
254
              (file-name (string-append name "-" version ".tar.gz"))
255
              (sha256
256
               (base32
257
                "1w0g0w2ps3v17g0nkf9zrnlhzrfvvzxyp248kgqnvybrinyf5mlb"))))
258
    (native-inputs
259
     `(("ocaml-ounit" ,ocaml-ounit)
260
       ,@(package-native-inputs coq)))))
261
262
(define-public coq-bignums-8.7
263
  (package
264
    (inherit coq-bignums)
265
    (name "coq-bignums")
266
    (version "8.7.0")
267
    (source (origin
268
              (method url-fetch)
269
              (uri (string-append "https://github.com/coq/bignums/archive/V"
270
                                  version ".tar.gz"))
271
              (file-name (string-append name "-" version ".tar.gz"))
272
              (sha256
273
               (base32
274
                "03iw9jiwq9jx45gsvp315y3lxr8m9ksppmcjvxs5c23qnky6zqjx"))))
275
    (native-inputs
276
     `(("ocaml" ,ocaml)
277
       ("coq-8.7" ,coq-8.7)))
278
    (inputs
279
     `(("camlp5" ,camlp5)))))
280
281
(define-public ppsimpl
282
  (package
283
    (name "ppsimpl")
284
    (version "8.7")
285
    (source (origin
286
              (method git-fetch)
287
              (uri (git-reference
288
                     (url "https://scm.gforge.inria.fr/anonscm/git/ppsimpl/ppsimpl.git")
289
                     (commit "86255a47568df58767d1d8e0b9e2da31cf73a5fc")))
290
              (file-name (string-append name "-" version))
291
              (sha256
292
               (base32
293
                "0h509w43j2wd2pyx04k3xfd0bsbmqscwqvhf8whzc3cxzl4j6vvq"))))
294
              ;(uri "https://gforge.inria.fr/frs/download.php/file/37615/ppsimpl-09-07-2018.tar.gz")
295
              ;(sha256
296
              ; (base32
297
              ;  "010zgskc1wd5v6wmmyxaapvwxjlgbdqqiks2dvf6llx03b07ak59"))))
298
    (build-system gnu-build-system)
299
    (arguments
300
     `(#:test-target "test"
301
       #:configure-flags
302
       (list "-R" (string-append (assoc-ref %build-inputs "compcert") "/lib/coq/user-contrib/compcert") "compcert")
303
       #:make-flags (list "COQC=coqc -R src PP -I src"
304
                          (string-append
305
                            "COQLIBINSTALL="
306
                            (assoc-ref %outputs "out")
307
                            "/lib/coq/user-contrib"))))
308
    (inputs
309
     `(("coq-bignums-8.7" ,coq-bignums-8.7)
310
       ("compcert" ,compcert)))
311
    (native-inputs
312
     `(("coq-8.7" ,coq-8.7)
313
       ("ocaml" ,ocaml)
314
       ("ocaml-findlib" ,ocaml-findlib)
315
       ("camlp4" ,camlp4)
316
       ("camlp5" ,camlp5)
317
       ("which" ,which)))
318
    (home-page "")
319
    (synopsis "")
320
    (description "")
321
    ;; No declared license -> all rights reserved
322
    (license #f)))
323
324
(define-public compcert
325
  (package
326
    (name "compcert")
327
    (version "3.3")
328
    (source (origin
329
              (method url-fetch)
330
              (uri (string-append "http://compcert.inria.fr/release/compcert-"
331
                                  version ".tgz"))
332
              (sha256
333
               (base32
334
                "16xrqcwak1v1fk5ndx6jf1yvxv3adsr7p7z34gfm2mpggxnq0xwn"))))
335
    (build-system gnu-build-system)
336
    (arguments
337
     `(#:phases
338
       (modify-phases %standard-phases
339
         (replace 'configure
340
           (lambda* (#:key outputs #:allow-other-keys)
341
             (let ((system ,(match (or (%current-target-system) (%current-system))
342
                              ("x86_64-linux" "x86_64-linux")
343
                              ("i686-linux" "x86_32-linux")
344
                              ("armhf-linux" "arm-linux"))))
345
               (format #t "Building for ~a~%" system)
346
               (invoke "./configure" system "-prefix"
347
                       (assoc-ref outputs "out")))
348
             #t))
349
         (add-after 'install 'install-lib
350
           (lambda* (#:key outputs #:allow-other-keys)
351
             (for-each
352
               (lambda (file)
353
                 (install-file
354
                   file
355
                   (string-append
356
                     (assoc-ref outputs "out")
357
                     "/lib/coq/user-contrib/compcert/" (dirname file))))
358
               (find-files "." ".*.vo$"))
359
             #t)))
360
       #:tests? #f))
361
    (native-inputs
362
     `(("ocaml" ,ocaml)
363
       ("coq" ,coq-8.7)))
364
    (inputs
365
     `(("menhir" ,ocaml-menhir)))
366
    (home-page "http://compcert.inria.fr")
367
    (synopsis "Certified C compiler")
368
    (description "CompCert is a certified (with coq) C compiler.  Warning: this
369
package is not free software!")
370
    ;; actually the "INRIA Non-Commercial License Agreement"
371
    ;; a non-free license.
372
    (license (license:non-copyleft "file:///LICENSE"))))
373
374
(define-public ocaml-c2newspeak
375
  (package
376
    (name "ocaml-c2newspeak")
377
    (version "1")
378
    (source (origin
379
              (method git-fetch)
380
              (uri (git-reference
381
                     (url "https://github.com/airbus-seclab/c2newspeak")
382
                     (commit "c97fd380111a49fa7baeb9e49c45238fca627492")))
383
              (file-name (string-append name "-" version))
384
              (sha256
385
               (base32
386
                "0fxh868s5jraq61mnig9ilhyjzsq4iw32f20zh3982naanp4p8r6"))))
387
    (build-system ocaml-build-system)
388
    (arguments
389
     `(#:test-target "check"
390
       #:tests? #f
391
       #:phases
392
       (modify-phases %standard-phases
393
         (delete 'configure)
394
         (add-after 'install 'install-bin
395
           (lambda* (#:key outputs #:allow-other-keys)
396
             (install-file "bin/c2newspeak" (string-append (assoc-ref outputs "out") "/bin")))))))
397
    (home-page "https://github.com/airbus-seclab/c2newspeak")
398
    (synopsis "")
399
    (description "")
400
    (license license:lgpl2.1+)))
401
402
(define-public ocaml-bincat
403
  (package
404
    (name "ocaml-bincat")
405
    (version "0.8.1")
406
    (source (origin
407
              (method url-fetch)
408
              (uri (string-append "https://github.com/airbus-seclab/bincat/archive/v"
409
                                  version ".tar.gz"))
410
              (file-name (string-append name "-" version ".tar.gz"))
411
              (sha256
412
               (base32
413
                "1ncwm1h428x1bs4sq7ql1isrkhw0angglsa9hnsvhhw2i1jsdk7j"))))
414
    (build-system ocaml-build-system)
415
    (arguments
416
     `(#:tests? #f; disabled for now
417
       #:validate-runpath? #f; disabled for now
418
       #:make-flags
419
       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
420
             "LDCONFIG=true"
421
             (string-append "CFLAGS+=-I " (assoc-ref %build-inputs "ocaml")
422
                            "/lib/ocaml"))
423
       #:phases
424
       (modify-phases %standard-phases
425
         (delete 'configure)
426
         (add-before 'build 'python-path
427
           (lambda* (#:key outputs #:allow-other-keys)
428
             (setenv "PYTHONPATH" (string-append (getenv "PYTHONPATH")
429
                                                 ":../python:"
430
                                                 (assoc-ref outputs "out")
431
                                                 "/lib/python2.7/site-packages/"))
432
             #t))
433
         (add-before 'build 'fix-makefiles
434
           (lambda _
435
             (substitute* "ocaml/src/Makefile"
436
               (("GITVERSION:=.*") "GITVERSION:=0.8.1\n"))
437
             (substitute* "python/Makefile"
438
               (("./setup.py install") "./setup.py install --prefix=$(PREFIX)"))
439
             #t))
440
         (add-before 'check 'fix-test
441
           (lambda _
442
             (setenv "PATH" (string-append (getenv "PATH") ":" (getcwd) "/ocaml/src"))
443
             ;; Remove tests that require an armv8 compiler
444
             (substitute* "test/Makefile"
445
               (("eggloader_armv8 eggloader_armv7 eggloader_armv7thumb") ""))
446
             (chmod "test/eggloader_x86" #o755)
447
             #t))
448
         (add-before 'install 'install-python-dir
449
           (lambda* (#:key outputs #:allow-other-keys)
450
             (mkdir-p (string-append (assoc-ref outputs "out")
451
                                     "/lib/python2.7/site-packages/")))))))
452
    (inputs
453
     `(("c2newspeak" ,ocaml-c2newspeak)
454
       ("zarith" ,ocaml-zarith)
455
       ("menhir" ,ocaml-menhir)
456
       ("ocamlgraph" ,ocaml-graph)
457
       ("ocaml-cppo" ,ocaml-cppo)
458
       ("ocaml-ppx-tools" ,ocaml-ppx-tools)
459
       ("gmp" ,gmp)))
460
    (native-inputs
461
     `(("python" ,python-2)
462
       ("pytest" ,python2-pytest)
463
       ("sphinx" ,python2-sphinx)
464
       ("nasm" ,nasm)))
465
    (home-page "https://github.com/airbus-seclab/bincat")
466
    (synopsis "")
467
    (description "")
468
    (license license:lgpl2.1+)))
469
470
(define-public ocaml-ocplib-simplex
471
  (package
472
    (name "ocaml-ocplib-simplex")
473
    (version "0.4")
474
    (source (origin
475
              (method url-fetch)
476
              (uri (string-append "https://github.com/OCamlPro-Iguernlala/"
477
                                  "ocplib-simplex/archive/v" version ".tar.gz"))
478
              (sha256
479
               (base32
480
                "0y6q4bgly7fisdklriww48aknqf2vg4dphr7wwnd1wh80l4anzg1"))))
481
    (build-system gnu-build-system)
482
    (arguments
483
     `(#:tests? #f; Compilation error
484
       #:phases
485
       (modify-phases %standard-phases
486
         (add-after 'unpack 'autoreconf
487
           (lambda _
488
             (invoke "autoreconf" "-fiv")
489
             #t))
490
         (add-before 'install 'mkdir
491
           (lambda* (#:key outputs #:allow-other-keys)
492
             (let* ((out (assoc-ref outputs "out"))
493
                    (lib (string-append out "/lib")))
494
               (mkdir-p lib)
495
               #t))))))
496
    (native-inputs
497
     `(("autoconf" ,autoconf)
498
       ("automake" ,automake)
499
       ("ocaml" ,ocaml)
500
       ("ocaml-findlib" ,ocaml-findlib)
501
       ("which" ,which)))
502
    (home-page "")
503
    (synopsis "")
504
    (description "")
505
    ; lgpl2.1+ with linking exception
506
    (license license:lgpl2.1+)))
507
508
(define-public frama-c
509
  (package
510
    (name "frama-c")
511
    (version "20171101")
512
    (source (origin
513
              (method url-fetch)
514
              (uri (string-append "http://frama-c.com/download/frama-c-Sulfur-"
515
                                  version ".tar.gz"))
516
              (sha256
517
               (base32
518
                "1vwjfqmm1r36gkybsy3a7m89q5zicf4rnz5vlsn9imnpjpl9gjw1"))))
519
    (build-system ocaml-build-system)
520
    (arguments
521
     `(#:tests? #f; for now
522
       #:phases
523
       (modify-phases %standard-phases
524
         (add-before 'configure 'export-shell
525
           (lambda* (#:key inputs #:allow-other-keys)
526
             (setenv "CONFIG_SHELL" (string-append (assoc-ref inputs "bash")
527
                                                   "/bin/sh")))))))
528
    (inputs
529
     `(("gmp" ,gmp)
530
       ("ocaml-graph" ,ocaml-graph)
531
       ("ocaml-zarith" ,ocaml-zarith)))
532
    (home-page "")
533
    (synopsis "")
534
    (description "")
535
    (license license:lgpl2.1+)))
536
537
(define-public coq-io
538
  (package
539
    (name "coq-io")
540
    (version "3.3.0")
541
    (source (origin
542
              (method url-fetch)
543
              (uri (string-append "https://github.com/coq-io/io/archive/"
544
                                  version ".tar.gz"))
545
              (file-name (string-append name "-" version ".tar.gz"))
546
              (sha256
547
               (base32
548
                "0k1z8kav3wz5n04g3imm1hqjimb9cf12ga5wkj1skz8l5ccjxprw"))))
549
    (build-system gnu-build-system)
550
    (arguments
551
     `(#:tests? #f; no tests
552
       #:make-flags
553
       (list (string-append "COQLIB=" (assoc-ref %outputs "out") "/lib/coq/"))
554
       #:phases
555
       (modify-phases %standard-phases
556
         (replace 'configure
557
           (lambda _
558
             (invoke "./configure.sh")
559
             #t)))))
560
    (native-inputs
561
     `(("coq" ,coq-8.6)))
562
    (home-page "")
563
    (synopsis "")
564
    (description "")
565
    (license license:lgpl2.1+)))
566
567
(define-public ocaml-optint
568
  (package
569
    (name "ocaml-optint")
570
    (version "0.0.2")
571
    (source
572
      (origin
573
        (method url-fetch)
574
        (uri "https://github.com/dinosaure/optint/releases/download/v0.0.2/optint-v0.0.2.tbz")
575
        (sha256
576
          (base32
577
            "1lmb7nycmkr05y93slqi98i1lcs1w4kcngjzjwz7i230qqjpw9w1"))))
578
    (build-system dune-build-system)
579
    (arguments
580
     `(#:test-target "."))
581
    (home-page "https://github.com/dinosaure/optint")
582
    (synopsis
583
      "Abstract type on integer between x64 and x86 architecture")
584
    (description
585
      "This library provide one module `Optint` which use internally an `int` if you
586
are in a x64 architecture or an `int32` (boxed value) if you are in a x86
587
architecture. This module is __really__ unsafe and does not care some details
588
(like the sign bit) for any cast.
589
590
## Goal
591
592
The main difference between an `int` and an `int32` is the second is boxed.
593
About performance this is not the best. However, you can not ensure to be in an
594
x64 architecture where you can use directly an `int` instead an `int32` (and
595
improve performance).
596
597
So, this library provide an abstraction about a real `int32`. In a x64
598
architecture, internally, we use a `int` and in a x86 architure, we use a
599
`int32`. By this way, we ensure to have in any platform 32 free bits in
600
`Optint.t`.")
601
    (license #f)))
602
603
(define-public ocaml-checkseum
604
  (package
605
    (name "ocaml-checkseum")
606
    (version "0.0.3")
607
    (source
608
      (origin
609
        (method url-fetch)
610
        (uri "https://github.com/dinosaure/checkseum/releases/download/v0.0.3/checkseum-v0.0.3.tbz")
611
        (sha256
612
          (base32
613
            "12j45zsvil1ynwx1x8fbddhqacc8r1zf7f6h576y3f3yvbg7l1fm"))))
614
    (build-system dune-build-system)
615
    (propagated-inputs
616
      `(("ocaml-optint" ,ocaml-optint)
617
        ("ocaml-fmt" ,ocaml-fmt)
618
        ("ocaml-rresult" ,ocaml-rresult)
619
        ("ocaml-cmdliner" ,ocaml-cmdliner)))
620
    (native-inputs
621
      `(("ocaml-alcotest" ,ocaml-alcotest)))
622
    (home-page
623
      "https://github.com/dinosaure/checkseum")
624
    (synopsis
625
      "Adler-32, CRC32 and CRC32-C implementation in C and OCaml")
626
    (description
627
      "Checkseum is a library to provide implementation of Adler-32, CRC32 and CRC32-C in C and OCaml.
628
629
This library use the linking trick to choose between the C implementation (checkseum.c) or the OCaml implementation (checkseum.ocaml).
630
This library is on top of optint to get the best representation of an int32.
631
")
632
    (license #f)))
633
634
; not the latest but imagelib requires 0.7
635
(define-public ocaml-decompress
636
  (package
637
    (name "ocaml-decompress")
638
    (version "0.7")
639
    (source
640
      (origin
641
        (method url-fetch)
642
        (uri "https://github.com/mirage/decompress/releases/download/v0.7/decompress-0.7.tbz")
643
        (sha256
644
          (base32
645
            "1q96q4bhrlz13c33jj82qn6706m8dbn4azc6yja8lbavpy4q5zpy"))))
646
    (build-system ocaml-build-system)
647
    (arguments
648
     ;; Tets need some path modification
649
     `(#:tests? #f
650
       #:phases
651
       (modify-phases %standard-phases
652
         (delete 'configure)
653
         (replace 'build
654
           (lambda _
655
             (invoke "ocaml" "pkg/pkg.ml" "build")))
656
         (add-before 'build 'set-topfind
657
           (lambda* (#:key inputs #:allow-other-keys)
658
             ;; add the line #directory ".." at the top of each file
659
             ;; using #use "topfind";; to be able to find topfind
660
             (let* ((findlib-path (assoc-ref inputs "findlib"))
661
                    (findlib-libdir
662
                     (string-append findlib-path "/lib/ocaml/site-lib")))
663
               (substitute* '("pkg/pkg.ml")
664
                 (("#use       \"topfind\";;" all)
665
                  (string-append "#directory \"" findlib-libdir "\"\n"
666
                                 all))))
667
             #t)))))
668
    (propagated-inputs
669
     `(("ocaml-optint" ,ocaml-optint)
670
        ("ocaml-checkseum" ,ocaml-checkseum)
671
        ("ocaml-cmdliner" ,ocaml-cmdliner)))
672
    (native-inputs
673
      `(("camlzip" ,camlzip)
674
        ("ocaml-re" ,ocaml-re)
675
        ("ocaml-topkg" ,ocaml-topkg)
676
        ("ocamlbuild" ,ocamlbuild)
677
        ("ocaml-alcotest" ,ocaml-alcotest)
678
        ("opam" ,opam)))
679
    (inputs
680
     `(("zlib" ,zlib)))
681
    (home-page
682
      "https://github.com/mirage/decompress")
683
    (synopsis "Implementation of Zlib in OCaml")
684
    (description
685
      "Decompress is an implementation of Zlib in OCaml
686
687
It provides a pure non-blocking interface to inflate and deflate data flow.
688
")
689
    (license #f)))
690
691
(define-public ocaml-imagelib
692
  (package
693
    (name "ocaml-imagelib")
694
    (version "20180522")
695
    (source
696
      (origin
697
        (method url-fetch)
698
        (uri "https://github.com/rlepigre/ocaml-imagelib/archive/ocaml-imagelib_20180522.tar.gz")
699
        (sha256
700
          (base32
701
            "06l724fj8yirp5jbf782r2xl3lrcff2i1b3c3pf80kbgngw6kakg"))))
702
    (build-system ocaml-build-system)
703
    (arguments
704
     `(#:tests? #f
705
       #:phases
706
       (modify-phases %standard-phases
707
         (delete 'configure)
708
         (replace 'build
709
           (lambda _
710
             (invoke "make")))
711
         (replace 'install
712
           (lambda _
713
             (invoke "make" "install"))))))
714
    (propagated-inputs
715
      `(("ocaml-decompress" ,ocaml-decompress)
716
        ("which" ,which)))
717
    (native-inputs
718
      `(("ocamlbuild" ,ocamlbuild)))
719
    (home-page "http://lepigre.fr")
720
    (synopsis
721
      "The imagelib library implements image formats such as PNG and PPM")
722
    (description
723
      "The imagelib library implements image formats such as PNG and PPM in
724
OCaml, relying on only one external dependency: 'decompress'.
725
726
Supported image formats:
727
 - PNG (full implementation of RFC 2083),
728
 - PPM, PGM, PBM, ... (fully supported),
729
 - JPG (only image size natively, conversion to PNG otherwise),
730
 - GIF (only image size natively, conversion to PNG otherwise),
731
 - XCF (only image size natively, conversion to PNG otherwise),
732
 - Other formats rely on 'convert' (imagemagick).
733
734
As imagelib only requires 'decompress', it can be used together with
735
js_of_ocaml to compile projects to Javascript. Note that some of the
736
features of imagelib require the convert binary  (and thus cannot be
737
used from Javascript).")
738
    (license #f)))
739
740
741
(define-public patoline
742
  (package
743
    (name "patoline")
744
    (version "0.2")
745
    (source (origin
746
              (method url-fetch)
747
              (uri (string-append "https://github.com/patoline/patoline/archive/"
748
                                  version ".tar.gz"))
749
              (file-name (string-append name "-" version ".tar.gz"))
750
              (sha256
751
               (base32
752
                "1qlxcf8k83lcyamyg19838j3f1js068skxgab94axv2gv4ylhhfb"))))
753
    (build-system dune-build-system)
754
    (arguments
755
     `(#:test-target "."
756
       #:phases
757
       (modify-phases %standard-phases
758
         (add-before 'build 'set-dirs
759
           (lambda* (#:key outputs #:allow-other-keys)
760
             (let ((out (assoc-ref outputs "out")))
761
               (substitute* '("unicodelib/config.ml"
762
                              "patconfig/patDefault.ml")
763
                 (("/usr/local/share") (string-append out "/share"))))
764
             #t)))))
765
    (propagated-inputs
766
     `(("camlzip" ,camlzip)
767
       ("ocaml-earley" ,ocaml-earley)
768
       ("ocaml-imagelib" ,ocaml-imagelib)
769
       ("ocaml-sqlite3" ,ocaml-sqlite3)))
770
    (inputs
771
     `(("zlib" ,zlib)))
772
    (home-page "")
773
    (synopsis "")
774
    (description "")
775
    (license license:gpl2+)))
776