gnu: guile@3.0.8: Disable parallel builds when cross-compiling.
[jackhill/guix/guix.git] / gnu / packages / guile.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
93e6a119 2;;; Copyright © 2012-2022 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>
94551439 6;;; Copyright © 2015, 2017 Christine Lemmer-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>
2bbbf673 18;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
fccc0275 19;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
eaa7ead4 20;;; Copyright © 2021 Timothy Sample <samplet@ngyro.com>
1722d680 21;;;
233e7676 22;;; This file is part of GNU Guix.
1722d680 23;;;
233e7676 24;;; GNU Guix is free software; you can redistribute it and/or modify it
1722d680
LC
25;;; under the terms of the GNU General Public License as published by
26;;; the Free Software Foundation; either version 3 of the License, or (at
27;;; your option) any later version.
28;;;
233e7676 29;;; GNU Guix is distributed in the hope that it will be useful, but
1722d680
LC
30;;; WITHOUT ANY WARRANTY; without even the implied warranty of
31;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32;;; GNU General Public License for more details.
33;;;
34;;; You should have received a copy of the GNU General Public License
233e7676 35;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
1722d680 36
1ffa7090 37(define-module (gnu packages guile)
71e0f217 38 #:use-module ((guix licenses) #:prefix license:)
59a43334 39 #:use-module (gnu packages)
146c6b62
RW
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages base)
9c782445 42 #:use-module (gnu packages bash)
1ffa7090 43 #:use-module (gnu packages bdw-gc)
148585c2 44 #:use-module (gnu packages compression)
255d1bbe 45 #:use-module (gnu packages dbm)
146c6b62 46 #:use-module (gnu packages flex)
1ffa7090 47 #:use-module (gnu packages gawk)
146c6b62 48 #:use-module (gnu packages gettext)
973c6f18 49 #:use-module (gnu packages gperf)
ee8ee748 50 #:use-module (gnu packages hurd)
1ffa7090 51 #:use-module (gnu packages libffi)
1ffa7090 52 #:use-module (gnu packages libunistring)
7119cca8 53 #:use-module (gnu packages linux)
1ffa7090
LC
54 #:use-module (gnu packages m4)
55 #:use-module (gnu packages multiprecision)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages readline)
cd0322a3 58 #:use-module (gnu packages sqlite)
f906d30c 59 #:use-module (gnu packages texinfo)
bd233722 60 #:use-module (gnu packages version-control)
1722d680 61 #:use-module (guix packages)
87f5d366 62 #:use-module (guix download)
6bc24063 63 #:use-module (guix git-download)
32795fcf 64 #:use-module (guix build-system gnu)
977d8666 65 #:use-module (guix build-system guile)
84af1e74 66 #:use-module (guix deprecation)
b00fbabd 67 #:use-module (guix utils))
1722d680
LC
68
69;;; Commentary:
70;;;
c44899a2 71;;; GNU Guile, and modules and extensions.
1722d680
LC
72;;;
73;;; Code:
74
c44899a2
LC
75(define-public guile-1.8
76 (package
77 (name "guile")
78 (version "1.8.8")
79 (source (origin
87f5d366 80 (method url-fetch)
0db342a5 81 (uri (string-append "mirror://gnu/guile/guile-" version
c44899a2
LC
82 ".tar.gz"))
83 (sha256
84 (base32
01eafd38 85 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
fc1adab1 86 (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
c44899a2 87 (build-system gnu-build-system)
b792bc89
LC
88 (arguments '(#:configure-flags '("--disable-error-on-warning"
89
90 ;; Build with '-O1' to work around GC
91 ;; crash on x86_64:
92 ;; <https://issues.guix.gnu.org/50427>.
93 "CFLAGS=-O1 -g -Wall")
c44899a2
LC
94
95 ;; Insert a phase before `configure' to patch things up.
dc1d3cde
KK
96 #:phases
97 (modify-phases %standard-phases
98 (add-before 'configure 'patch-stuff
99 (lambda* (#:key outputs #:allow-other-keys)
100 ;; Add a call to `lt_dladdsearchdir' so that
101 ;; `libguile-readline.so' & co. are in the
102 ;; loader's search path.
103 (substitute* "libguile/dynl.c"
104 (("lt_dlinit.*$" match)
105 (format #f
106 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
107 match
108 (assoc-ref outputs "out"))))
2f4fbe1c 109
dc1d3cde
KK
110 ;; The usual /bin/sh...
111 (substitute* "ice-9/popen.scm"
78dab5a6
LC
112 (("/bin/sh") (which "sh"))))))
113
114 ;; XXX: Several numerical tests and tests related to
115 ;; 'inet-pton' fail on glibc 2.33/GCC 10. Disable them.
116 ;; TODO: Remove this package when its dependents no longer
117 ;; need it.
118 #:tests? #f))
528ea990
LC
119
120 ;; When cross-compiling, a native version of Guile itself is needed.
121 (native-inputs (if (%current-target-system)
122 `(("self" ,this-package))
123 '()))
124
2f73ea34 125 (inputs (list gawk readline))
c44899a2
LC
126
127 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
128 ;; propagated.
2f73ea34 129 (propagated-inputs (list gmp libltdl))
c44899a2 130
9be8d7c8
LC
131 (native-search-paths
132 (list (search-path-specification
133 (variable "GUILE_LOAD_PATH")
af070955 134 (files '("share/guile/site")))))
9be8d7c8 135
f50d2669 136 (synopsis "Scheme implementation intended especially for extensions")
c44899a2 137 (description
a22dc0c4
LC
138 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
139official extension language of the GNU system. It is an implementation of
140the Scheme language which can be easily embedded in other applications to
141provide a convenient means of extending the functionality of the application
142without requiring the source code to be rewritten.")
6fd52309 143 (home-page "https://www.gnu.org/software/guile/")
71e0f217 144 (license license:lgpl2.0+)))
c44899a2
LC
145
146(define-public guile-2.0
147 (package
148 (name "guile")
b5efd14a 149 (version "2.0.14")
c44899a2 150 (source (origin
87f5d366 151 (method url-fetch)
0db342a5 152 (uri (string-append "mirror://gnu/guile/guile-" version
c44899a2
LC
153 ".tar.xz"))
154 (sha256
155 (base32
b5efd14a 156 "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
c44899a2 157 (build-system gnu-build-system)
528ea990
LC
158
159 ;; When cross-compiling, a native version of Guile itself is needed.
160 (native-inputs `(,@(if (%current-target-system)
161 `(("self" ,this-package))
162 '())
163 ("pkgconfig" ,pkg-config)))
c44899a2 164 (inputs `(("libffi" ,libffi)
88da729f 165 ,@(libiconv-if-needed)
baf549df
LC
166
167 ;; We need Bash when cross-compiling because some of the scripts
168 ;; in bin/ refer to it. Use 'bash-minimal' because we don't need
169 ;; an interactive Bash with Readline and all.
170 ,@(if (target-mingw?) '() `(("bash" ,bash-minimal)))))
c44899a2
LC
171 (propagated-inputs
172 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
173 ;; reads `-lltdl -lunistring', adding them here will add the needed
174 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
175 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
176 ("libunistring" ,libunistring)
be11b102
LC
177
178 ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
179 ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
180 ("libltdl" ,libltdl)
c44899a2
LC
181
182 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
183 ;; must be propagated.
bda1bc6c 184 ("bdw-gc" ,libgc)
c44899a2
LC
185 ("gmp" ,gmp)))
186
9bf62d9b
LC
187 (outputs '("out" "debug"))
188
8ffaa93b 189 (arguments
c9627323
LC
190 `(#:configure-flags
191 ,(if (target-x86-32?) ;<https://issues.guix.gnu.org/49368>
192 ''("--disable-static" "CFLAGS=-g -O2 -fexcess-precision=standard")
193 ''("--disable-static")) ;saves 3 MiB
2ea52f90
LC
194
195 ;; Work around non-reproducible .go files as described in
196 ;; <https://bugs.gnu.org/20272>, which affects 2.0, 2.2, and 3.0 so far.
197 #:parallel-build? #f
198
20897536
TGR
199 #:phases
200 (modify-phases %standard-phases
ba2f61bb
JN
201 ,@(if (hurd-system?)
202 '((add-after 'unpack 'disable-tests
203 (lambda _
204 ;; Hangs at: "Running 00-repl-server.test"
205 (rename-file "test-suite/tests/00-repl-server.test" "00-repl-server.test")
206 ;; Sometimes Hangs at: "Running 00-socket.test"
207 (rename-file "test-suite/tests/00-socket.test" "00-socket.test")
208 ;; FAIL: srfi-18.test: thread-sleep!: thread sleeps fractions of a second
209 (rename-file "test-suite/tests/srfi-18.test" "srfi-18.test")
210 ;; failed to remove 't-guild-compile-7215.go.tdL7yC
211 (substitute* "test-suite/standalone/Makefile.in"
212 (("test-guild-compile ") ""))
213 #t)))
214 '())
20897536
TGR
215 (add-before 'configure 'pre-configure
216 (lambda* (#:key inputs #:allow-other-keys)
217 ;; Tell (ice-9 popen) the file name of Bash.
218 (let ((bash (assoc-ref inputs "bash")))
219 (substitute* "module/ice-9/popen.scm"
220 ;; If bash is #f allow fallback for user to provide
221 ;; "bash" in PATH. This happens when cross-building to
222 ;; MinGW for which we do not have Bash yet.
223 (("/bin/sh")
224 ,@(if (target-mingw?)
225 '((if bash
226 (string-append bash "/bin/bash")
227 "bash"))
228 '((string-append bash "/bin/bash")))))
229 #t))))))
8ffaa93b 230
9be8d7c8
LC
231 (native-search-paths
232 (list (search-path-specification
233 (variable "GUILE_LOAD_PATH")
af070955 234 (files '("share/guile/site/2.0")))
9be8d7c8
LC
235 (search-path-specification
236 (variable "GUILE_LOAD_COMPILED_PATH")
b03f270e 237 (files '("lib/guile/2.0/site-ccache")))))
9be8d7c8 238
f50d2669 239 (synopsis "Scheme implementation intended especially for extensions")
c44899a2 240 (description
a22dc0c4
LC
241 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
242official extension language of the GNU system. It is an implementation of
243the Scheme language which can be easily embedded in other applications to
244provide a convenient means of extending the functionality of the application
245without requiring the source code to be rewritten.")
6fd52309 246 (home-page "https://www.gnu.org/software/guile/")
71e0f217 247 (license license:lgpl3+)))
c44899a2 248
f6396d86 249(define-public guile-2.2
f906d30c 250 (package (inherit guile-2.0)
f6396d86 251 (name "guile")
edc8fd2e 252 (version "2.2.7")
4eae7980
LC
253 (source (origin
254 (method url-fetch)
34d624ce
LC
255
256 ;; Note: we are limited to one of the compression formats
257 ;; supported by the bootstrap binaries, so no lzip here.
80a72572 258 (uri (string-append "mirror://gnu/guile/guile-" version
34d624ce 259 ".tar.xz"))
4eae7980
LC
260 (sha256
261 (base32
edc8fd2e 262 "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))
d9f0788a 263 (modules '((guix build utils)))
44f07d1d 264 (patches (search-patches
a8650a70
MO
265 "guile-2.2-skip-oom-test.patch"
266 "guile-2.2-skip-so-test.patch"))
d9f0788a
LC
267
268 ;; Remove the pre-built object files. Instead, build everything
269 ;; from source, at the expense of significantly longer build
270 ;; times (almost 3 hours on a 4-core Intel i5).
6cbee49d
MW
271 (snippet '(begin
272 (for-each delete-file
273 (find-files "prebuilt" "\\.go$"))
274 #t))))
9b09a753
LC
275 (arguments
276 (substitute-keyword-arguments (package-arguments guile-2.0)
277 ((#:configure-flags flags ''())
278 (if (target-x86-32?) ;<https://issues.guix.gnu.org/49368>
c9627323
LC
279 `(append '("--disable-static")
280 '("CFLAGS=-g -O2 -fexcess-precision=standard"))
9b09a753
LC
281 flags))))
282
4fbd0f4f 283 (properties '((timeout . 72000) ;20 hours
16b0f205 284 (max-silent-time . 36000))) ;10 hours (needed on ARM
1577a658 285 ; when heavily loaded)
dd90ed89
DT
286 (native-search-paths
287 (list (search-path-specification
288 (variable "GUILE_LOAD_PATH")
289 (files '("share/guile/site/2.2")))
290 (search-path-specification
291 (variable "GUILE_LOAD_COMPILED_PATH")
1dcca83a 292 (files '("lib/guile/2.2/site-ccache")))))))
4eae7980 293
edc8fd2e 294(define-deprecated guile-2.2/bug-fix guile-2.2)
4bd6f1d1 295
8400d097 296(define-public guile-2.2.4
dbcf2b61
MB
297 (package
298 (inherit guile-2.2)
8400d097
LC
299 (version "2.2.4")
300 (source (origin
301 (inherit (package-source guile-2.2))
302 (uri (string-append "mirror://gnu/guile/guile-" version
303 ".tar.xz"))
304 (sha256
305 (base32
306 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
34d624ce 307
e7921d5e
LC
308(define-public guile-3.0
309 ;; This is the latest Guile stable version.
2d0e802f
DT
310 (package
311 (inherit guile-2.2)
b6bee63b 312 (name "guile")
a81c898f 313 (version "3.0.7")
2d0e802f 314 (source (origin
9ba35475
EF
315 (inherit (package-source guile-2.2))
316 (patches '()) ; We no longer need the patches.
1a30351b 317 (uri (string-append "mirror://gnu/guile/guile-"
2d0e802f
DT
318 version ".tar.xz"))
319 (sha256
320 (base32
9ba35475
EF
321 "1dwiwsrpm4f96alfnz6wibq378242z4f16vsxgy1n9r00v3qczgm"))
322 ;; Replace the snippet because the oom-test still
323 ;; fails on some 32-bit architectures.
324 (snippet '(begin
325 (substitute* "test-suite/standalone/Makefile.in"
326 (("test-out-of-memory") ""))
327 (for-each delete-file
777962de 328 (find-files "prebuilt" "\\.go$"))))))
a81c898f
LC
329
330 ;; Build with the bundled mini-GMP to avoid interference with GnuTLS' own
331 ;; use of GMP via Nettle: <https://issues.guix.gnu.org/46330>.
332 (propagated-inputs
b00fbabd
LC
333 (modify-inputs (package-propagated-inputs guile-2.2)
334 (delete "gmp" "libltdl")))
916ec91f 335 (arguments
9b09a753 336 (substitute-keyword-arguments (package-arguments guile-2.0)
a81c898f 337 ((#:configure-flags flags ''())
fccc0275
MD
338 ;; XXX: JIT-enabled Guile crashes in obscure ways on GNU/Hurd.
339 `(cons* ,@(if (hurd-target?)
340 '("--disable-jit")
341 '())
342 ;; -fexcess-precision=standard is required when compiling for
343 ;; i686-linux, otherwise "numbers.test" will fail
344 ;; (see <https://issues.guix.gnu.org/49368> and
345 ;; <https://issues.guix.gnu.org/49659>).
9b09a753
LC
346 ;; TODO: Keep this in GUILE-2.2 and remove from here on next
347 ;; rebuild cycle.
fccc0275
MD
348 ,@(if (target-x86-32?)
349 '("CFLAGS=-g -O2 -fexcess-precision=standard")
350 '())
351 "--enable-mini-gmp"
c9627323 352 '("--disable-static")))
9ba35475 353 ((#:phases phases)
285f3b58
LC
354 `(modify-phases ,phases
355 (add-before 'check 'disable-stack-overflow-test
356 (lambda _
357 ;; This test can invoke the "OOM killer", especially when
358 ;; running on emulated hardware (QEMU). Skip it.
359 (substitute* "test-suite/standalone/test-stack-overflow"
360 (("!#")
361 "!#\n(exit 77)\n"))))
362
363 ,@(if (string-prefix? "powerpc-" (%current-system))
364 `((add-after 'unpack 'adjust-bootstrap-flags
365 (lambda _
366 ;; Upstream knows about suggested solution.
367 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45214
368 (substitute* "bootstrap/Makefile.in"
369 (("^GUILE_OPTIMIZATIONS.*")
f9fbed01
EF
370 "GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps\n")))))
371 '())
372 ,@(if (or (target-ppc32?)
373 (target-riscv64?))
374 `((add-after 'unpack 'skip-failing-fdes-test
375 (lambda _
376 ;; ERROR: ((system-error "seek" "~A" ("Bad file descriptor") (9)))
377 (substitute* "test-suite/tests/ports.test"
378 (("fdes not closed\"" all) (string-append all "(exit 77)")))
379 #t)))
380 '())))))
9ba35475 381
2d0e802f
DT
382 (native-search-paths
383 (list (search-path-specification
384 (variable "GUILE_LOAD_PATH")
385 (files '("share/guile/site/3.0")))
386 (search-path-specification
387 (variable "GUILE_LOAD_COMPILED_PATH")
388 (files '("lib/guile/3.0/site-ccache"
e7921d5e
LC
389 "share/guile/site/3.0")))))))
390
9e91f862 391(define-public guile-3.0-latest
076e825d
LC
392 (package
393 (inherit guile-3.0)
394 (version "3.0.8")
395 (source (origin
396 (inherit (package-source guile-3.0))
397 (uri (string-append "mirror://gnu/guile/guile-"
398 version ".tar.xz"))
399 (sha256
400 (base32
e9b7adde
LC
401 "04wagg0zr0sib0w9ly5jm91jplgfigzfgmy8fjdlx07jaq50d9ys"))
402 (patches (search-patches "guile-cross-compilation.patch"))))
076e825d
LC
403 (arguments
404 (substitute-keyword-arguments (package-arguments guile-3.0)
405 ;; Guile 3.0.8 is bit-reproducible when built in parallel, thanks to
dd6b951f
LC
406 ;; its multi-stage build process for cross-module inlining, except when
407 ;; cross-compiling.
408 ((#:parallel-build? _ #f)
409 (not (%current-target-system)))))))
89ab6bfb 410
b6bee63b
LC
411(define-public guile-3.0/fixed
412 ;; A package of Guile that's rarely changed. It is the one used in the
413 ;; `base' module, and thus changing it entails a full rebuild.
414 (package
415 (inherit guile-3.0)
416 (properties '((hidden? . #t) ;people should install 'guile-2.2'
417 (timeout . 72000) ;20 hours
418 (max-silent-time . 36000))))) ;10 hours (needed on ARM
419 ; when heavily loaded)
420
973c6f18 421(define-public guile-next
93e6a119 422 (let ((version "3.0.7")
973c6f18 423 (revision "0")
93e6a119 424 (commit "d70c1dbebf9ac0fd45af4578c23983ec4a7da535"))
973c6f18
LC
425 (package
426 (inherit guile-3.0)
427 (name "guile-next")
428 (version (git-version version revision commit))
429 (source (origin
430 ;; The main goal here is to allow for '--with-branch'.
431 (method git-fetch)
432 (uri (git-reference
433 (url "https://git.savannah.gnu.org/git/guile.git")
434 (commit commit)))
2bbbf673 435 (file-name (git-file-name name version))
973c6f18
LC
436 (sha256
437 (base32
93e6a119 438 "05rsk9lh5kchbav3lwfwgvgybrykqqjmkkc6689fhb3mjr5m3dqj"))))
973c6f18
LC
439 (arguments
440 (substitute-keyword-arguments (package-arguments guile-3.0)
441 ((#:phases phases '%standard-phases)
442 `(modify-phases ,phases
443 (add-before 'check 'skip-failing-tests
444 (lambda _
445 (substitute* "test-suite/standalone/test-out-of-memory"
446 (("!#") "!#\n\n(exit 77)\n"))
447 (delete-file "test-suite/tests/version.test")
448 #t))))))
449 (native-inputs
2f73ea34
LC
450 (modify-inputs (package-native-inputs guile-3.0)
451 (prepend autoconf
452 automake
453 libtool
454 flex
455 gnu-gettext
456 texinfo
457 gperf)))
973c6f18
LC
458 (synopsis "Development version of GNU Guile"))))
459
7c3b6b2e 460(define* (make-guile-readline guile #:optional (name "guile-readline"))
2ba2c98d 461 (package
7c3b6b2e 462 (name name)
2ba2c98d
LC
463 (version (package-version guile))
464 (source (package-source guile))
465 (build-system gnu-build-system)
466 (arguments
7046a8ff
LC
467 '(#:configure-flags '("--disable-silent-rules"
468 "--enable-mini-gmp") ;for Guile >= 3.0.6
2ba2c98d
LC
469 #:phases (modify-phases %standard-phases
470 (add-before 'build 'chdir
471 (lambda* (#:key outputs #:allow-other-keys)
472 (invoke "make" "-C" "libguile" "scmconfig.h")
473 (invoke "make" "-C" "lib")
474 (chdir "guile-readline")
475
476 (substitute* "Makefile"
477 (("../libguile/libguile-[[:graph:]]+\\.la")
478 ;; Remove dependency on libguile-X.Y.la.
479 "")
480 (("^READLINE_LIBS = (.*)$" _ libs)
481 ;; Link against the provided libguile.
482 (string-append "READLINE_LIBS = "
483 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
484 libs "\n"))
485 (("\\$\\(top_builddir\\)/meta/build-env")
486 ;; Use the provided Guile, not the one from
487 ;; $(builddir).
488 "")
489
490 ;; Install modules to the 'site' directories.
491 (("^moddir = .*$")
492 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
493 (("^ccachedir = .*$")
494 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
495
496 ;; Load 'guile-readline.so' from the right place.
497 (substitute* "ice-9/readline.scm"
498 (("load-extension \"guile-readline\"")
499 (format #f "load-extension \
500 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
501 (assoc-ref outputs "out"))))
502 #t)))))
503 (home-page (package-home-page guile))
504 (native-inputs (package-native-inputs guile))
505 (inputs
506 `(,@(package-inputs guile) ;to placate 'configure'
507 ,@(package-propagated-inputs guile)
508 ("guile" ,guile)
509 ("readline" ,readline)))
510 (synopsis "Line editing support for GNU Guile")
511 (description
512 "This module provides line editing support via the Readline library for
513GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
514@code{activate-readline} procedure to enable it.")
515 (license license:gpl3+)))
516
517(define-public guile-readline
142cd4dc 518 (make-guile-readline guile-3.0))
2ba2c98d 519
142cd4dc
MB
520(define-public guile2.2-readline
521 (make-guile-readline guile-2.2 "guile2.2-readline"))
7c3b6b2e 522
8f4acad7
LC
523(define (guile-variant-package-name prefix)
524 (lambda (name)
525 "Return NAME with PREFIX instead of \"guile-\", when applicable."
526 (if (string-prefix? "guile-" name)
527 (string-append prefix "-"
528 (string-drop name
529 (string-length "guile-")))
530 name)))
947a5d47 531
8f4acad7 532(define package-for-guile-2.0
10b507b2 533 ;; A procedure that rewrites the dependency tree of the given package to use
e8bc2a01
MB
534 ;; GUILE-2.0 instead of GUILE-3.0.
535 (package-input-rewriting `((,guile-3.0 . ,guile-2.0))
8819551c
LC
536 (guile-variant-package-name "guile2.0")
537 #:deep? #f))
947a5d47 538
b6bee63b
LC
539(define package-for-guile-2.2
540 (package-input-rewriting `((,guile-3.0 . ,guile-2.2))
8819551c
LC
541 (guile-variant-package-name "guile2.2")
542 #:deep? #f))
b6bee63b 543
4eae7980 544(define-public guile-for-guile-emacs
a71d3358
RW
545 (let ((commit "15ca78482ac0dd2e3eb36dcb31765d8652d7106d")
546 (revision "1"))
547 (package (inherit guile-2.2)
548 (name "guile-for-guile-emacs")
549 (version (git-version "2.1.2" revision commit))
550 (source (origin
551 (method git-fetch)
552 (uri (git-reference
553 (url "git://git.savannah.gnu.org/guile.git")
554 (commit commit)))
555 (file-name (git-file-name name version))
556 (sha256
557 (base32
558 "1l7ik4q4zk7vq4m3gnwizc0b64b1mdr31hxqlzxs94xaf2lvi7s2"))))
559 (arguments
560 (substitute-keyword-arguments (package-arguments guile-2.2)
561 ((#:phases phases '%standard-phases)
562 `(modify-phases ,phases
563 (replace 'bootstrap
564 (lambda _
565 ;; Disable broken tests.
566 ;; TODO: Fix them!
567 (substitute* "test-suite/tests/gc.test"
568 (("\\(pass-if \"after-gc-hook gets called\"" m)
569 (string-append "#;" m)))
570 (substitute* "test-suite/tests/version.test"
571 (("\\(pass-if \"version reporting works\"" m)
572 (string-append "#;" m)))
573 ;; Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
574 ;; FAIL: test-out-of-memory
575 (substitute* "test-suite/standalone/Makefile.am"
576 (("(check_SCRIPTS|TESTS) \\+= test-out-of-memory") ""))
b00fbabd 577
a71d3358
RW
578 (patch-shebang "build-aux/git-version-gen")
579 (invoke "sh" "autogen.sh")
580 #t))))))
581 (native-inputs
b00fbabd
LC
582 (modify-inputs (package-native-inputs guile-2.2)
583 (prepend autoconf
584 automake
585 libtool
586 flex
587 texinfo
588 gettext-minimal))))))
be3feafe 589
c44899a2
LC
590\f
591;;;
592;;; Extensions.
593;;;
594
84af1e74 595(define-public guile-json-1
6050a1fb
CR
596 (package
597 (name "guile-json")
327ebd55 598 (version "1.3.2")
f52ef55e 599 (home-page "https://github.com/aconchillo/guile-json")
6050a1fb 600 (source (origin
ffc72ec6 601 (method url-fetch)
28123c01
LC
602 (uri (string-append "mirror://savannah/guile-json/guile-json-"
603 version ".tar.gz"))
ffc72ec6
LC
604 (sha256
605 (base32
327ebd55 606 "0m6yzb169r6iz56k3nkncjaiijwi4p0x9ijn1p5ax3s77jklxy9k"))))
6050a1fb 607 (build-system gnu-build-system)
327ebd55
EF
608 (arguments
609 `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
2f73ea34
LC
610 (native-inputs (list pkg-config guile-2.2))
611 (inputs (list guile-2.2))
6050a1fb
CR
612 (synopsis "JSON module for Guile")
613 (description
0f31d4f0
LC
614 "Guile-JSON supports parsing and building JSON documents according to the
615specification. These are the main features:
616
617@itemize
618@item Strictly complies to @uref{http://json.org, specification}.
619@item Build JSON documents programmatically via macros.
620@item Unicode support for strings.
621@item Allows JSON pretty printing.
622@end itemize\n")
15214828
LC
623
624 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
625 (license license:gpl3+)))
6050a1fb 626
84af1e74
LC
627;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
628;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
629;; 'guile-json-3'.
9b65dea8 630(define-deprecated guile-json guile-json-1)
7f81cce3 631(export guile-json)
584a3ca3 632
2252f087 633(define-public guile2.0-json
84af1e74 634 (package-for-guile-2.0 guile-json-1))
947a5d47 635
152d4076
LC
636(define-public guile-json-3
637 ;; This version is incompatible with 1.x; see the 'NEWS' file.
638 (package
84af1e74 639 (inherit guile-json-1)
152d4076 640 (name "guile-json")
5d9e2187 641 (version "3.5.0")
152d4076
LC
642 (source (origin
643 (method url-fetch)
28123c01
LC
644 (uri (string-append "mirror://savannah/guile-json/guile-json-"
645 version ".tar.gz"))
152d4076
LC
646 (sha256
647 (base32
5d9e2187 648 "0nj0684qgh6ppkbdyxqfyjwsv2qbyairxpi8fzrhsi3xnc7jn4im"))))
2f73ea34
LC
649 (native-inputs (list pkg-config guile-3.0))
650 (inputs (list guile-3.0))))
b6bee63b 651
793a48ed
LC
652(define-public guile-json-4
653 (package
654 (inherit guile-json-3)
655 (name "guile-json")
fc5f9de5 656 (version "4.5.2")
793a48ed
LC
657 (source (origin
658 (method url-fetch)
659 (uri (string-append "mirror://savannah/guile-json/guile-json-"
660 version ".tar.gz"))
661 (sha256
662 (base32
fc5f9de5 663 "0cqr0ljqmzlc2bwrapcsmcgxg147h66mcxf23824ri5i6vn4dc0s"))))))
793a48ed
LC
664
665(define-public guile2.2-json
666 (package-for-guile-2.2 guile-json-4))
667
93e7199b
CAW
668;; There are two guile-gdbm packages, one using the FFI and one with
669;; direct C bindings, hence the verbose name.
670
671(define-public guile-gdbm-ffi
672 (package
673 (name "guile-gdbm-ffi")
674 (version "20120209.fa1d5b6")
675 (source (origin
676 (method git-fetch)
677 (uri (git-reference
b0e7b699 678 (url "https://github.com/ijp/guile-gdbm")
93e7199b 679 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
821f4dc2 680 (file-name (string-append name "-" version "-checkout"))
977d8666
LC
681 (patches (search-patches
682 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
93e7199b
CAW
683 (sha256
684 (base32
685 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
977d8666
LC
686 (build-system guile-build-system)
687 (arguments
688 '(#:phases (modify-phases %standard-phases
689 (add-after 'unpack 'move-examples
690 (lambda* (#:key outputs #:allow-other-keys)
691 ;; Move examples where they belong.
692 (let* ((out (assoc-ref outputs "out"))
693 (doc (string-append out "/share/doc/"
694 (strip-store-file-name out)
695 "/examples")))
696 (copy-recursively "examples" doc)
697 (delete-file-recursively "examples")
698 #t)))
699 (add-after 'unpack 'set-libgdbm-file-name
700 (lambda* (#:key inputs #:allow-other-keys)
701 (substitute* "gdbm.scm"
702 (("\\(dynamic-link \"libgdbm\"\\)")
703 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
704 (assoc-ref inputs "gdbm"))))
705 #t)))))
2f73ea34
LC
706 (native-inputs (list guile-3.0))
707 (inputs (list gdbm))
93e7199b
CAW
708 (home-page "https://github.com/ijp/guile-gdbm")
709 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
710 (description
711 "Guile bindings to the GDBM key-value storage system, using
712Guile's foreign function interface.")
71e0f217 713 (license license:gpl3+)))
93e7199b 714
5bd3a841
LC
715(define-public guile2.0-gdbm-ffi
716 (package-for-guile-2.0 guile-gdbm-ffi))
717
b6bee63b
LC
718(define-public guile2.2-gdbm-ffi
719 (package-for-guile-2.2 guile-gdbm-ffi))
720
e8ac1f8f 721(define-public guile-sqlite3
319e26e4
LC
722 (package
723 (name "guile-sqlite3")
1eec6b0c 724 (version "0.1.2")
3527f600 725 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
319e26e4
LC
726 (source (origin
727 (method git-fetch)
728 (uri (git-reference
729 (url home-page)
730 (commit (string-append "v" version))))
731 (sha256
732 (base32
1eec6b0c 733 "1nryy9j3bk34i0alkmc9bmqsm0ayz92k1cdf752mvhyjjn8nr928"))
29e4d3ea 734 (file-name (string-append name "-" version "-checkout"))))
319e26e4 735 (build-system gnu-build-system)
2f73ea34
LC
736 (native-inputs (list autoconf automake guile-3.0 pkg-config))
737 (inputs (list guile-3.0 sqlite))
319e26e4
LC
738 (synopsis "Access SQLite databases from Guile")
739 (description
740 "This package provides Guile bindings to the SQLite database system.")
741 (license license:gpl3+)))
e8ac1f8f 742
c8e3651a
EB
743(define-public guile2.0-sqlite3
744 (package-for-guile-2.0 guile-sqlite3))
745
b6bee63b
LC
746(define-public guile2.2-sqlite3
747 (package-for-guile-2.2 guile-sqlite3))
748
3b5783fc
AB
749(define-public guile-bytestructures
750 (package
751 (name "guile-bytestructures")
b1eb7448 752 (version "1.0.10")
16e42db0 753 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
3b5783fc 754 (source (origin
16e42db0
MO
755 (method git-fetch)
756 (uri (git-reference
757 (url home-page)
0a1da465 758 (commit version)))
43476625 759 (file-name (git-file-name name version))
3b5783fc
AB
760 (sha256
761 (base32
b1eb7448 762 "14k50jln32kkxv41hvsdgjkkfj6xlv06vc1caz01qkgk1fzh72nk"))))
4f85f7f7 763 (build-system gnu-build-system)
9a78e181 764 (arguments
7ed9c312
LC
765 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
766
767 #:phases (modify-phases %standard-phases
768 (add-after 'install 'install-doc
769 (lambda* (#:key outputs #:allow-other-keys)
770 (let* ((out (assoc-ref outputs "out"))
771 (package ,(package-full-name this-package "-"))
772 (doc (string-append out "/share/doc/" package)))
773 (install-file "README.md" doc)
774 #t))))))
2f73ea34
LC
775 (native-inputs (list autoconf automake pkg-config guile-3.0))
776 (inputs (list guile-3.0))
3b5783fc
AB
777 (synopsis "Structured access to bytevector contents for Guile")
778 (description
779 "Guile bytestructures offers a system imitating the type system
780of the C programming language, to be used on bytevectors. C's type
781system works on raw memory, and Guile works on bytevectors which are
782an abstraction over raw memory. It's also more powerful than the C
783type system, elevating types to first-class status.")
abba4073
LC
784 (license license:gpl3+)
785 (properties '((upstream-name . "bytestructures")))))
3b5783fc 786
726ecfeb
LC
787(define-public guile2.0-bytestructures
788 (package-for-guile-2.0 guile-bytestructures))
789
b6bee63b
LC
790(define-public guile2.2-bytestructures
791 (package-for-guile-2.2 guile-bytestructures))
792
bd233722 793(define-public guile-git
e85035c9
LC
794 (package
795 (name "guile-git")
de1ae961 796 (version "0.5.2")
e85035c9
LC
797 (home-page "https://gitlab.com/guile-git/guile-git.git")
798 (source (origin
7a6625e8
XC
799 (method git-fetch)
800 (uri (git-reference
801 (url home-page)
802 (commit (string-append "v" version))))
803 (file-name (git-file-name name version))
e85035c9
LC
804 (sha256
805 (base32
f42bc604
MC
806 "11a51acibwi2hpaygmrpn6nwbr4lqalc87ihrgj3mhz6swbsk9n7"))
807 (patches (search-patches
808 "guile-git-adjust-for-libgit2-1.2.0.patch"))))
e85035c9 809 (build-system gnu-build-system)
3d867fea
EF
810 (arguments
811 `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ; to prevent guild warnings
e85035c9 812 (native-inputs
2f73ea34 813 (list pkg-config autoconf automake texinfo guile-3.0 guile-bytestructures))
e85035c9 814 (inputs
2f73ea34 815 (list guile-3.0 libgit2))
e85035c9 816 (propagated-inputs
2f73ea34 817 (list guile-bytestructures))
e85035c9
LC
818 (synopsis "Guile bindings for libgit2")
819 (description
820 "This package provides Guile bindings to libgit2, a library to
bd233722 821manipulate repositories of the Git version control system.")
e85035c9 822 (license license:gpl3+)))
c5793e7e 823
b6bee63b
LC
824(define-public guile2.2-git
825 (package-for-guile-2.2 guile-git))
01c11aeb 826
70bc6085 827(define-public guile2.0-git
2bd60ca1 828 (package-for-guile-2.0 guile-git))
70bc6085 829
e5758aeb
MO
830(define-public guile-zlib
831 (package
832 (name "guile-zlib")
97b45977 833 (version "0.1.0")
44241391
MO
834 (source
835 (origin
4aa7dfe4
MO
836 ;; XXX: Do not use "git-fetch" method here that would create and
837 ;; endless inclusion loop, because this package is used as an extension
838 ;; in the same method.
44241391
MO
839 (method url-fetch)
840 (uri
97b45977 841 (string-append "https://notabug.org/guile-zlib/guile-zlib/archive/v"
44241391 842 version ".tar.gz"))
b4d6e378 843 (file-name (string-append name "-" version ".tar.gz"))
44241391 844 (sha256
97b45977 845 ;; content hash: 1ip18nzwnczqyhn9cpzxkm9vzpi5fz5sy96cgjhmp7cwhnkmv6zv
44241391 846 (base32
97b45977 847 "1safz7rrbdf1d98x3lgx5v74kivpyf9n1v6pdyy22vd0f2sjdir5"))))
e5758aeb
MO
848 (build-system gnu-build-system)
849 (arguments
850 '(#:make-flags
851 '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
2f73ea34
LC
852 (native-inputs (list autoconf automake pkg-config guile-3.0))
853 (inputs (list guile-3.0 zlib))
e5758aeb
MO
854 (synopsis "Guile bindings to zlib")
855 (description
856 "This package provides Guile bindings for zlib, a lossless
857data-compression library. The bindings are written in pure Scheme by using
858Guile's foreign function interface.")
859 (home-page "https://notabug.org/guile-zlib/guile-zlib")
860 (license license:gpl3+)))
a8307a17 861
2a9af225
LC
862(define-public guile2.2-zlib
863 (package-for-guile-2.2 guile-zlib))
864
e5758aeb
MO
865(define-public guile-lzlib
866 (package
867 (name "guile-lzlib")
af56f60e 868 (version "0.0.2")
69361e88
MO
869 (source
870 (origin
871 (method url-fetch)
872 (uri
873 (string-append "https://notabug.org/guile-lzlib/guile-lzlib/archive/"
874 version ".tar.gz"))
90748666 875 (file-name (string-append name "-" version ".tar.gz"))
69361e88
MO
876 (sha256
877 (base32
af56f60e 878 "11sggvncyx08ssp1s5xii4d6nskh1qwqihnbpzzvkrs7sivxn8w6"))))
e5758aeb
MO
879 (build-system gnu-build-system)
880 (arguments
881 '(#:make-flags
882 '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
2f73ea34
LC
883 (native-inputs (list autoconf automake pkg-config guile-3.0))
884 (inputs (list guile-3.0 lzlib))
e5758aeb
MO
885 (synopsis "Guile bindings to lzlib")
886 (description
887 "This package provides Guile bindings for lzlib, a C library for
888in-memory LZMA compression and decompression. The bindings are written in
889pure Scheme by using Guile's foreign function interface.")
890 (home-page "https://notabug.org/guile-lzlib/guile-lzlib")
891 (license license:gpl3+)))
892
2238bd8d
LC
893(define-public guile2.2-lzlib
894 (package-for-guile-2.2 guile-lzlib))
895
32568f5b
LC
896(define-public guile-zstd
897 (package
898 (name "guile-zstd")
899 (version "0.1.1")
900 (home-page "https://notabug.org/guile-zstd/guile-zstd")
901 (source (origin
902 (method git-fetch)
903 (uri (git-reference (url home-page)
904 (commit (string-append "v" version))))
905 (file-name (git-file-name name version))
906 (sha256
907 (base32
908 "1c8l7829b5yx8wdc0mrhzjfwb6h9hb7cd8dfxcr71a7vlsi86310"))))
909 (build-system gnu-build-system)
2f73ea34
LC
910 (native-inputs (list autoconf automake pkg-config guile-3.0))
911 (inputs (list `(,zstd "lib") guile-3.0))
32568f5b
LC
912 (synopsis "GNU Guile bindings to the zstd compression library")
913 (description
914 "This package provides a GNU Guile interface to the zstd (``zstandard'')
915compression library.")
916 (license license:gpl3+)))
917
eaa7ead4
TS
918(define-public guile-lzma
919 (package
920 (name "guile-lzma")
9f6532c7 921 (version "0.1.1")
eaa7ead4
TS
922 (source
923 (origin
924 (method url-fetch)
925 (uri (string-append "https://files.ngyro.com/guile-lzma/guile-lzma-"
926 version ".tar.gz"))
927 (sha256
9f6532c7 928 (base32 "0pnfzk92p9y5ymjq6rq619b9fy0dflv56jwg00wlvvbjssb6i1ib"))))
eaa7ead4
TS
929 (build-system gnu-build-system)
930 (native-inputs
931 (list autoconf automake guile-3.0 guile-bytestructures pkg-config))
932 (inputs (list guile-3.0 xz))
933 (propagated-inputs (list guile-bytestructures))
934 (home-page "https://ngyro.com/software/guile-lzma.html")
935 (synopsis "Guile bindings for liblzma (XZ)")
936 (description "Guile-LZMA is a Guile wrapper for the liblzma (XZ)
937library. It exposes an interface similar to other Guile compression
938libraries, like Guile-zlib.")
939 (license license:gpl3+)))
940
e5758aeb 941;;; guile.scm ends here