records: Improve reporting of "invalid field specifier" errors.
[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
RW
8;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
9;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
aaf1bdc3 10;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
0791437f 11;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
247a47bc 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
183 (add-before 'configure 'pre-configure
184 (lambda* (#:key inputs #:allow-other-keys)
185 ;; Tell (ice-9 popen) the file name of Bash.
186 (let ((bash (assoc-ref inputs "bash")))
187 (substitute* "module/ice-9/popen.scm"
188 ;; If bash is #f allow fallback for user to provide
189 ;; "bash" in PATH. This happens when cross-building to
190 ;; MinGW for which we do not have Bash yet.
191 (("/bin/sh")
192 ,@(if (target-mingw?)
193 '((if bash
194 (string-append bash "/bin/bash")
195 "bash"))
196 '((string-append bash "/bin/bash")))))
197 #t))))))
8ffaa93b 198
9be8d7c8
LC
199 (native-search-paths
200 (list (search-path-specification
201 (variable "GUILE_LOAD_PATH")
af070955 202 (files '("share/guile/site/2.0")))
9be8d7c8
LC
203 (search-path-specification
204 (variable "GUILE_LOAD_COMPILED_PATH")
b03f270e 205 (files '("lib/guile/2.0/site-ccache")))))
9be8d7c8 206
f50d2669 207 (synopsis "Scheme implementation intended especially for extensions")
c44899a2 208 (description
a22dc0c4
LC
209 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
210official extension language of the GNU system. It is an implementation of
211the Scheme language which can be easily embedded in other applications to
212provide a convenient means of extending the functionality of the application
213without requiring the source code to be rewritten.")
6fd52309 214 (home-page "https://www.gnu.org/software/guile/")
71e0f217 215 (license license:lgpl3+)))
c44899a2 216
f6396d86 217(define-public guile-2.2
f906d30c 218 (package (inherit guile-2.0)
f6396d86 219 (name "guile")
1c94df8a 220 (version "2.2.6")
4eae7980
LC
221 (source (origin
222 (method url-fetch)
34d624ce
LC
223
224 ;; Note: we are limited to one of the compression formats
225 ;; supported by the bootstrap binaries, so no lzip here.
80a72572 226 (uri (string-append "mirror://gnu/guile/guile-" version
34d624ce 227 ".tar.xz"))
4eae7980
LC
228 (sha256
229 (base32
1c94df8a 230 "1269ymxm56j1z1lvq1y42rm961f2n7rinm3k6l00p9k52hrpcddk"))
d9f0788a 231 (modules '((guix build utils)))
44f07d1d
CD
232 (patches (search-patches
233 "guile-2.2-skip-oom-test.patch"))
d9f0788a
LC
234
235 ;; Remove the pre-built object files. Instead, build everything
236 ;; from source, at the expense of significantly longer build
237 ;; times (almost 3 hours on a 4-core Intel i5).
6cbee49d
MW
238 (snippet '(begin
239 (for-each delete-file
240 (find-files "prebuilt" "\\.go$"))
241 #t))))
4fbd0f4f 242 (properties '((timeout . 72000) ;20 hours
16b0f205 243 (max-silent-time . 36000))) ;10 hours (needed on ARM
1577a658 244 ; when heavily loaded)
dd90ed89
DT
245 (native-search-paths
246 (list (search-path-specification
247 (variable "GUILE_LOAD_PATH")
248 (files '("share/guile/site/2.2")))
249 (search-path-specification
250 (variable "GUILE_LOAD_COMPILED_PATH")
1dcca83a 251 (files '("lib/guile/2.2/site-ccache")))))))
4eae7980 252
4bd6f1d1
LC
253(define-public guile-2.2/bug-fix
254 ;; This variant contains a bug fix for a relatively rare crash that could
255 ;; affect shepherd as PID 1: <https://bugs.gnu.org/37757>.
256 (package
257 (inherit guile-2.2)
258 (version (string-append (package-version guile-2.2) "-1"))
259 (source (origin
260 (inherit (package-source guile-2.2))
261 (patches
262 (append (search-patches "guile-finalization-crash.patch")
263 (origin-patches (package-source guile-2.2))))))))
264
34d624ce
LC
265(define-public guile-2.2/fixed
266 ;; A package of Guile 2.2 that's rarely changed. It is the one used
267 ;; in the `base' module, and thus changing it entails a full rebuild.
268 (package
269 (inherit guile-2.2)
a9308efe 270 (properties '((hidden? . #t) ;people should install 'guile-2.2'
5a5b3632
MW
271 (timeout . 72000) ;20 hours
272 (max-silent-time . 36000))))) ;10 hours (needed on ARM
273 ; when heavily loaded)
8400d097
LC
274(define-public guile-2.2.4
275 (package/inherit
276 guile-2.2
277 (version "2.2.4")
278 (source (origin
279 (inherit (package-source guile-2.2))
280 (uri (string-append "mirror://gnu/guile/guile-" version
281 ".tar.xz"))
282 (sha256
283 (base32
284 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
34d624ce 285
5cd074ea 286(define-public guile-next
35f90377 287 ;; This is the upcoming Guile 3.0, with JIT support.
2d0e802f
DT
288 (package
289 (inherit guile-2.2)
290 (name "guile-next")
4616f5a8 291 (version "2.9.9")
2d0e802f
DT
292 (source (origin
293 (inherit (package-source guile-2.2))
294 (uri (string-append "ftp://alpha.gnu.org/gnu/guile/guile-"
295 version ".tar.xz"))
296 (sha256
297 (base32
4616f5a8 298 "0s99zzdzj29fb42q5fwn7vqg9k7y9ppq9vkv4p39zr93z8694wdz"))))
2d0e802f
DT
299 (native-search-paths
300 (list (search-path-specification
301 (variable "GUILE_LOAD_PATH")
302 (files '("share/guile/site/3.0")))
303 (search-path-specification
304 (variable "GUILE_LOAD_COMPILED_PATH")
305 (files '("lib/guile/3.0/site-ccache"
306 "share/guile/site/3.0")))))
307 (properties '((ftp-server . "alpha.gnu.org")
308 (upstream-name . "guile")))))
5cd074ea 309
7c3b6b2e 310(define* (make-guile-readline guile #:optional (name "guile-readline"))
2ba2c98d 311 (package
7c3b6b2e 312 (name name)
2ba2c98d
LC
313 (version (package-version guile))
314 (source (package-source guile))
315 (build-system gnu-build-system)
316 (arguments
317 '(#:configure-flags '("--disable-silent-rules")
318 #:phases (modify-phases %standard-phases
319 (add-before 'build 'chdir
320 (lambda* (#:key outputs #:allow-other-keys)
321 (invoke "make" "-C" "libguile" "scmconfig.h")
322 (invoke "make" "-C" "lib")
323 (chdir "guile-readline")
324
325 (substitute* "Makefile"
326 (("../libguile/libguile-[[:graph:]]+\\.la")
327 ;; Remove dependency on libguile-X.Y.la.
328 "")
329 (("^READLINE_LIBS = (.*)$" _ libs)
330 ;; Link against the provided libguile.
331 (string-append "READLINE_LIBS = "
332 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
333 libs "\n"))
334 (("\\$\\(top_builddir\\)/meta/build-env")
335 ;; Use the provided Guile, not the one from
336 ;; $(builddir).
337 "")
338
339 ;; Install modules to the 'site' directories.
340 (("^moddir = .*$")
341 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
342 (("^ccachedir = .*$")
343 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
344
345 ;; Load 'guile-readline.so' from the right place.
346 (substitute* "ice-9/readline.scm"
347 (("load-extension \"guile-readline\"")
348 (format #f "load-extension \
349 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
350 (assoc-ref outputs "out"))))
351 #t)))))
352 (home-page (package-home-page guile))
353 (native-inputs (package-native-inputs guile))
354 (inputs
355 `(,@(package-inputs guile) ;to placate 'configure'
356 ,@(package-propagated-inputs guile)
357 ("guile" ,guile)
358 ("readline" ,readline)))
359 (synopsis "Line editing support for GNU Guile")
360 (description
361 "This module provides line editing support via the Readline library for
362GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
363@code{activate-readline} procedure to enable it.")
364 (license license:gpl3+)))
365
366(define-public guile-readline
367 (make-guile-readline guile-2.2))
368
7c3b6b2e
LC
369(define-public guile3.0-readline
370 (make-guile-readline guile-next "guile3.0-readline"))
371
8f4acad7
LC
372(define (guile-variant-package-name prefix)
373 (lambda (name)
374 "Return NAME with PREFIX instead of \"guile-\", when applicable."
375 (if (string-prefix? "guile-" name)
376 (string-append prefix "-"
377 (string-drop name
378 (string-length "guile-")))
379 name)))
947a5d47 380
8f4acad7 381(define package-for-guile-2.0
10b507b2
LC
382 ;; A procedure that rewrites the dependency tree of the given package to use
383 ;; GUILE-2.0 instead of GUILE-2.2.
c9c51ac3 384 (package-input-rewriting `((,guile-2.2 . ,guile-2.0))
8f4acad7 385 (guile-variant-package-name "guile2.0")))
947a5d47 386
89a99d53
LC
387(define package-for-guile-3.0
388 (package-input-rewriting `((,guile-2.2 . ,guile-next))
389 (guile-variant-package-name "guile3.0")))
390
4eae7980 391(define-public guile-for-guile-emacs
f6396d86 392 (package (inherit guile-2.2)
4eae7980
LC
393 (name "guile-for-guile-emacs")
394 (version "20150510.d8d9a8d")
f906d30c
CAW
395 (source (origin
396 (method git-fetch)
397 (uri (git-reference
4eae7980
LC
398 (url "git://git.hcoop.net/git/bpt/guile.git")
399 (commit "d8d9a8da05ec876acba81a559798eb5eeceb5a17")))
51988e3a 400 (file-name (string-append name "-" version "-checkout"))
f906d30c
CAW
401 (sha256
402 (base32
4eae7980 403 "00sprsshy16y8pxjy126hr2adqcvvzzz96hjyjwgg8swva1qh6b0"))))
f906d30c 404 (arguments
8924e3fd
RW
405 `(;; Tests aren't passing for now.
406 ;; Obviously we should re-enable this!
407 #:tests? #f
408 ,@(package-arguments guile-2.2)))
f906d30c
CAW
409 (native-inputs
410 `(("autoconf" ,autoconf)
411 ("automake" ,automake)
412 ("libtool" ,libtool)
413 ("flex" ,flex)
414 ("texinfo" ,texinfo)
b94a6ca0 415 ("gettext" ,gettext-minimal)
f6396d86 416 ,@(package-native-inputs guile-2.2)))
daeb61f7
RW
417 ;; Same as in guile-2.0
418 (native-search-paths
419 (list (search-path-specification
420 (variable "GUILE_LOAD_PATH")
421 (files '("share/guile/site/2.0")))
422 (search-path-specification
423 (variable "GUILE_LOAD_COMPILED_PATH")
31769b9f 424 (files '("lib/guile/2.0/site-ccache"
daeb61f7 425 "share/guile/site/2.0")))))))
be3feafe 426
c44899a2
LC
427\f
428;;;
429;;; Extensions.
430;;;
431
84af1e74 432(define-public guile-json-1
6050a1fb
CR
433 (package
434 (name "guile-json")
15214828 435 (version "1.2.0")
f52ef55e 436 (home-page "https://github.com/aconchillo/guile-json")
6050a1fb 437 (source (origin
ffc72ec6 438 (method url-fetch)
28123c01
LC
439 (uri (string-append "mirror://savannah/guile-json/guile-json-"
440 version ".tar.gz"))
ffc72ec6
LC
441 (sha256
442 (base32
6efccabe 443 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
6050a1fb 444 (build-system gnu-build-system)
6efccabe 445 (native-inputs `(("pkg-config" ,pkg-config)
f52ef55e
LC
446 ("guile" ,guile-2.2)))
447 (inputs `(("guile" ,guile-2.2)))
6050a1fb
CR
448 (synopsis "JSON module for Guile")
449 (description
0f31d4f0
LC
450 "Guile-JSON supports parsing and building JSON documents according to the
451specification. These are the main features:
452
453@itemize
454@item Strictly complies to @uref{http://json.org, specification}.
455@item Build JSON documents programmatically via macros.
456@item Unicode support for strings.
457@item Allows JSON pretty printing.
458@end itemize\n")
15214828
LC
459
460 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
461 (license license:gpl3+)))
6050a1fb 462
84af1e74
LC
463;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
464;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
465;; 'guile-json-3'.
9b65dea8 466(define-deprecated guile-json guile-json-1)
7f81cce3 467(export guile-json)
584a3ca3 468
2252f087 469(define-public guile2.0-json
84af1e74 470 (package-for-guile-2.0 guile-json-1))
947a5d47 471
152d4076
LC
472(define-public guile-json-3
473 ;; This version is incompatible with 1.x; see the 'NEWS' file.
474 (package
84af1e74 475 (inherit guile-json-1)
152d4076 476 (name "guile-json")
4e029919 477 (version "3.2.0")
152d4076
LC
478 (source (origin
479 (method url-fetch)
28123c01
LC
480 (uri (string-append "mirror://savannah/guile-json/guile-json-"
481 version ".tar.gz"))
152d4076
LC
482 (sha256
483 (base32
4e029919 484 "14m6b6g2maw0mkvfm4x63rqb54vgbpn1gcqs715ijw4bikfzlqfz"))))))
152d4076 485
89a99d53
LC
486(define-public guile3.0-json
487 (package-for-guile-3.0 guile-json-3))
488
93e7199b
CAW
489;; There are two guile-gdbm packages, one using the FFI and one with
490;; direct C bindings, hence the verbose name.
491
492(define-public guile-gdbm-ffi
493 (package
494 (name "guile-gdbm-ffi")
495 (version "20120209.fa1d5b6")
496 (source (origin
497 (method git-fetch)
498 (uri (git-reference
499 (url "https://github.com/ijp/guile-gdbm.git")
500 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
821f4dc2 501 (file-name (string-append name "-" version "-checkout"))
977d8666
LC
502 (patches (search-patches
503 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
93e7199b
CAW
504 (sha256
505 (base32
506 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
977d8666
LC
507 (build-system guile-build-system)
508 (arguments
509 '(#:phases (modify-phases %standard-phases
510 (add-after 'unpack 'move-examples
511 (lambda* (#:key outputs #:allow-other-keys)
512 ;; Move examples where they belong.
513 (let* ((out (assoc-ref outputs "out"))
514 (doc (string-append out "/share/doc/"
515 (strip-store-file-name out)
516 "/examples")))
517 (copy-recursively "examples" doc)
518 (delete-file-recursively "examples")
519 #t)))
520 (add-after 'unpack 'set-libgdbm-file-name
521 (lambda* (#:key inputs #:allow-other-keys)
522 (substitute* "gdbm.scm"
523 (("\\(dynamic-link \"libgdbm\"\\)")
524 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
525 (assoc-ref inputs "gdbm"))))
526 #t)))))
527 (native-inputs
528 `(("guile" ,guile-2.2)))
56f31a9f 529 (inputs
56f31a9f 530 `(("gdbm" ,gdbm)))
93e7199b
CAW
531 (home-page "https://github.com/ijp/guile-gdbm")
532 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
533 (description
534 "Guile bindings to the GDBM key-value storage system, using
535Guile's foreign function interface.")
71e0f217 536 (license license:gpl3+)))
93e7199b 537
5bd3a841
LC
538(define-public guile2.0-gdbm-ffi
539 (package-for-guile-2.0 guile-gdbm-ffi))
540
89a99d53
LC
541(define-public guile3.0-gdbm-ffi
542 (package-for-guile-3.0 guile-gdbm-ffi))
93e7199b 543
e8ac1f8f 544(define-public guile-sqlite3
319e26e4
LC
545 (package
546 (name "guile-sqlite3")
547 (version "0.1.0")
3527f600 548 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
319e26e4
LC
549 (source (origin
550 (method git-fetch)
551 (uri (git-reference
552 (url home-page)
553 (commit (string-append "v" version))))
554 (sha256
555 (base32
556 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
d15e4b1d
LC
557 (file-name (string-append name "-" version "-checkout"))
558 (modules '((guix build utils)))
559 (snippet
560 '(begin
561 ;; Allow builds with Guile 3.0.
562 (substitute* "configure.ac"
563 (("^GUILE_PKG.*")
564 "GUILE_PKG([3.0 2.2 2.0])\n"))
565 #t))))
319e26e4
LC
566 (build-system gnu-build-system)
567 (native-inputs
568 `(("autoconf" ,autoconf)
569 ("automake" ,automake)
570 ("pkg-config" ,pkg-config)))
571 (inputs
572 `(("guile" ,guile-2.2)
573 ("sqlite" ,sqlite)))
574 (synopsis "Access SQLite databases from Guile")
575 (description
576 "This package provides Guile bindings to the SQLite database system.")
577 (license license:gpl3+)))
e8ac1f8f 578
c8e3651a
EB
579(define-public guile2.0-sqlite3
580 (package-for-guile-2.0 guile-sqlite3))
581
d15e4b1d
LC
582(define-public guile3.0-sqlite3
583 (package-for-guile-3.0 guile-sqlite3))
584
3b5783fc
AB
585(define-public guile-bytestructures
586 (package
587 (name "guile-bytestructures")
247a47bc 588 (version "1.0.7")
16e42db0 589 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
3b5783fc 590 (source (origin
16e42db0
MO
591 (method git-fetch)
592 (uri (git-reference
593 (url home-page)
594 (commit (string-append "v" version))))
43476625 595 (file-name (git-file-name name version))
3b5783fc
AB
596 (sha256
597 (base32
247a47bc 598 "0q0habjiy3h9cigb7q1br9kz6z212dn2ab31f6dgd3rrmsfn5rvb"))))
4f85f7f7 599 (build-system gnu-build-system)
9a78e181 600 (arguments
7ed9c312
LC
601 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
602
603 #:phases (modify-phases %standard-phases
604 (add-after 'install 'install-doc
605 (lambda* (#:key outputs #:allow-other-keys)
606 (let* ((out (assoc-ref outputs "out"))
607 (package ,(package-full-name this-package "-"))
608 (doc (string-append out "/share/doc/" package)))
609 (install-file "README.md" doc)
610 #t))))))
726ecfeb 611 (native-inputs
16e42db0
MO
612 `(("autoconf" ,autoconf)
613 ("automake" ,automake)
b9a9c8ef
MO
614 ("pkg-config" ,pkg-config)
615 ("guile" ,guile-2.2)))
3b5783fc 616 (inputs
aabece2e 617 `(("guile" ,guile-2.2)))
3b5783fc
AB
618 (synopsis "Structured access to bytevector contents for Guile")
619 (description
620 "Guile bytestructures offers a system imitating the type system
621of the C programming language, to be used on bytevectors. C's type
622system works on raw memory, and Guile works on bytevectors which are
623an abstraction over raw memory. It's also more powerful than the C
624type system, elevating types to first-class status.")
abba4073
LC
625 (license license:gpl3+)
626 (properties '((upstream-name . "bytestructures")))))
3b5783fc 627
726ecfeb
LC
628(define-public guile2.0-bytestructures
629 (package-for-guile-2.0 guile-bytestructures))
630
89a99d53
LC
631(define-public guile3.0-bytestructures
632 (package-for-guile-3.0 guile-bytestructures))
633
bd233722 634(define-public guile-git
e85035c9
LC
635 (package
636 (name "guile-git")
db9771a9 637 (version "0.2.0")
e85035c9
LC
638 (home-page "https://gitlab.com/guile-git/guile-git.git")
639 (source (origin
640 (method git-fetch)
641 (uri (git-reference (url home-page)
642 (commit (string-append "v" version))))
643 (sha256
644 (base32
db9771a9 645 "018hmfsh0rjwfvr4h7y10jc6k8a2k9xsirngghy3pjasin4nd2yz"))
01c11aeb
LC
646 (file-name (git-file-name name version))
647 (modules '((guix build utils)))
648 (snippet
649 '(begin
650 ;; Allow builds with Guile 3.0.
651 (substitute* "configure.ac"
652 (("^GUILE_PKG.*")
653 "GUILE_PKG([3.0 2.2 2.0])\n"))
654
655 ;; The 'guile.m4' that's shipped is too old and fails to
656 ;; recognize Guile 2.9/3.0. Delete it and pick the one
657 ;; provided by the Guile we're using.
658 (delete-file "m4/guile.m4")
659
660 #t))))
e85035c9
LC
661 (build-system gnu-build-system)
662 (native-inputs
663 `(("autoconf" ,autoconf)
664 ("automake" ,automake)
665 ("texinfo" ,texinfo)
666 ("pkg-config" ,pkg-config)))
667 (inputs
668 `(("guile" ,guile-2.2)
669 ("libgit2" ,libgit2)))
670 (propagated-inputs
671 `(("guile-bytestructures" ,guile-bytestructures)))
672 (synopsis "Guile bindings for libgit2")
673 (description
674 "This package provides Guile bindings to libgit2, a library to
bd233722 675manipulate repositories of the Git version control system.")
e85035c9 676 (license license:gpl3+)))
c5793e7e 677
01c11aeb
LC
678(define-public guile3.0-git
679 (package-for-guile-3.0 guile-git))
680
70bc6085 681(define-public guile2.0-git
60353203
LC
682 (let ((base (package-for-guile-2.0 guile-git)))
683 (package
684 (inherit base)
685 ;; Libgit2's Guile test driver requires (ice-9 textual-ports), which is
686 ;; not in Guile 2.0. Thus, keep LIBGIT2 as-is here (i.e., built against
687 ;; Guile 2.2).
688 (inputs `(("libgit2" ,libgit2)
689 ,@(srfi-1:alist-delete "libgit2"
690 (package-inputs base)))))))
70bc6085 691
1722d680 692;;; guile.scm ends here
a8307a17 693