gnu: libgc/static-libs: Mark it as hidden.
[jackhill/guix/guix.git] / gnu / packages / guile.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
9b65dea8 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
0791437f
RW
3;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
4;;; Copyright © 2014, 2016, 2018 David Thompson <davet@gnu.org>
5;;; Copyright © 2014, 2017, 2018 Mark H Weaver <mhw@netris.org>
c5793e7e 6;;; Copyright © 2015, 2017 Christopher Allan Webber <cwebber@dustycloud.org>
c5793e7e 7;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
0791437f 8;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
a71d3358 9;;; Copyright © 2016, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
aaf1bdc3 10;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
0791437f 11;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
e53bf62e 12;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
0791437f
RW
13;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
14;;; Copyright © 2017, 2018 Amirouche <amirouche@hypermove.net>
15;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
c8e3651a 16;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
0791437f 17;;; Copyright © 2019 Taylan Kammer <taylan.kammer@gmail.com>
1722d680 18;;;
233e7676 19;;; This file is part of GNU Guix.
1722d680 20;;;
233e7676 21;;; GNU Guix is free software; you can redistribute it and/or modify it
1722d680
LC
22;;; under the terms of the GNU General Public License as published by
23;;; the Free Software Foundation; either version 3 of the License, or (at
24;;; your option) any later version.
25;;;
233e7676 26;;; GNU Guix is distributed in the hope that it will be useful, but
1722d680
LC
27;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29;;; GNU General Public License for more details.
30;;;
31;;; You should have received a copy of the GNU General Public License
233e7676 32;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
1722d680 33
1ffa7090 34(define-module (gnu packages guile)
71e0f217 35 #:use-module ((guix licenses) #:prefix license:)
59a43334 36 #:use-module (gnu packages)
146c6b62
RW
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
9c782445 39 #:use-module (gnu packages bash)
1ffa7090 40 #:use-module (gnu packages bdw-gc)
148585c2 41 #:use-module (gnu packages compression)
255d1bbe 42 #:use-module (gnu packages dbm)
146c6b62 43 #:use-module (gnu packages flex)
1ffa7090 44 #:use-module (gnu packages gawk)
146c6b62 45 #:use-module (gnu packages gettext)
ee8ee748 46 #:use-module (gnu packages hurd)
1ffa7090 47 #:use-module (gnu packages libffi)
1ffa7090 48 #:use-module (gnu packages libunistring)
7119cca8 49 #:use-module (gnu packages linux)
1ffa7090
LC
50 #:use-module (gnu packages m4)
51 #:use-module (gnu packages multiprecision)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages readline)
cd0322a3 54 #:use-module (gnu packages sqlite)
f906d30c 55 #:use-module (gnu packages texinfo)
bd233722 56 #:use-module (gnu packages version-control)
1722d680 57 #:use-module (guix packages)
87f5d366 58 #:use-module (guix download)
6bc24063 59 #:use-module (guix git-download)
32795fcf 60 #:use-module (guix build-system gnu)
977d8666 61 #:use-module (guix build-system guile)
84af1e74 62 #:use-module (guix deprecation)
32795fcf 63 #:use-module (guix utils)
d4660a54
MC
64 #:use-module (ice-9 match)
65 #:use-module ((srfi srfi-1) #:prefix srfi-1:))
1722d680
LC
66
67;;; Commentary:
68;;;
c44899a2 69;;; GNU Guile, and modules and extensions.
1722d680
LC
70;;;
71;;; Code:
72
c44899a2
LC
73(define-public guile-1.8
74 (package
75 (name "guile")
76 (version "1.8.8")
77 (source (origin
87f5d366 78 (method url-fetch)
0db342a5 79 (uri (string-append "mirror://gnu/guile/guile-" version
c44899a2
LC
80 ".tar.gz"))
81 (sha256
82 (base32
01eafd38 83 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
fc1adab1 84 (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
c44899a2
LC
85 (build-system gnu-build-system)
86 (arguments '(#:configure-flags '("--disable-error-on-warning")
c44899a2
LC
87
88 ;; Insert a phase before `configure' to patch things up.
dc1d3cde
KK
89 #:phases
90 (modify-phases %standard-phases
91 (add-before 'configure 'patch-stuff
92 (lambda* (#:key outputs #:allow-other-keys)
93 ;; Add a call to `lt_dladdsearchdir' so that
94 ;; `libguile-readline.so' & co. are in the
95 ;; loader's search path.
96 (substitute* "libguile/dynl.c"
97 (("lt_dlinit.*$" match)
98 (format #f
99 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
100 match
101 (assoc-ref outputs "out"))))
2f4fbe1c 102
dc1d3cde
KK
103 ;; The usual /bin/sh...
104 (substitute* "ice-9/popen.scm"
105 (("/bin/sh") (which "sh")))
106 #t)))))
528ea990
LC
107
108 ;; When cross-compiling, a native version of Guile itself is needed.
109 (native-inputs (if (%current-target-system)
110 `(("self" ,this-package))
111 '()))
112
01eafd38 113 (inputs `(("gawk" ,gawk)
c44899a2
LC
114 ("readline" ,readline)))
115
116 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
117 ;; propagated.
118 (propagated-inputs `(("gmp" ,gmp)
be11b102 119 ("libltdl" ,libltdl)))
c44899a2 120
9be8d7c8
LC
121 (native-search-paths
122 (list (search-path-specification
123 (variable "GUILE_LOAD_PATH")
af070955 124 (files '("share/guile/site")))))
9be8d7c8 125
f50d2669 126 (synopsis "Scheme implementation intended especially for extensions")
c44899a2 127 (description
a22dc0c4
LC
128 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
129official extension language of the GNU system. It is an implementation of
130the Scheme language which can be easily embedded in other applications to
131provide a convenient means of extending the functionality of the application
132without requiring the source code to be rewritten.")
6fd52309 133 (home-page "https://www.gnu.org/software/guile/")
71e0f217 134 (license license:lgpl2.0+)))
c44899a2
LC
135
136(define-public guile-2.0
137 (package
138 (name "guile")
b5efd14a 139 (version "2.0.14")
c44899a2 140 (source (origin
87f5d366 141 (method url-fetch)
0db342a5 142 (uri (string-append "mirror://gnu/guile/guile-" version
c44899a2
LC
143 ".tar.xz"))
144 (sha256
145 (base32
b5efd14a 146 "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
c44899a2 147 (build-system gnu-build-system)
528ea990
LC
148
149 ;; When cross-compiling, a native version of Guile itself is needed.
150 (native-inputs `(,@(if (%current-target-system)
151 `(("self" ,this-package))
152 '())
153 ("pkgconfig" ,pkg-config)))
c44899a2 154 (inputs `(("libffi" ,libffi)
88da729f 155 ,@(libiconv-if-needed)
baf549df
LC
156
157 ;; We need Bash when cross-compiling because some of the scripts
158 ;; in bin/ refer to it. Use 'bash-minimal' because we don't need
159 ;; an interactive Bash with Readline and all.
160 ,@(if (target-mingw?) '() `(("bash" ,bash-minimal)))))
c44899a2
LC
161 (propagated-inputs
162 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
163 ;; reads `-lltdl -lunistring', adding them here will add the needed
164 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
165 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
166 ("libunistring" ,libunistring)
be11b102
LC
167
168 ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
169 ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
170 ("libltdl" ,libltdl)
c44899a2
LC
171
172 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
173 ;; must be propagated.
bda1bc6c 174 ("bdw-gc" ,libgc)
c44899a2
LC
175 ("gmp" ,gmp)))
176
9bf62d9b
LC
177 (outputs '("out" "debug"))
178
8ffaa93b 179 (arguments
20897536
TGR
180 `(#:configure-flags '("--disable-static") ; saves 3 MiB
181 #:phases
182 (modify-phases %standard-phases
ba2f61bb
JN
183 ,@(if (hurd-system?)
184 '((add-after 'unpack 'disable-tests
185 (lambda _
186 ;; Hangs at: "Running 00-repl-server.test"
187 (rename-file "test-suite/tests/00-repl-server.test" "00-repl-server.test")
188 ;; Sometimes Hangs at: "Running 00-socket.test"
189 (rename-file "test-suite/tests/00-socket.test" "00-socket.test")
190 ;; FAIL: srfi-18.test: thread-sleep!: thread sleeps fractions of a second
191 (rename-file "test-suite/tests/srfi-18.test" "srfi-18.test")
192 ;; failed to remove 't-guild-compile-7215.go.tdL7yC
193 (substitute* "test-suite/standalone/Makefile.in"
194 (("test-guild-compile ") ""))
195 #t)))
196 '())
20897536
TGR
197 (add-before 'configure 'pre-configure
198 (lambda* (#:key inputs #:allow-other-keys)
199 ;; Tell (ice-9 popen) the file name of Bash.
200 (let ((bash (assoc-ref inputs "bash")))
201 (substitute* "module/ice-9/popen.scm"
202 ;; If bash is #f allow fallback for user to provide
203 ;; "bash" in PATH. This happens when cross-building to
204 ;; MinGW for which we do not have Bash yet.
205 (("/bin/sh")
206 ,@(if (target-mingw?)
207 '((if bash
208 (string-append bash "/bin/bash")
209 "bash"))
210 '((string-append bash "/bin/bash")))))
211 #t))))))
8ffaa93b 212
9be8d7c8
LC
213 (native-search-paths
214 (list (search-path-specification
215 (variable "GUILE_LOAD_PATH")
af070955 216 (files '("share/guile/site/2.0")))
9be8d7c8
LC
217 (search-path-specification
218 (variable "GUILE_LOAD_COMPILED_PATH")
b03f270e 219 (files '("lib/guile/2.0/site-ccache")))))
9be8d7c8 220
f50d2669 221 (synopsis "Scheme implementation intended especially for extensions")
c44899a2 222 (description
a22dc0c4
LC
223 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
224official extension language of the GNU system. It is an implementation of
225the Scheme language which can be easily embedded in other applications to
226provide a convenient means of extending the functionality of the application
227without requiring the source code to be rewritten.")
6fd52309 228 (home-page "https://www.gnu.org/software/guile/")
71e0f217 229 (license license:lgpl3+)))
c44899a2 230
f6396d86 231(define-public guile-2.2
f906d30c 232 (package (inherit guile-2.0)
f6396d86 233 (name "guile")
edc8fd2e 234 (version "2.2.7")
4eae7980
LC
235 (source (origin
236 (method url-fetch)
34d624ce
LC
237
238 ;; Note: we are limited to one of the compression formats
239 ;; supported by the bootstrap binaries, so no lzip here.
80a72572 240 (uri (string-append "mirror://gnu/guile/guile-" version
34d624ce 241 ".tar.xz"))
4eae7980
LC
242 (sha256
243 (base32
edc8fd2e 244 "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))
d9f0788a 245 (modules '((guix build utils)))
44f07d1d
CD
246 (patches (search-patches
247 "guile-2.2-skip-oom-test.patch"))
d9f0788a
LC
248
249 ;; Remove the pre-built object files. Instead, build everything
250 ;; from source, at the expense of significantly longer build
251 ;; times (almost 3 hours on a 4-core Intel i5).
6cbee49d
MW
252 (snippet '(begin
253 (for-each delete-file
254 (find-files "prebuilt" "\\.go$"))
255 #t))))
4fbd0f4f 256 (properties '((timeout . 72000) ;20 hours
16b0f205 257 (max-silent-time . 36000))) ;10 hours (needed on ARM
1577a658 258 ; when heavily loaded)
dd90ed89
DT
259 (native-search-paths
260 (list (search-path-specification
261 (variable "GUILE_LOAD_PATH")
262 (files '("share/guile/site/2.2")))
263 (search-path-specification
264 (variable "GUILE_LOAD_COMPILED_PATH")
1dcca83a 265 (files '("lib/guile/2.2/site-ccache")))))))
4eae7980 266
edc8fd2e 267(define-deprecated guile-2.2/bug-fix guile-2.2)
4bd6f1d1 268
8400d097
LC
269(define-public guile-2.2.4
270 (package/inherit
271 guile-2.2
272 (version "2.2.4")
273 (source (origin
274 (inherit (package-source guile-2.2))
275 (uri (string-append "mirror://gnu/guile/guile-" version
276 ".tar.xz"))
277 (sha256
278 (base32
279 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
34d624ce 280
e7921d5e
LC
281(define-public guile-3.0
282 ;; This is the latest Guile stable version.
2d0e802f
DT
283 (package
284 (inherit guile-2.2)
b6bee63b 285 (name "guile")
7f1aa73b 286 (version "3.0.2")
2d0e802f
DT
287 (source (origin
288 (inherit (package-source guile-2.2))
1a30351b 289 (uri (string-append "mirror://gnu/guile/guile-"
2d0e802f
DT
290 version ".tar.xz"))
291 (sha256
292 (base32
7f1aa73b 293 "12lziar4j27j9whqp2n18427q45y9ghq7gdd8lqhmj1k0lr7vi2k"))))
916ec91f
LC
294 (arguments
295 ;; XXX: JIT-enabled Guile crashes in obscure ways on GNU/Hurd.
296 (if (hurd-target?)
297 (substitute-keyword-arguments (package-arguments guile-2.2)
298 ((#:configure-flags flags ''())
299 `(cons "--disable-jit" ,flags)))
300 (package-arguments guile-2.2)))
2d0e802f
DT
301 (native-search-paths
302 (list (search-path-specification
303 (variable "GUILE_LOAD_PATH")
304 (files '("share/guile/site/3.0")))
305 (search-path-specification
306 (variable "GUILE_LOAD_COMPILED_PATH")
307 (files '("lib/guile/3.0/site-ccache"
e7921d5e
LC
308 "share/guile/site/3.0")))))))
309
310(define-public guile-next guile-3.0)
5cd074ea 311
cef392f3
CB
312(define-public guile-3.0/libgc-7
313 ;; Using libgc-7 avoid crashes that can occur, particularly when loading
314 ;; data in to the Guix Data Service:
315 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40525
316 (hidden-package
317 (package
318 (inherit guile-3.0)
319 (propagated-inputs
320 `(("bdw-gc" ,libgc-7)
321 ,@(srfi-1:alist-delete "bdw-gc" (package-propagated-inputs guile-3.0)))))))
322
b6bee63b
LC
323(define-public guile-3.0/fixed
324 ;; A package of Guile that's rarely changed. It is the one used in the
325 ;; `base' module, and thus changing it entails a full rebuild.
326 (package
327 (inherit guile-3.0)
328 (properties '((hidden? . #t) ;people should install 'guile-2.2'
329 (timeout . 72000) ;20 hours
330 (max-silent-time . 36000))))) ;10 hours (needed on ARM
331 ; when heavily loaded)
332
7c3b6b2e 333(define* (make-guile-readline guile #:optional (name "guile-readline"))
2ba2c98d 334 (package
7c3b6b2e 335 (name name)
2ba2c98d
LC
336 (version (package-version guile))
337 (source (package-source guile))
338 (build-system gnu-build-system)
339 (arguments
340 '(#:configure-flags '("--disable-silent-rules")
341 #:phases (modify-phases %standard-phases
342 (add-before 'build 'chdir
343 (lambda* (#:key outputs #:allow-other-keys)
344 (invoke "make" "-C" "libguile" "scmconfig.h")
345 (invoke "make" "-C" "lib")
346 (chdir "guile-readline")
347
348 (substitute* "Makefile"
349 (("../libguile/libguile-[[:graph:]]+\\.la")
350 ;; Remove dependency on libguile-X.Y.la.
351 "")
352 (("^READLINE_LIBS = (.*)$" _ libs)
353 ;; Link against the provided libguile.
354 (string-append "READLINE_LIBS = "
355 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
356 libs "\n"))
357 (("\\$\\(top_builddir\\)/meta/build-env")
358 ;; Use the provided Guile, not the one from
359 ;; $(builddir).
360 "")
361
362 ;; Install modules to the 'site' directories.
363 (("^moddir = .*$")
364 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
365 (("^ccachedir = .*$")
366 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
367
368 ;; Load 'guile-readline.so' from the right place.
369 (substitute* "ice-9/readline.scm"
370 (("load-extension \"guile-readline\"")
371 (format #f "load-extension \
372 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
373 (assoc-ref outputs "out"))))
374 #t)))))
375 (home-page (package-home-page guile))
376 (native-inputs (package-native-inputs guile))
377 (inputs
378 `(,@(package-inputs guile) ;to placate 'configure'
379 ,@(package-propagated-inputs guile)
380 ("guile" ,guile)
381 ("readline" ,readline)))
382 (synopsis "Line editing support for GNU Guile")
383 (description
384 "This module provides line editing support via the Readline library for
385GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
386@code{activate-readline} procedure to enable it.")
387 (license license:gpl3+)))
388
389(define-public guile-readline
142cd4dc 390 (make-guile-readline guile-3.0))
2ba2c98d 391
142cd4dc
MB
392(define-public guile2.2-readline
393 (make-guile-readline guile-2.2 "guile2.2-readline"))
7c3b6b2e 394
8f4acad7
LC
395(define (guile-variant-package-name prefix)
396 (lambda (name)
397 "Return NAME with PREFIX instead of \"guile-\", when applicable."
398 (if (string-prefix? "guile-" name)
399 (string-append prefix "-"
400 (string-drop name
401 (string-length "guile-")))
402 name)))
947a5d47 403
8f4acad7 404(define package-for-guile-2.0
10b507b2 405 ;; A procedure that rewrites the dependency tree of the given package to use
e8bc2a01
MB
406 ;; GUILE-2.0 instead of GUILE-3.0.
407 (package-input-rewriting `((,guile-3.0 . ,guile-2.0))
8f4acad7 408 (guile-variant-package-name "guile2.0")))
947a5d47 409
b6bee63b
LC
410(define package-for-guile-2.2
411 (package-input-rewriting `((,guile-3.0 . ,guile-2.2))
412 (guile-variant-package-name "guile2.2")))
413
414(define-syntax define-deprecated-guile3.0-package
415 (lambda (s)
416 "Define a deprecated package alias for \"guile3.0-something\"."
417 (syntax-case s ()
418 ((_ name)
419 (and (identifier? #'name)
420 (string-prefix? "guile3.0-" (symbol->string (syntax->datum
421 #'name))))
422 (let ((->guile (lambda (str)
423 (let ((base (string-drop str
424 (string-length "guile3.0-"))))
425 (string-append "guile-" base)))))
426 (with-syntax ((package-name (symbol->string (syntax->datum #'name)))
427 (package
428 (datum->syntax
429 #'name
430 (string->symbol
431 (->guile (symbol->string (syntax->datum #'name)))))))
432 #'(begin
433 (define-deprecated name package
434 (deprecated-package package-name package))
435 (export name))))))))
89a99d53 436
142cd4dc
MB
437(define-deprecated-guile3.0-package guile3.0-readline)
438
4eae7980 439(define-public guile-for-guile-emacs
a71d3358
RW
440 (let ((commit "15ca78482ac0dd2e3eb36dcb31765d8652d7106d")
441 (revision "1"))
442 (package (inherit guile-2.2)
443 (name "guile-for-guile-emacs")
444 (version (git-version "2.1.2" revision commit))
445 (source (origin
446 (method git-fetch)
447 (uri (git-reference
448 (url "git://git.savannah.gnu.org/guile.git")
449 (commit commit)))
450 (file-name (git-file-name name version))
451 (sha256
452 (base32
453 "1l7ik4q4zk7vq4m3gnwizc0b64b1mdr31hxqlzxs94xaf2lvi7s2"))))
454 (arguments
455 (substitute-keyword-arguments (package-arguments guile-2.2)
456 ((#:phases phases '%standard-phases)
457 `(modify-phases ,phases
458 (replace 'bootstrap
459 (lambda _
460 ;; Disable broken tests.
461 ;; TODO: Fix them!
462 (substitute* "test-suite/tests/gc.test"
463 (("\\(pass-if \"after-gc-hook gets called\"" m)
464 (string-append "#;" m)))
465 (substitute* "test-suite/tests/version.test"
466 (("\\(pass-if \"version reporting works\"" m)
467 (string-append "#;" m)))
468 ;; Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
469 ;; FAIL: test-out-of-memory
470 (substitute* "test-suite/standalone/Makefile.am"
471 (("(check_SCRIPTS|TESTS) \\+= test-out-of-memory") ""))
472
473 (patch-shebang "build-aux/git-version-gen")
474 (invoke "sh" "autogen.sh")
475 #t))))))
476 (native-inputs
477 `(("autoconf" ,autoconf)
478 ("automake" ,automake)
479 ("libtool" ,libtool)
480 ("flex" ,flex)
481 ("texinfo" ,texinfo)
482 ("gettext" ,gettext-minimal)
483 ,@(package-native-inputs guile-2.2))))))
be3feafe 484
c44899a2
LC
485\f
486;;;
487;;; Extensions.
488;;;
489
84af1e74 490(define-public guile-json-1
6050a1fb
CR
491 (package
492 (name "guile-json")
15214828 493 (version "1.2.0")
f52ef55e 494 (home-page "https://github.com/aconchillo/guile-json")
6050a1fb 495 (source (origin
ffc72ec6 496 (method url-fetch)
28123c01
LC
497 (uri (string-append "mirror://savannah/guile-json/guile-json-"
498 version ".tar.gz"))
ffc72ec6
LC
499 (sha256
500 (base32
6efccabe 501 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
6050a1fb 502 (build-system gnu-build-system)
6efccabe 503 (native-inputs `(("pkg-config" ,pkg-config)
f52ef55e
LC
504 ("guile" ,guile-2.2)))
505 (inputs `(("guile" ,guile-2.2)))
6050a1fb
CR
506 (synopsis "JSON module for Guile")
507 (description
0f31d4f0
LC
508 "Guile-JSON supports parsing and building JSON documents according to the
509specification. These are the main features:
510
511@itemize
512@item Strictly complies to @uref{http://json.org, specification}.
513@item Build JSON documents programmatically via macros.
514@item Unicode support for strings.
515@item Allows JSON pretty printing.
516@end itemize\n")
15214828
LC
517
518 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
519 (license license:gpl3+)))
6050a1fb 520
84af1e74
LC
521;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
522;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
523;; 'guile-json-3'.
9b65dea8 524(define-deprecated guile-json guile-json-1)
7f81cce3 525(export guile-json)
584a3ca3 526
2252f087 527(define-public guile2.0-json
84af1e74 528 (package-for-guile-2.0 guile-json-1))
947a5d47 529
152d4076
LC
530(define-public guile-json-3
531 ;; This version is incompatible with 1.x; see the 'NEWS' file.
532 (package
84af1e74 533 (inherit guile-json-1)
152d4076 534 (name "guile-json")
4e029919 535 (version "3.2.0")
152d4076
LC
536 (source (origin
537 (method url-fetch)
28123c01
LC
538 (uri (string-append "mirror://savannah/guile-json/guile-json-"
539 version ".tar.gz"))
54112295 540 (patches (search-patches "guile-json-cross.patch"))
152d4076
LC
541 (sha256
542 (base32
b6bee63b 543 "14m6b6g2maw0mkvfm4x63rqb54vgbpn1gcqs715ijw4bikfzlqfz"))))
54112295
JN
544 (native-inputs `(("autoconf" ,autoconf)
545 ("automake" ,automake)
546 ("pkg-config" ,pkg-config)
b6bee63b 547 ("guile" ,guile-3.0)))
54112295
JN
548 (inputs `(("guile" ,guile-3.0)))
549 (arguments
550 `(#:phases (modify-phases %standard-phases
551 (add-after 'unpack 'remove-configure
552 (lambda _
553 (delete-file "configure")
554 #t)))))))
b6bee63b
LC
555
556(define-public guile2.2-json
557 (package-for-guile-2.2 guile-json-3))
152d4076 558
89a99d53 559(define-public guile3.0-json
b6bee63b 560 (deprecated-package "guile3.0-json" guile-json-3))
89a99d53 561
93e7199b
CAW
562;; There are two guile-gdbm packages, one using the FFI and one with
563;; direct C bindings, hence the verbose name.
564
565(define-public guile-gdbm-ffi
566 (package
567 (name "guile-gdbm-ffi")
568 (version "20120209.fa1d5b6")
569 (source (origin
570 (method git-fetch)
571 (uri (git-reference
572 (url "https://github.com/ijp/guile-gdbm.git")
573 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
821f4dc2 574 (file-name (string-append name "-" version "-checkout"))
977d8666
LC
575 (patches (search-patches
576 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
93e7199b
CAW
577 (sha256
578 (base32
579 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
977d8666
LC
580 (build-system guile-build-system)
581 (arguments
582 '(#:phases (modify-phases %standard-phases
583 (add-after 'unpack 'move-examples
584 (lambda* (#:key outputs #:allow-other-keys)
585 ;; Move examples where they belong.
586 (let* ((out (assoc-ref outputs "out"))
587 (doc (string-append out "/share/doc/"
588 (strip-store-file-name out)
589 "/examples")))
590 (copy-recursively "examples" doc)
591 (delete-file-recursively "examples")
592 #t)))
593 (add-after 'unpack 'set-libgdbm-file-name
594 (lambda* (#:key inputs #:allow-other-keys)
595 (substitute* "gdbm.scm"
596 (("\\(dynamic-link \"libgdbm\"\\)")
597 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
598 (assoc-ref inputs "gdbm"))))
599 #t)))))
600 (native-inputs
b6bee63b 601 `(("guile" ,guile-3.0)))
56f31a9f 602 (inputs
56f31a9f 603 `(("gdbm" ,gdbm)))
93e7199b
CAW
604 (home-page "https://github.com/ijp/guile-gdbm")
605 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
606 (description
607 "Guile bindings to the GDBM key-value storage system, using
608Guile's foreign function interface.")
71e0f217 609 (license license:gpl3+)))
93e7199b 610
5bd3a841
LC
611(define-public guile2.0-gdbm-ffi
612 (package-for-guile-2.0 guile-gdbm-ffi))
613
b6bee63b
LC
614(define-public guile2.2-gdbm-ffi
615 (package-for-guile-2.2 guile-gdbm-ffi))
616
617(define-deprecated-guile3.0-package guile3.0-gdbm-ffi)
93e7199b 618
e8ac1f8f 619(define-public guile-sqlite3
319e26e4
LC
620 (package
621 (name "guile-sqlite3")
622 (version "0.1.0")
3527f600 623 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
319e26e4
LC
624 (source (origin
625 (method git-fetch)
626 (uri (git-reference
627 (url home-page)
628 (commit (string-append "v" version))))
629 (sha256
630 (base32
631 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
e53bf62e
MO
632 (file-name (string-append name "-" version "-checkout"))
633 (patches
9d5aa009 634 (search-patches "guile-sqlite3-fix-cross-compilation.patch"))
d15e4b1d
LC
635 (modules '((guix build utils)))
636 (snippet
637 '(begin
638 ;; Allow builds with Guile 3.0.
639 (substitute* "configure.ac"
640 (("^GUILE_PKG.*")
641 "GUILE_PKG([3.0 2.2 2.0])\n"))
642 #t))))
319e26e4
LC
643 (build-system gnu-build-system)
644 (native-inputs
645 `(("autoconf" ,autoconf)
646 ("automake" ,automake)
02ed227f 647 ("guile" ,guile-3.0)
319e26e4
LC
648 ("pkg-config" ,pkg-config)))
649 (inputs
b6bee63b 650 `(("guile" ,guile-3.0)
319e26e4
LC
651 ("sqlite" ,sqlite)))
652 (synopsis "Access SQLite databases from Guile")
653 (description
654 "This package provides Guile bindings to the SQLite database system.")
655 (license license:gpl3+)))
e8ac1f8f 656
c8e3651a
EB
657(define-public guile2.0-sqlite3
658 (package-for-guile-2.0 guile-sqlite3))
659
b6bee63b
LC
660(define-public guile2.2-sqlite3
661 (package-for-guile-2.2 guile-sqlite3))
662
663(define-deprecated-guile3.0-package guile3.0-sqlite3)
d15e4b1d 664
3b5783fc
AB
665(define-public guile-bytestructures
666 (package
667 (name "guile-bytestructures")
247a47bc 668 (version "1.0.7")
16e42db0 669 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
3b5783fc 670 (source (origin
16e42db0
MO
671 (method git-fetch)
672 (uri (git-reference
673 (url home-page)
674 (commit (string-append "v" version))))
43476625 675 (file-name (git-file-name name version))
3b5783fc
AB
676 (sha256
677 (base32
247a47bc 678 "0q0habjiy3h9cigb7q1br9kz6z212dn2ab31f6dgd3rrmsfn5rvb"))))
4f85f7f7 679 (build-system gnu-build-system)
9a78e181 680 (arguments
7ed9c312
LC
681 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
682
683 #:phases (modify-phases %standard-phases
684 (add-after 'install 'install-doc
685 (lambda* (#:key outputs #:allow-other-keys)
686 (let* ((out (assoc-ref outputs "out"))
687 (package ,(package-full-name this-package "-"))
688 (doc (string-append out "/share/doc/" package)))
689 (install-file "README.md" doc)
690 #t))))))
726ecfeb 691 (native-inputs
16e42db0
MO
692 `(("autoconf" ,autoconf)
693 ("automake" ,automake)
b9a9c8ef 694 ("pkg-config" ,pkg-config)
b6bee63b 695 ("guile" ,guile-3.0)))
3b5783fc 696 (inputs
b6bee63b 697 `(("guile" ,guile-3.0)))
3b5783fc
AB
698 (synopsis "Structured access to bytevector contents for Guile")
699 (description
700 "Guile bytestructures offers a system imitating the type system
701of the C programming language, to be used on bytevectors. C's type
702system works on raw memory, and Guile works on bytevectors which are
703an abstraction over raw memory. It's also more powerful than the C
704type system, elevating types to first-class status.")
abba4073
LC
705 (license license:gpl3+)
706 (properties '((upstream-name . "bytestructures")))))
3b5783fc 707
726ecfeb
LC
708(define-public guile2.0-bytestructures
709 (package-for-guile-2.0 guile-bytestructures))
710
b6bee63b
LC
711(define-public guile2.2-bytestructures
712 (package-for-guile-2.2 guile-bytestructures))
713
714(define-deprecated-guile3.0-package guile3.0-bytestructures)
89a99d53 715
bd233722 716(define-public guile-git
e85035c9
LC
717 (package
718 (name "guile-git")
25623647 719 (version "0.3.0")
e85035c9
LC
720 (home-page "https://gitlab.com/guile-git/guile-git.git")
721 (source (origin
25623647
MB
722 (method url-fetch)
723 (uri (string-append "https://gitlab.com/guile-git/guile-git/uploads/"
724 "4c563d8e7e1ff84396abe8ca7011bcaf/guile-git-"
725 version ".tar.gz"))
e85035c9
LC
726 (sha256
727 (base32
25623647 728 "0c5i3d16hp7gp9rd78vk9zc45js8bphf92m4lbb5gyi4l1yl7kkm"))))
e85035c9
LC
729 (build-system gnu-build-system)
730 (native-inputs
96a9675b 731 `(("pkg-config" ,pkg-config)
b6bee63b 732 ("guile" ,guile-3.0)
96a9675b 733 ("guile-bytestructures" ,guile-bytestructures)))
e85035c9 734 (inputs
b6bee63b 735 `(("guile" ,guile-3.0)
e85035c9
LC
736 ("libgit2" ,libgit2)))
737 (propagated-inputs
738 `(("guile-bytestructures" ,guile-bytestructures)))
739 (synopsis "Guile bindings for libgit2")
740 (description
741 "This package provides Guile bindings to libgit2, a library to
bd233722 742manipulate repositories of the Git version control system.")
e85035c9 743 (license license:gpl3+)))
c5793e7e 744
b6bee63b
LC
745(define-public guile2.2-git
746 (package-for-guile-2.2 guile-git))
01c11aeb 747
70bc6085 748(define-public guile2.0-git
60353203
LC
749 (let ((base (package-for-guile-2.0 guile-git)))
750 (package
751 (inherit base)
752 ;; Libgit2's Guile test driver requires (ice-9 textual-ports), which is
753 ;; not in Guile 2.0. Thus, keep LIBGIT2 as-is here (i.e., built against
754 ;; Guile 2.2).
755 (inputs `(("libgit2" ,libgit2)
756 ,@(srfi-1:alist-delete "libgit2"
757 (package-inputs base)))))))
70bc6085 758
b6bee63b
LC
759(define-deprecated-guile3.0-package guile3.0-git)
760
1722d680 761;;; guile.scm ends here
a8307a17 762