gnu: ld-wrapper: Use _IOLBF on Guile 2.0 only.
[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>
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
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")
edc8fd2e 220 (version "2.2.7")
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
edc8fd2e 230 "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))
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
edc8fd2e 253(define-deprecated guile-2.2/bug-fix guile-2.2)
4bd6f1d1 254
34d624ce
LC
255(define-public guile-2.2/fixed
256 ;; A package of Guile 2.2 that's rarely changed. It is the one used
257 ;; in the `base' module, and thus changing it entails a full rebuild.
258 (package
259 (inherit guile-2.2)
a9308efe 260 (properties '((hidden? . #t) ;people should install 'guile-2.2'
5a5b3632
MW
261 (timeout . 72000) ;20 hours
262 (max-silent-time . 36000))))) ;10 hours (needed on ARM
263 ; when heavily loaded)
8400d097
LC
264(define-public guile-2.2.4
265 (package/inherit
266 guile-2.2
267 (version "2.2.4")
268 (source (origin
269 (inherit (package-source guile-2.2))
270 (uri (string-append "mirror://gnu/guile/guile-" version
271 ".tar.xz"))
272 (sha256
273 (base32
274 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
34d624ce 275
e7921d5e
LC
276(define-public guile-3.0
277 ;; This is the latest Guile stable version.
2d0e802f
DT
278 (package
279 (inherit guile-2.2)
e7921d5e 280 (name "guile-next") ;to be renamed to "guile"
98619142 281 (version "3.0.1")
2d0e802f
DT
282 (source (origin
283 (inherit (package-source guile-2.2))
1a30351b 284 (uri (string-append "mirror://gnu/guile/guile-"
2d0e802f
DT
285 version ".tar.xz"))
286 (sha256
287 (base32
98619142
LC
288 "1jakps3127h8g69ixgb4zwc8v2g29dmwql1vi3pwg30kzp8fm5nn"))
289 (patches
290 (append (search-patches "guile-3.0-crash.patch")
291 (origin-patches (package-source guile-2.2))))))
2d0e802f
DT
292 (native-search-paths
293 (list (search-path-specification
294 (variable "GUILE_LOAD_PATH")
295 (files '("share/guile/site/3.0")))
296 (search-path-specification
297 (variable "GUILE_LOAD_COMPILED_PATH")
298 (files '("lib/guile/3.0/site-ccache"
e7921d5e
LC
299 "share/guile/site/3.0")))))))
300
301(define-public guile-next guile-3.0)
5cd074ea 302
7c3b6b2e 303(define* (make-guile-readline guile #:optional (name "guile-readline"))
2ba2c98d 304 (package
7c3b6b2e 305 (name name)
2ba2c98d
LC
306 (version (package-version guile))
307 (source (package-source guile))
308 (build-system gnu-build-system)
309 (arguments
310 '(#:configure-flags '("--disable-silent-rules")
311 #:phases (modify-phases %standard-phases
312 (add-before 'build 'chdir
313 (lambda* (#:key outputs #:allow-other-keys)
314 (invoke "make" "-C" "libguile" "scmconfig.h")
315 (invoke "make" "-C" "lib")
316 (chdir "guile-readline")
317
318 (substitute* "Makefile"
319 (("../libguile/libguile-[[:graph:]]+\\.la")
320 ;; Remove dependency on libguile-X.Y.la.
321 "")
322 (("^READLINE_LIBS = (.*)$" _ libs)
323 ;; Link against the provided libguile.
324 (string-append "READLINE_LIBS = "
325 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
326 libs "\n"))
327 (("\\$\\(top_builddir\\)/meta/build-env")
328 ;; Use the provided Guile, not the one from
329 ;; $(builddir).
330 "")
331
332 ;; Install modules to the 'site' directories.
333 (("^moddir = .*$")
334 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
335 (("^ccachedir = .*$")
336 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
337
338 ;; Load 'guile-readline.so' from the right place.
339 (substitute* "ice-9/readline.scm"
340 (("load-extension \"guile-readline\"")
341 (format #f "load-extension \
342 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
343 (assoc-ref outputs "out"))))
344 #t)))))
345 (home-page (package-home-page guile))
346 (native-inputs (package-native-inputs guile))
347 (inputs
348 `(,@(package-inputs guile) ;to placate 'configure'
349 ,@(package-propagated-inputs guile)
350 ("guile" ,guile)
351 ("readline" ,readline)))
352 (synopsis "Line editing support for GNU Guile")
353 (description
354 "This module provides line editing support via the Readline library for
355GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
356@code{activate-readline} procedure to enable it.")
357 (license license:gpl3+)))
358
359(define-public guile-readline
360 (make-guile-readline guile-2.2))
361
7c3b6b2e
LC
362(define-public guile3.0-readline
363 (make-guile-readline guile-next "guile3.0-readline"))
364
8f4acad7
LC
365(define (guile-variant-package-name prefix)
366 (lambda (name)
367 "Return NAME with PREFIX instead of \"guile-\", when applicable."
368 (if (string-prefix? "guile-" name)
369 (string-append prefix "-"
370 (string-drop name
371 (string-length "guile-")))
372 name)))
947a5d47 373
8f4acad7 374(define package-for-guile-2.0
10b507b2
LC
375 ;; A procedure that rewrites the dependency tree of the given package to use
376 ;; GUILE-2.0 instead of GUILE-2.2.
c9c51ac3 377 (package-input-rewriting `((,guile-2.2 . ,guile-2.0))
8f4acad7 378 (guile-variant-package-name "guile2.0")))
947a5d47 379
89a99d53
LC
380(define package-for-guile-3.0
381 (package-input-rewriting `((,guile-2.2 . ,guile-next))
382 (guile-variant-package-name "guile3.0")))
383
4eae7980 384(define-public guile-for-guile-emacs
f6396d86 385 (package (inherit guile-2.2)
4eae7980
LC
386 (name "guile-for-guile-emacs")
387 (version "20150510.d8d9a8d")
f906d30c
CAW
388 (source (origin
389 (method git-fetch)
390 (uri (git-reference
4eae7980
LC
391 (url "git://git.hcoop.net/git/bpt/guile.git")
392 (commit "d8d9a8da05ec876acba81a559798eb5eeceb5a17")))
51988e3a 393 (file-name (string-append name "-" version "-checkout"))
f906d30c
CAW
394 (sha256
395 (base32
4eae7980 396 "00sprsshy16y8pxjy126hr2adqcvvzzz96hjyjwgg8swva1qh6b0"))))
f906d30c 397 (arguments
8924e3fd
RW
398 `(;; Tests aren't passing for now.
399 ;; Obviously we should re-enable this!
400 #:tests? #f
401 ,@(package-arguments guile-2.2)))
f906d30c
CAW
402 (native-inputs
403 `(("autoconf" ,autoconf)
404 ("automake" ,automake)
405 ("libtool" ,libtool)
406 ("flex" ,flex)
407 ("texinfo" ,texinfo)
b94a6ca0 408 ("gettext" ,gettext-minimal)
f6396d86 409 ,@(package-native-inputs guile-2.2)))
daeb61f7
RW
410 ;; Same as in guile-2.0
411 (native-search-paths
412 (list (search-path-specification
413 (variable "GUILE_LOAD_PATH")
414 (files '("share/guile/site/2.0")))
415 (search-path-specification
416 (variable "GUILE_LOAD_COMPILED_PATH")
31769b9f 417 (files '("lib/guile/2.0/site-ccache"
daeb61f7 418 "share/guile/site/2.0")))))))
be3feafe 419
c44899a2
LC
420\f
421;;;
422;;; Extensions.
423;;;
424
84af1e74 425(define-public guile-json-1
6050a1fb
CR
426 (package
427 (name "guile-json")
15214828 428 (version "1.2.0")
f52ef55e 429 (home-page "https://github.com/aconchillo/guile-json")
6050a1fb 430 (source (origin
ffc72ec6 431 (method url-fetch)
28123c01
LC
432 (uri (string-append "mirror://savannah/guile-json/guile-json-"
433 version ".tar.gz"))
ffc72ec6
LC
434 (sha256
435 (base32
6efccabe 436 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
6050a1fb 437 (build-system gnu-build-system)
6efccabe 438 (native-inputs `(("pkg-config" ,pkg-config)
f52ef55e
LC
439 ("guile" ,guile-2.2)))
440 (inputs `(("guile" ,guile-2.2)))
6050a1fb
CR
441 (synopsis "JSON module for Guile")
442 (description
0f31d4f0
LC
443 "Guile-JSON supports parsing and building JSON documents according to the
444specification. These are the main features:
445
446@itemize
447@item Strictly complies to @uref{http://json.org, specification}.
448@item Build JSON documents programmatically via macros.
449@item Unicode support for strings.
450@item Allows JSON pretty printing.
451@end itemize\n")
15214828
LC
452
453 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
454 (license license:gpl3+)))
6050a1fb 455
84af1e74
LC
456;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
457;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
458;; 'guile-json-3'.
9b65dea8 459(define-deprecated guile-json guile-json-1)
7f81cce3 460(export guile-json)
584a3ca3 461
2252f087 462(define-public guile2.0-json
84af1e74 463 (package-for-guile-2.0 guile-json-1))
947a5d47 464
152d4076
LC
465(define-public guile-json-3
466 ;; This version is incompatible with 1.x; see the 'NEWS' file.
467 (package
84af1e74 468 (inherit guile-json-1)
152d4076 469 (name "guile-json")
4e029919 470 (version "3.2.0")
152d4076
LC
471 (source (origin
472 (method url-fetch)
28123c01
LC
473 (uri (string-append "mirror://savannah/guile-json/guile-json-"
474 version ".tar.gz"))
152d4076
LC
475 (sha256
476 (base32
4e029919 477 "14m6b6g2maw0mkvfm4x63rqb54vgbpn1gcqs715ijw4bikfzlqfz"))))))
152d4076 478
89a99d53
LC
479(define-public guile3.0-json
480 (package-for-guile-3.0 guile-json-3))
481
93e7199b
CAW
482;; There are two guile-gdbm packages, one using the FFI and one with
483;; direct C bindings, hence the verbose name.
484
485(define-public guile-gdbm-ffi
486 (package
487 (name "guile-gdbm-ffi")
488 (version "20120209.fa1d5b6")
489 (source (origin
490 (method git-fetch)
491 (uri (git-reference
492 (url "https://github.com/ijp/guile-gdbm.git")
493 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
821f4dc2 494 (file-name (string-append name "-" version "-checkout"))
977d8666
LC
495 (patches (search-patches
496 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
93e7199b
CAW
497 (sha256
498 (base32
499 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
977d8666
LC
500 (build-system guile-build-system)
501 (arguments
502 '(#:phases (modify-phases %standard-phases
503 (add-after 'unpack 'move-examples
504 (lambda* (#:key outputs #:allow-other-keys)
505 ;; Move examples where they belong.
506 (let* ((out (assoc-ref outputs "out"))
507 (doc (string-append out "/share/doc/"
508 (strip-store-file-name out)
509 "/examples")))
510 (copy-recursively "examples" doc)
511 (delete-file-recursively "examples")
512 #t)))
513 (add-after 'unpack 'set-libgdbm-file-name
514 (lambda* (#:key inputs #:allow-other-keys)
515 (substitute* "gdbm.scm"
516 (("\\(dynamic-link \"libgdbm\"\\)")
517 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
518 (assoc-ref inputs "gdbm"))))
519 #t)))))
520 (native-inputs
521 `(("guile" ,guile-2.2)))
56f31a9f 522 (inputs
56f31a9f 523 `(("gdbm" ,gdbm)))
93e7199b
CAW
524 (home-page "https://github.com/ijp/guile-gdbm")
525 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
526 (description
527 "Guile bindings to the GDBM key-value storage system, using
528Guile's foreign function interface.")
71e0f217 529 (license license:gpl3+)))
93e7199b 530
5bd3a841
LC
531(define-public guile2.0-gdbm-ffi
532 (package-for-guile-2.0 guile-gdbm-ffi))
533
89a99d53
LC
534(define-public guile3.0-gdbm-ffi
535 (package-for-guile-3.0 guile-gdbm-ffi))
93e7199b 536
e8ac1f8f 537(define-public guile-sqlite3
319e26e4
LC
538 (package
539 (name "guile-sqlite3")
540 (version "0.1.0")
3527f600 541 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
319e26e4
LC
542 (source (origin
543 (method git-fetch)
544 (uri (git-reference
545 (url home-page)
546 (commit (string-append "v" version))))
547 (sha256
548 (base32
549 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
e53bf62e
MO
550 (file-name (string-append name "-" version "-checkout"))
551 (patches
9d5aa009 552 (search-patches "guile-sqlite3-fix-cross-compilation.patch"))
d15e4b1d
LC
553 (modules '((guix build utils)))
554 (snippet
555 '(begin
556 ;; Allow builds with Guile 3.0.
557 (substitute* "configure.ac"
558 (("^GUILE_PKG.*")
559 "GUILE_PKG([3.0 2.2 2.0])\n"))
560 #t))))
319e26e4
LC
561 (build-system gnu-build-system)
562 (native-inputs
563 `(("autoconf" ,autoconf)
564 ("automake" ,automake)
e53bf62e 565 ("guile" ,guile-2.2)
319e26e4
LC
566 ("pkg-config" ,pkg-config)))
567 (inputs
568 `(("guile" ,guile-2.2)
569 ("sqlite" ,sqlite)))
570 (synopsis "Access SQLite databases from Guile")
571 (description
572 "This package provides Guile bindings to the SQLite database system.")
573 (license license:gpl3+)))
e8ac1f8f 574
c8e3651a
EB
575(define-public guile2.0-sqlite3
576 (package-for-guile-2.0 guile-sqlite3))
577
d15e4b1d
LC
578(define-public guile3.0-sqlite3
579 (package-for-guile-3.0 guile-sqlite3))
580
3b5783fc
AB
581(define-public guile-bytestructures
582 (package
583 (name "guile-bytestructures")
247a47bc 584 (version "1.0.7")
16e42db0 585 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
3b5783fc 586 (source (origin
16e42db0
MO
587 (method git-fetch)
588 (uri (git-reference
589 (url home-page)
590 (commit (string-append "v" version))))
43476625 591 (file-name (git-file-name name version))
3b5783fc
AB
592 (sha256
593 (base32
247a47bc 594 "0q0habjiy3h9cigb7q1br9kz6z212dn2ab31f6dgd3rrmsfn5rvb"))))
4f85f7f7 595 (build-system gnu-build-system)
9a78e181 596 (arguments
7ed9c312
LC
597 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
598
599 #:phases (modify-phases %standard-phases
600 (add-after 'install 'install-doc
601 (lambda* (#:key outputs #:allow-other-keys)
602 (let* ((out (assoc-ref outputs "out"))
603 (package ,(package-full-name this-package "-"))
604 (doc (string-append out "/share/doc/" package)))
605 (install-file "README.md" doc)
606 #t))))))
726ecfeb 607 (native-inputs
16e42db0
MO
608 `(("autoconf" ,autoconf)
609 ("automake" ,automake)
b9a9c8ef
MO
610 ("pkg-config" ,pkg-config)
611 ("guile" ,guile-2.2)))
3b5783fc 612 (inputs
aabece2e 613 `(("guile" ,guile-2.2)))
3b5783fc
AB
614 (synopsis "Structured access to bytevector contents for Guile")
615 (description
616 "Guile bytestructures offers a system imitating the type system
617of the C programming language, to be used on bytevectors. C's type
618system works on raw memory, and Guile works on bytevectors which are
619an abstraction over raw memory. It's also more powerful than the C
620type system, elevating types to first-class status.")
abba4073
LC
621 (license license:gpl3+)
622 (properties '((upstream-name . "bytestructures")))))
3b5783fc 623
726ecfeb
LC
624(define-public guile2.0-bytestructures
625 (package-for-guile-2.0 guile-bytestructures))
626
89a99d53
LC
627(define-public guile3.0-bytestructures
628 (package-for-guile-3.0 guile-bytestructures))
629
bd233722 630(define-public guile-git
e85035c9
LC
631 (package
632 (name "guile-git")
25623647 633 (version "0.3.0")
e85035c9
LC
634 (home-page "https://gitlab.com/guile-git/guile-git.git")
635 (source (origin
25623647
MB
636 (method url-fetch)
637 (uri (string-append "https://gitlab.com/guile-git/guile-git/uploads/"
638 "4c563d8e7e1ff84396abe8ca7011bcaf/guile-git-"
639 version ".tar.gz"))
e85035c9
LC
640 (sha256
641 (base32
25623647 642 "0c5i3d16hp7gp9rd78vk9zc45js8bphf92m4lbb5gyi4l1yl7kkm"))))
e85035c9
LC
643 (build-system gnu-build-system)
644 (native-inputs
96a9675b
MO
645 `(("pkg-config" ,pkg-config)
646 ("guile" ,guile-2.2)
647 ("guile-bytestructures" ,guile-bytestructures)))
e85035c9
LC
648 (inputs
649 `(("guile" ,guile-2.2)
650 ("libgit2" ,libgit2)))
651 (propagated-inputs
652 `(("guile-bytestructures" ,guile-bytestructures)))
653 (synopsis "Guile bindings for libgit2")
654 (description
655 "This package provides Guile bindings to libgit2, a library to
bd233722 656manipulate repositories of the Git version control system.")
e85035c9 657 (license license:gpl3+)))
c5793e7e 658
01c11aeb
LC
659(define-public guile3.0-git
660 (package-for-guile-3.0 guile-git))
661
70bc6085 662(define-public guile2.0-git
60353203
LC
663 (let ((base (package-for-guile-2.0 guile-git)))
664 (package
665 (inherit base)
666 ;; Libgit2's Guile test driver requires (ice-9 textual-ports), which is
667 ;; not in Guile 2.0. Thus, keep LIBGIT2 as-is here (i.e., built against
668 ;; Guile 2.2).
669 (inputs `(("libgit2" ,libgit2)
670 ,@(srfi-1:alist-delete "libgit2"
671 (package-inputs base)))))))
70bc6085 672
1722d680 673;;; guile.scm ends here
a8307a17 674