projects/guix·blob javascript-team · refs

1086 lines · 44.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2026 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014 Cyril Roelandt <[email protected]>
4;;; Copyright © 2014, 2016, 2018 David Thompson <[email protected]>
5;;; Copyright © 2014, 2017, 2018 Mark H Weaver <[email protected]>
6;;; Copyright © 2015, 2017 Christine Lemmer-Webber <[email protected]>
7;;; Copyright © 2016, 2023, 2024, 2025 Janneke Nieuwenhuizen <[email protected]>
8;;; Copyright © 2016, 2017 Leo Famulari <[email protected]>
9;;; Copyright © 2016, 2019, 2020 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2017 Andy Wingo <[email protected]>
11;;; Copyright © 2017, 2022 Marius Bakke <[email protected]>
12;;; Copyright © 2017, 2019 Mathieu Othacehe <[email protected]>
13;;; Copyright © 2017, 2022 Tobias Geerinckx-Rice <[email protected]>
14;;; Copyright © 2017, 2018 Amirouche <[email protected]>
15;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
16;;; Copyright © 2018 Eric Bavier <[email protected]>
17;;; Copyright © 2019 Taylan Kammer <[email protected]>
18;;; Copyright © 2020-2023 Efraim Flashner <[email protected]>
19;;; Copyright © 2021 Maxime Devos <[email protected]>
20;;; Copyright © 2021, 2024 Timothy Sample <[email protected]>
21;;;
22;;; This file is part of GNU Guix.
23;;;
24;;; GNU Guix is free software; you can redistribute it and/or modify it
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;;;
29;;; GNU Guix is distributed in the hope that it will be useful, but
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
35;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
36
37;;; Commentary:
38;;;
39;;; GNU Guile, and modules and extensions.
40;;;
41;;; Code:
42
43(define-module (gnu packages guile)
44 #:use-module ((guix licenses) #:prefix license:)
45 #:use-module (gnu packages)
46 #:use-module (gnu packages autotools)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bash)
49 #:use-module (gnu packages bdw-gc)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages crypto)
52 #:use-module (gnu packages dbm)
53 #:use-module (gnu packages compiler-tools)
54 #:use-module (gnu packages gawk)
55 #:use-module (gnu packages gettext)
56 #:use-module (gnu packages gperf)
57 #:use-module (gnu packages libffi)
58 #:use-module (gnu packages libunistring)
59 #:use-module (gnu packages linux)
60 #:use-module (gnu packages m4)
61 #:use-module (gnu packages multiprecision)
62 #:use-module (gnu packages pkg-config)
63 #:use-module (gnu packages readline)
64 #:use-module (gnu packages sqlite)
65 #:use-module (gnu packages texinfo)
66 #:use-module (gnu packages version-control)
67 #:use-module (guix gexp)
68 #:use-module (guix packages)
69 #:use-module (guix download)
70 #:use-module (guix git-download)
71 #:use-module (guix build-system gnu)
72 #:use-module (guix build-system guile)
73 #:use-module (guix deprecation)
74 #:use-module (guix utils))
75
76(define-public guile-1.8
77 (package
78 (name "guile")
79 (version "1.8.8")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "mirror://gnu/guile/guile-" version
83 ".tar.gz"))
84 (sha256
85 (base32
86 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
87 (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
88 (build-system gnu-build-system)
89 (arguments '(#:configure-flags '("--disable-error-on-warning"
90
91 ;; Build with '-O1' to work around GC
92 ;; crash on x86_64:
93 ;; <https://issues.guix.gnu.org/50427>.
94 "CFLAGS=-O1 -g -Wall")
95
96 ;; Insert a phase before `configure' to patch things up.
97 #:phases
98 (modify-phases %standard-phases
99 (add-before 'configure 'patch-stuff
100 (lambda* (#:key outputs #:allow-other-keys)
101 ;; Add a call to `lt_dladdsearchdir' so that
102 ;; `libguile-readline.so' & co. are in the
103 ;; loader's search path.
104 (substitute* "libguile/dynl.c"
105 (("lt_dlinit.*$" match)
106 (format #f
107 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
108 match
109 (assoc-ref outputs "out"))))
110
111 ;; The usual /bin/sh...
112 (substitute* "ice-9/popen.scm"
113 (("/bin/sh") (which "sh")))))
114 (add-after 'install 'add-libxcrypt-reference-pkgconfig
115 (lambda* (#:key inputs outputs #:allow-other-keys)
116 (define out (assoc-ref outputs "out"))
117 (define libxcrypt
118 (false-if-exception
119 (dirname (search-input-file inputs "lib/libcrypt.so.1"))))
120 (when libxcrypt
121 (substitute*
122 (find-files (string-append out "/lib/pkgconfig")
123 ".*\\.pc")
124 (("-lcrypt")
125 (string-append "-L" libxcrypt " -lcrypt")))))))
126
127 ;; XXX: Several numerical tests and tests related to
128 ;; 'inet-pton' fail on glibc 2.33/GCC 10. Disable them.
129 ;; TODO: Remove this package when its dependents no longer
130 ;; need it.
131 #:tests? #f))
132
133 ;; When cross-compiling, a native version of Guile itself is needed.
134 (native-inputs (if (%current-target-system)
135 `(("self" ,this-package))
136 '()))
137
138 (inputs (list gawk libxcrypt readline))
139
140 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
141 ;; propagated.
142 (propagated-inputs (list gmp libltdl))
143
144 (native-search-paths
145 (list (search-path-specification
146 (variable "GUILE_LOAD_PATH")
147 (files '("share/guile/site")))))
148
149 (synopsis "Scheme implementation intended especially for extensions")
150 (description
151 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
152official extension language of the GNU system. It is an implementation of
153the Scheme language which can be easily embedded in other applications to
154provide a convenient means of extending the functionality of the application
155without requiring the source code to be rewritten.")
156 (home-page "https://www.gnu.org/software/guile/")
157 (license license:lgpl2.0+)))
158
159(define-public guile-2.0
160 (package
161 (name "guile")
162 (version "2.0.14")
163 (source (origin
164 (method url-fetch)
165 (uri (string-append "mirror://gnu/guile/guile-" version
166 ".tar.xz"))
167 (sha256
168 (base32
169 "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
170 (build-system gnu-build-system)
171
172 ;; When cross-compiling, a native version of Guile itself is needed.
173 (native-inputs
174 (append (list pkg-config)
175 (if (%current-target-system)
176 (list this-package)
177 '())))
178 (inputs
179 (append (list libffi libxcrypt)
180 (libiconv-if-needed)
181
182 ;; We need Bash when cross-compiling because some of the scripts
183 ;; in bin/ refer to it. Use 'bash-minimal' because we don't need
184 ;; an interactive Bash with Readline and all.
185 (if (target-mingw?) '() (list bash-minimal))))
186 (propagated-inputs
187 (list
188 ;; These ones aren't normally needed here, but since `libguile-2.0.la'
189 ;; reads `-lltdl -lunistring', adding them here will add the needed
190 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
191 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
192 libunistring
193
194 ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
195 ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
196 libltdl
197
198 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
199 ;; must be propagated.
200 libgc
201 gmp))
202
203 (outputs '("out" "debug"))
204
205 (arguments
206 `(#:configure-flags
207 ,(if (target-x86-32?) ;<https://issues.guix.gnu.org/49368>
208 ''("--disable-static" "CFLAGS=-g -O2 -fexcess-precision=standard")
209 ''("--disable-static")) ;saves 3 MiB
210
211 ;; Work around non-reproducible .go files as described in
212 ;; <https://bugs.gnu.org/20272>, which affects 2.0, 2.2, and 3.0 so far.
213 #:parallel-build? #f
214
215 #:phases
216 (modify-phases %standard-phases
217 ,@(if (system-hurd?)
218 '((add-after 'unpack 'disable-tests
219 (lambda _
220 ;; Hangs at: "Running 00-repl-server.test"
221 (rename-file "test-suite/tests/00-repl-server.test" "00-repl-server.test")
222 ;; Sometimes Hangs at: "Running 00-socket.test"
223 (rename-file "test-suite/tests/00-socket.test" "00-socket.test")
224 ;; FAIL: srfi-18.test: thread-sleep!: thread sleeps fractions of a second
225 (rename-file "test-suite/tests/srfi-18.test" "srfi-18.test")
226 ;; failed to remove 't-guild-compile-7215.go.tdL7yC
227 (substitute* "test-suite/standalone/Makefile.in"
228 (("test-guild-compile ") "")))))
229 '())
230 ,@(if (system-hurd?)
231 '((add-after 'unpack 'disable-threads.tests
232 (lambda _
233 ;; Many tests hang, esp. (join-thread ..), also others.
234 (rename-file "test-suite/tests/threads.test" "threads.test"))))
235 '())
236 (add-before 'configure 'pre-configure
237 (lambda* (#:key inputs #:allow-other-keys)
238 ;; Tell (ice-9 popen) the file name of Bash.
239
240 ;; TODO: On the next rebuild cycle, unconditionally use
241 ;; 'search-input-file' instead of 'assoc-ref'.
242 (let ((bash (assoc-ref inputs "bash")))
243 (substitute* "module/ice-9/popen.scm"
244 ;; If bash is #f allow fallback for user to provide
245 ;; "bash" in PATH. This happens when cross-building to
246 ;; MinGW for which we do not have Bash yet.
247 (("/bin/sh")
248 ,(cond ((target-mingw?)
249 "bash")
250 ((%current-target-system)
251 '(search-input-file inputs "/bin/bash"))
252 (else
253 '(string-append bash "/bin/bash")))))
254 #t)))
255 (add-after 'install 'add-libxcrypt-reference-pkgconfig
256 (lambda* (#:key inputs outputs #:allow-other-keys)
257 (define out (assoc-ref outputs "out"))
258 (define libxcrypt
259 (false-if-exception
260 (dirname (search-input-file inputs "lib/libcrypt.so.1"))))
261 (when libxcrypt
262 (substitute*
263 (find-files (string-append out "/lib/pkgconfig")
264 ".*\\.pc")
265 (("-lcrypt")
266 (string-append "-L" libxcrypt " -lcrypt")))))))))
267
268 (native-search-paths
269 (list (search-path-specification
270 (variable "GUILE_LOAD_PATH")
271 (files '("share/guile/site/2.0")))
272 (search-path-specification
273 (variable "GUILE_LOAD_COMPILED_PATH")
274 (files '("lib/guile/2.0/site-ccache")))))
275
276 (synopsis "Scheme implementation intended especially for extensions")
277 (description
278 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
279official extension language of the GNU system. It is an implementation of
280the Scheme language which can be easily embedded in other applications to
281provide a convenient means of extending the functionality of the application
282without requiring the source code to be rewritten.")
283 (home-page "https://www.gnu.org/software/guile/")
284 (license license:lgpl3+)))
285
286(define-public guile-2.2
287 (package
288 (inherit guile-2.0)
289 (name "guile")
290 (version "2.2.7")
291 (source (origin
292 (method url-fetch)
293
294 ;; Note: we are limited to one of the compression formats
295 ;; supported by the bootstrap binaries, so no lzip here.
296 (uri (string-append "mirror://gnu/guile/guile-" version
297 ".tar.xz"))
298 (sha256
299 (base32
300 "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))
301 (modules '((guix build utils)))
302 (patches (search-patches
303 "guile-2.2-skip-oom-test.patch"
304 "guile-2.2-skip-so-test.patch"))
305
306 ;; Remove the pre-built object files. Instead, build everything
307 ;; from source, at the expense of significantly longer build
308 ;; times (almost 3 hours on a 4-core Intel i5).
309 (snippet '(begin
310 (for-each delete-file
311 (find-files "prebuilt" "\\.go$"))
312 #t))))
313 (arguments
314 (substitute-keyword-arguments (package-arguments guile-2.0)
315 ((#:configure-flags flags ''())
316 (if (target-x86-32?) ;<https://issues.guix.gnu.org/49368>
317 `(append '("--disable-static")
318 '("CFLAGS=-g -O2 -fexcess-precision=standard"))
319 flags))
320 ((#:phases phases '%standard-phases)
321 #~(modify-phases #$phases
322 #$@(if (system-hurd?)
323 #~((delete 'disable-threads.tests))
324 '())))))
325
326 (properties '((timeout . 72000) ;20 hours
327 (max-silent-time . 36000))) ;10 hours (needed on ARM
328 ; when heavily loaded)
329 (native-search-paths
330 (list (search-path-specification
331 (variable "GUILE_LOAD_PATH")
332 (files '("share/guile/site/2.2")))
333 (search-path-specification
334 (variable "GUILE_LOAD_COMPILED_PATH")
335 (files '("lib/guile/2.2/site-ccache")))))))
336
337(define-public guile-2.2.4
338 ;; guile-2.2.4 has no dependents, but is used in (guix quirks).
339 ;; Do not remove!
340 (package
341 (inherit guile-2.2)
342 (version "2.2.4")
343 (source
344 (origin
345 (inherit (package-source guile-2.2))
346 (uri (string-append "mirror://gnu/guile/guile-" version ".tar.xz"))
347 (sha256
348 (base32 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))
349 ;; libxcrypt-without-failure-tokens uses --disable-failure-tokens, which is
350 ;; necessary for the "crypt: glibc EINVAL" test of guile-2.2.4.
351 (inputs (modify-inputs (package-inputs guile-2.2)
352 (replace "libxcrypt" libxcrypt-without-failure-tokens)))))
353
354(define-public guile-3.0
355 ;; This is the latest Guile stable version.
356 (package
357 (inherit guile-2.2)
358 (name "guile")
359 (version "3.0.9")
360 (source (origin
361 (inherit (package-source guile-2.2))
362 (uri (string-append "mirror://gnu/guile/guile-"
363 version ".tar.xz"))
364 (sha256
365 (base32
366 "03bm1mnfc9kkg2ls942a0js7bxrdzmcffgrgg6anwdmjfan2a9hs"))
367 (patches '())
368 ;; Replace the snippet because the oom-test still
369 ;; fails on some 32-bit architectures.
370 (snippet '(for-each delete-file
371 (find-files "prebuilt" "\\.go$")))))
372
373 ;; Build with the bundled mini-GMP to avoid interference with GnuTLS' own
374 ;; use of GMP via Nettle: <https://issues.guix.gnu.org/46330>.
375 (propagated-inputs
376 (modify-inputs (package-propagated-inputs guile-2.2)
377 (delete "gmp" "libltdl")))
378 (arguments
379 (substitute-keyword-arguments (package-arguments guile-2.0)
380 ;; Guile 3.0.9 is bit-reproducible when built in parallel, thanks to
381 ;; its multi-stage build process for cross-module inlining, except when
382 ;; cross-compiling.
383 ((#:parallel-build? _ #f)
384 (not (%current-target-system)))
385 ((#:configure-flags flags #~'())
386 ;; XXX: JIT-enabled Guile crashes in obscure ways on GNU/Hurd.
387 #~(cons* #$@(if (target-hurd?)
388 #~("--disable-jit")
389 #~())
390 ;; -fexcess-precision=standard is required when compiling for
391 ;; i686-linux, otherwise "numbers.test" will fail
392 ;; (see <https://issues.guix.gnu.org/49368> and
393 ;; <https://issues.guix.gnu.org/49659>).
394 ;; TODO: Keep this in GUILE-2.2 and remove from here on next
395 ;; rebuild cycle.
396 #$@(if (target-x86-32?)
397 #~("CFLAGS=-g -O2 -fexcess-precision=standard")
398 #~())
399 #$@(if (target-mingw?)
400 #~(#$(string-append
401 "CFLAGS=-g -O2"
402 " -Wno-error=implicit-function-declaration"
403 " -Wno-error=incompatible-pointer-types"))
404 #~())
405 "--enable-mini-gmp"
406 '("--disable-static")))
407 ((#:phases phases)
408 #~(modify-phases #$phases
409 (add-before 'check 'disable-stack-overflow-test
410 (lambda _
411 ;; This test can invoke the "OOM killer", especially when
412 ;; running on emulated hardware (QEMU). Skip it.
413 (substitute* "test-suite/standalone/test-stack-overflow"
414 (("!#")
415 "!#\n(exit 77)\n"))))
416
417 #$@(if (target-hurd?)
418 #~((add-before 'build 'patch-posix-spawn-usage
419 (lambda _
420 ;; TODO: Move patch to 'source' on next rebuild
421 ;; cycle.
422 (define patch
423 #$(local-file
424 (search-patch "guile-hurd-posix-spawn.patch")))
425 (invoke "patch" "--force" "-p1" "-i" patch))))
426 #~())
427 #$@(if (system-hurd?)
428 #~((add-after 'unpack 'disable-popen.test-no-duplicate
429 ;; This test hangs on the Hurd.
430 (lambda _
431 (substitute* "test-suite/tests/popen.test"
432 (("\\(pass-if \"no duplicate\".*" all)
433 (string-append
434 all
435 (object->string
436 '(when (string-ci= "GNU"
437 (vector-ref (uname) 0))
438 (throw 'unresolved)))))))))
439 #~())
440 #$@(if (target-ppc32?)
441 #~((add-after 'unpack 'adjust-bootstrap-flags
442 (lambda _
443 ;; Upstream knows about suggested solution.
444 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45214
445 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977223#46
446 (substitute* "stage0/Makefile.in"
447 (("^GUILE_OPTIMIZATIONS.*")
448 "GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps\n")))))
449 #~())
450 #$@(if (target-powerpc?)
451 #~((add-after 'unpack 'skip-oom-test
452 (lambda _
453 ;; This test hangs with guile-3.0.9 and libgc-8.2.2 and
454 ;; fails completely on powerpc-linux.
455 (substitute* "test-suite/standalone/test-out-of-memory"
456 (("!#") "!#\n\n(exit 77)\n")))))
457 #~())
458 #$@(if (or (target-ppc32?)
459 (target-riscv64?))
460 #~((add-after 'unpack 'skip-failing-fdes-test
461 (lambda _
462 ;; ERROR: ((system-error "seek" "~A" ("Bad file descriptor") (9)))
463 (substitute* "test-suite/tests/ports.test"
464 (("fdes not closed\"" all) (string-append all "(exit 77)")))
465 #t)))
466 #~())))))
467
468 (native-search-paths
469 (list (search-path-specification
470 (variable "GUILE_LOAD_PATH")
471 (files '("share/guile/site/3.0")))
472 (search-path-specification
473 (variable "GUILE_LOAD_COMPILED_PATH")
474 (files '("lib/guile/3.0/site-ccache"
475 "share/guile/site/3.0")))
476 (search-path-specification
477 (variable "GUILE_EXTENSIONS_PATH")
478 (files '("lib/guile/3.0/extensions")))))))
479
480(define-public guile-3.0.11
481 (package
482 (inherit guile-3.0)
483 (name "guile")
484 (version "3.0.11")
485 (source
486 (origin
487 (inherit (package-source guile-2.2))
488 (uri (string-append "mirror://gnu/guile/guile-" version ".tar.xz"))
489 (sha256
490 (base32 "0q4laxcraxh3r9s62p6nw3g3n6xlqxy16r5kdylpyyk56v97k341"))
491 (patches (search-patches "guile-3.0.11-cross-compilation.patch"
492 "guile-3.0.11-fix-riscv64-jit.patch"))
493 ;; Replace the snippet because the oom-test still fails on some 32-bit
494 ;; architectures.
495 (snippet '(for-each delete-file
496 (find-files "prebuilt" "\\.go$")))))
497 (arguments
498 (substitute-keyword-arguments (package-arguments guile-3.0)
499 ((#:phases phases)
500 #~(modify-phases #$phases
501 #$@(if (target-hurd?)
502 #~((delete 'patch-posix-spawn-usage))
503 #~())
504 #$@(if (system-hurd?)
505 #~((replace 'disable-tests
506 (lambda _
507 (substitute* "test-suite/Makefile.in"
508 ;; AF_UNIX/SOCK_STREAM: bind abstract - arguments: bind ENOENT
509 (("tests/00-socket.test")
510 "")
511 ;; thread-sleep!: thread sleeps fractions of a second
512 (("tests/srfi-18.test")
513 "")
514 ;; flaky: server is listening - arguments: connect EINVAL
515 (("tests/web-server.test")
516 ""))
517 ;; failed to remove 't-guild-compile-7215.go.tdL7yC
518 (substitute* "test-suite/standalone/Makefile.in"
519 (("test-guild-compile ")
520 ""))))
521 (delete 'disable-threads.tests))
522 #~())))))))
523
524(define-public guile-3.0-latest
525 ;; At the moment 3.0.11 leads to test failures in the 'guix' package so we
526 ;; cannot switch just yet: see <https://codeberg.org/guix/guix/pulls/5360>.
527 guile-3.0.11)
528
529;;; The symbol guile-3.0/fixed should be used when guile-3.0 needs fixes
530;;; (security or else) and this deprecation could be removed.
531(define-deprecated/public-alias guile-3.0/fixed guile-3.0/pinned)
532
533(define-public guile-with-gmp
534 (package/inherit guile-3.0-latest
535 (name "guile-with-gmp")
536 (propagated-inputs
537 (modify-inputs propagated-inputs
538 (append gmp)))
539 (arguments
540 (substitute-keyword-arguments arguments
541 ((#:configure-flags flags #~'())
542 #~(delete "--enable-mini-gmp" #$flags))))))
543
544(define-public guile-3.0/pinned
545 ;; A package of Guile that's rarely changed. It is the one used in the
546 ;; `base' module, and thus changing it entails a full rebuild.
547 (package
548 (inherit guile-3.0)
549 (properties '((hidden? . #t) ;people should install 'guile-2.2'
550 (timeout . 72000) ;20 hours
551 (max-silent-time . 36000))))) ;10 hours (needed on ARM
552 ; when heavily loaded)
553
554(define-public guile-next
555 (let ((version "3.0.11")
556 (revision "1")
557 (commit "b0f6549889b90186a06a0769a47f43954b6fb889"))
558 (package
559 (inherit guile-3.0)
560 (name "guile-next")
561 (version (git-version version revision commit))
562 (source (origin
563 ;; The main goal here is to allow for '--with-branch'.
564 (method git-fetch)
565 (uri (git-reference
566 (url "https://codeberg.org/guile/guile.git")
567 (commit commit)))
568 (file-name (git-file-name name version))
569 (sha256
570 (base32
571 "1lqlapp7dr1y9ix8dy2amycjyqi4534m7xnb3bw23ikw7hfrakhq"))))
572 (arguments
573 (substitute-keyword-arguments (package-arguments guile-3.0)
574 ((#:phases phases '%standard-phases)
575 #~(modify-phases #$phases
576 (add-before 'bootstrap 'set-version
577 (lambda _
578 ;; Tell 'git-version-gen' what version this is, or it will
579 ;; just pick "UNKNOWN", making it unusable as a replacement
580 ;; for 'guile-3.0'. XXX: This is inaccurate when using
581 ;; '--with-branch' but using (package-version this-package)
582 ;; wouldn't give us a valid version string.
583 (call-with-output-file ".tarball-version"
584 (lambda (port)
585 (display #$version port)))))
586 #$@(if (target-hurd?)
587 #~((delete 'patch-posix-spawn-usage))
588 #~())))))
589 (native-inputs
590 (modify-inputs (package-native-inputs guile-3.0)
591 (prepend autoconf
592 automake
593 libtool
594 flex
595 gettext-minimal
596 texinfo
597 gperf)
598 (replace "guile" this-package)))
599 (synopsis "Development version of GNU Guile"))))
600
601(define* (make-guile-readline guile #:optional (name "guile-readline"))
602 (package
603 (name name)
604 (version (package-version guile))
605 (source (package-source guile))
606 (build-system gnu-build-system)
607 (arguments
608 (list #:configure-flags
609 #~'("--disable-silent-rules"
610 "--enable-mini-gmp") ;for Guile >= 3.0.6
611
612 #:phases
613 #~(modify-phases %standard-phases
614 (add-before 'build 'chdir
615 (lambda* (#:key outputs #:allow-other-keys)
616 (invoke "make" "-C" "libguile" "scmconfig.h")
617 (invoke "make" "-C" "lib")
618 (chdir "guile-readline")
619
620 (substitute* "Makefile"
621 (("../libguile/libguile-[[:graph:]]+\\.la")
622 ;; Remove dependency on libguile-X.Y.la.
623 "")
624 (("^READLINE_LIBS = (.*)$" _ libs)
625 ;; Link against the provided libguile.
626 (string-append "READLINE_LIBS = "
627 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
628 libs "\n"))
629 (("\\$\\(top_builddir\\)/meta/build-env")
630 ;; Use the provided Guile, not the one from
631 ;; $(builddir).
632 "")
633
634 ;; Install modules to the 'site' directories.
635 (("^moddir = .*$")
636 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
637 (("^ccachedir = .*$")
638 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
639
640 ;; Load 'guile-readline.so' from the right place.
641 (substitute* "ice-9/readline.scm"
642 (("load-extension \"guile-readline\"")
643 (format #f "load-extension \
644 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
645 (assoc-ref outputs "out"))))
646 #t)))))
647 (home-page (package-home-page guile))
648 (native-inputs (package-native-inputs guile))
649 (propagated-inputs (package-propagated-inputs guile))
650 (inputs (modify-inputs (package-inputs guile)
651 (prepend guile readline)))
652 (synopsis "Line editing support for GNU Guile")
653 (description
654 "This module provides line editing support via the Readline library for
655GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
656@code{activate-readline} procedure to enable it.")
657 (license license:gpl3+)))
658
659(define-public guile-readline
660 (make-guile-readline guile-3.0))
661
662(define-public guile2.2-readline
663 (make-guile-readline guile-2.2 "guile2.2-readline"))
664
665(define (guile-variant-package-name prefix)
666 (lambda (name)
667 "Return NAME with PREFIX instead of \"guile-\", when applicable."
668 (if (and (string-prefix? "guile-" name)
669
670 ;; Don't rename [email protected].
671 (not (string=? "guile-bootstrap" name)))
672 (string-append prefix "-"
673 (string-drop name
674 (string-length "guile-")))
675 name)))
676
677(define package-for-guile-2.0
678 ;; A procedure that rewrites the dependency tree of the given package to use
679 ;; GUILE-2.0 instead of GUILE-3.0.
680 (package-input-rewriting `((,guile-3.0 . ,guile-2.0))
681 (guile-variant-package-name "guile2.0")
682 #:deep? #f))
683
684(define package-for-guile-2.2
685 (package-input-rewriting `((,guile-3.0 . ,guile-2.2))
686 (guile-variant-package-name "guile2.2")
687 #:deep? #f))
688
689(define-public guile-for-guile-emacs
690 (let ((commit "e62c0d1b32f625fcbaa733c32a88622846aee905")
691 (revision "2"))
692 (package/inherit guile-next
693 (name "guile-for-guile-emacs")
694 (version (git-version "3.0.7-81" revision commit))
695 (source (origin
696 (method git-fetch)
697 (uri (git-reference
698 (url "https://codeberg.org/lyrra/guile")
699 (commit commit)))
700 (file-name (git-file-name name version))
701 (sha256
702 (base32
703 "0xfnd99iws9dwk5va8bmqpysmb8pnb1w91rw7rbfzzklyfvpibh6"))))
704 (arguments
705 (substitute-keyword-arguments arguments
706 ((#:configure-flags flags #~'())
707 #~(cons*
708 #$(string-append
709 "CFLAGS=-g -O2"
710 " -Wno-error=implicit-function-declaration")
711 #$flags))
712 ((#:phases phases '%standard-phases)
713 #~(modify-phases #$phases
714 (add-before 'check 'skip-failing-tests
715 (lambda _
716 (delete-file "test-suite/tests/version.test"))))))))))
717
718
719;;;
720;;; Extensions.
721;;;
722
723(define-public guile-json-1
724 (package
725 (name "guile-json")
726 (version "1.3.2")
727 (home-page "https://github.com/aconchillo/guile-json")
728 (source (origin
729 (method url-fetch)
730 (uri (string-append "mirror://savannah/guile-json/guile-json-"
731 version ".tar.gz"))
732 (sha256
733 (base32
734 "0m6yzb169r6iz56k3nkncjaiijwi4p0x9ijn1p5ax3s77jklxy9k"))))
735 (build-system gnu-build-system)
736 (arguments
737 `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
738 (native-inputs (list pkg-config guile-2.2))
739 (inputs (list guile-2.2))
740 (synopsis "JSON module for Guile")
741 (description
742 "Guile-JSON supports parsing and building JSON documents according to the
743specification. These are the main features:
744
745@itemize
746@item Strictly complies to @uref{http://json.org, specification}.
747@item Build JSON documents programmatically via macros.
748@item Unicode support for strings.
749@item Allows JSON pretty printing.
750@end itemize\n")
751
752 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
753 (license license:gpl3+)))
754
755(define-public guile2.0-json
756 (package-for-guile-2.0 guile-json-1))
757
758(define-public guile-json-3
759 ;; This version is incompatible with 1.x; see the 'NEWS' file.
760 (package
761 (inherit guile-json-1)
762 (name "guile-json")
763 (version "3.5.0")
764 (source (origin
765 (method url-fetch)
766 (uri (string-append "mirror://savannah/guile-json/guile-json-"
767 version ".tar.gz"))
768 (sha256
769 (base32
770 "0nj0684qgh6ppkbdyxqfyjwsv2qbyairxpi8fzrhsi3xnc7jn4im"))))
771 (native-inputs (list pkg-config guile-3.0))
772 (inputs (list guile-3.0))))
773
774(define-public guile-json-4
775 (package
776 (inherit guile-json-3)
777 (name "guile-json")
778 (version "4.7.3")
779 (source (origin
780 (method url-fetch)
781 (uri (string-append "mirror://savannah/guile-json/guile-json-"
782 version ".tar.gz"))
783 (sha256
784 (base32
785 "127k2xc07w1gnyqs40z4865l8p3ra5xgpcn569dz04lxsa709fiq"))))))
786
787(define-public guile2.2-json
788 (package-for-guile-2.2 guile-json-4))
789
790;; There are two guile-gdbm packages, one using the FFI and one with
791;; direct C bindings, hence the verbose name.
792
793(define-public guile-gdbm-ffi
794 (package
795 (name "guile-gdbm-ffi")
796 (version "20120209.fa1d5b6")
797 (source (origin
798 (method git-fetch)
799 (uri (git-reference
800 (url "https://github.com/ijp/guile-gdbm")
801 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
802 (file-name (string-append name "-" version "-checkout"))
803 (patches (search-patches
804 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
805 (sha256
806 (base32
807 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
808 (build-system guile-build-system)
809 (arguments
810 '(#:phases (modify-phases %standard-phases
811 (add-after 'unpack 'move-examples
812 (lambda* (#:key outputs #:allow-other-keys)
813 ;; Move examples where they belong.
814 (let* ((out (assoc-ref outputs "out"))
815 (doc (string-append out "/share/doc/"
816 (strip-store-file-name out)
817 "/examples")))
818 (copy-recursively "examples" doc)
819 (delete-file-recursively "examples")
820 #t)))
821 (add-after 'unpack 'set-libgdbm-file-name
822 (lambda* (#:key inputs #:allow-other-keys)
823 (substitute* "gdbm.scm"
824 (("\\(dynamic-link \"libgdbm\"\\)")
825 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
826 (assoc-ref inputs "gdbm"))))
827 #t)))))
828 (native-inputs (list guile-3.0))
829 (inputs (list gdbm))
830 (home-page "https://github.com/ijp/guile-gdbm")
831 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
832 (description
833 "Guile bindings to the GDBM key-value storage system, using
834Guile's foreign function interface.")
835 (license license:gpl3+)))
836
837(define-public guile2.0-gdbm-ffi
838 (package-for-guile-2.0 guile-gdbm-ffi))
839
840(define-public guile2.2-gdbm-ffi
841 (package-for-guile-2.2 guile-gdbm-ffi))
842
843(define-public guile-sqlite3
844 (package
845 (name "guile-sqlite3")
846 (version "0.1.3")
847 (home-page "https://codeberg.org/guile-sqlite3/guile-sqlite3.git")
848 (source (origin
849 (method git-fetch)
850 (uri (git-reference
851 (url home-page)
852 (commit (string-append "v" version))))
853 (sha256
854 (base32
855 "0qqygvlpz63phdi2p5p8ncp80dci230qfa3pwds8yfxqqaablmhb"))
856 (file-name (string-append name "-" version "-checkout"))))
857 (build-system gnu-build-system)
858 (native-inputs (list autoconf automake guile-3.0 pkg-config))
859 (inputs (list guile-3.0 sqlite-next))
860 (synopsis "Access SQLite databases from Guile")
861 (description
862 "This package provides Guile bindings to the SQLite database system.")
863 (license license:gpl3+)))
864
865(define-public guile2.0-sqlite3
866 (package-for-guile-2.0 guile-sqlite3))
867
868(define-public guile2.2-sqlite3
869 (package-for-guile-2.2 guile-sqlite3))
870
871(define-public guile-bytestructures
872 (package
873 (name "guile-bytestructures")
874 (version "2.0.2")
875 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
876 (source (origin
877 (method git-fetch)
878 (uri (git-reference
879 (url home-page)
880 (commit (string-append "v" version))))
881 (file-name (git-file-name name version))
882 (sha256
883 (base32
884 "1dyhf39s16q3fvps0mfb65xrlcb8rk8m5kc82ngkwhzmf1svalpc"))))
885 (build-system gnu-build-system)
886 (arguments
887 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
888
889 #:phases (modify-phases %standard-phases
890 (add-after 'install 'install-doc
891 (lambda* (#:key outputs #:allow-other-keys)
892 (let* ((out (assoc-ref outputs "out"))
893 (package ,(package-full-name this-package "-"))
894 (doc (string-append out "/share/doc/" package)))
895 (install-file "README.md" doc)
896 #t))))))
897 (native-inputs (list autoconf automake pkg-config guile-3.0))
898 (inputs (list guile-3.0))
899 (synopsis "Structured access to bytevector contents for Guile")
900 (description
901 "Guile bytestructures offers a system imitating the type system
902of the C programming language, to be used on bytevectors. C's type
903system works on raw memory, and Guile works on bytevectors which are
904an abstraction over raw memory. It's also more powerful than the C
905type system, elevating types to first-class status.")
906 (license license:gpl3+)
907 (properties '((upstream-name . "bytestructures")))))
908
909(define-public guile2.0-bytestructures
910 (package-for-guile-2.0 guile-bytestructures))
911
912(define-public guile2.2-bytestructures
913 (package-for-guile-2.2 guile-bytestructures))
914
915(define-public guile-git
916 (package
917 (name "guile-git")
918 (version "0.12.1")
919 (home-page "https://codeberg.org/guile-git/guile-git.git")
920 (source (origin
921 (method git-fetch)
922 (uri (git-reference
923 (url home-page)
924 (commit (string-append "v" version))))
925 (file-name (git-file-name name version))
926 (sha256
927 (base32
928 "102py0bcr5jiayqy1l8dr1f11sv7c600y779jn68c4dsxlfg9has"))))
929 (build-system gnu-build-system)
930 (arguments
931 (if (target-ppc32?)
932 (list #:phases
933 #~(modify-phases %standard-phases
934 (add-after 'unpack 'skip-failing-test
935 (lambda _
936 ;; https://codeberg.org/guile-git/guile-git/issues/20
937 (substitute* "Makefile.am"
938 ((".*tests/blob\\.scm.*") ""))))))
939 '()))
940 (native-inputs
941 (list pkg-config autoconf automake texinfo guile-3.0 guile-bytestructures))
942 (inputs
943 (list guile-3.0 libgit2))
944 (propagated-inputs
945 (list guile-bytestructures))
946 (synopsis "Guile bindings for libgit2")
947 (description
948 "This package provides Guile bindings to libgit2, a library to
949manipulate repositories of the Git version control system.")
950 (license license:gpl3+)))
951
952(define-public guile2.2-git
953 (package-for-guile-2.2 guile-git))
954
955(define-public guile-zlib
956 (package
957 (name "guile-zlib")
958 (version "0.2.2")
959 (home-page "https://codeberg.org/guile-compression/guile-zlib")
960 (source
961 (origin
962 ;; XXX: Do not use "git-fetch" method here that would create and
963 ;; endless inclusion loop, because this package is used as an extension
964 ;; in the same method.
965 (method url-fetch)
966 (uri (string-append home-page "/releases/download/v" version
967 "/guile-zlib-" version ".tar.gz"))
968 (sha256
969 ;; content nar-sha256: 0rwjlqr1hl2vczs16xsihw8pyj6s70p1yv9ky0sawhm6g30639k9
970 (base32
971 "011flqxhlika0hrv1qzs940kgl0zpckxm9732j7wbb45dya2g2hz"))))
972 (build-system gnu-build-system)
973 (native-inputs (list autoconf automake pkg-config guile-3.0))
974 (inputs (list guile-3.0 zlib))
975 (synopsis "Guile bindings to zlib")
976 (description
977 "This package provides Guile bindings for zlib, a lossless
978data-compression library. The bindings are written in pure Scheme by using
979Guile's foreign function interface.")
980 (license license:gpl3+)))
981
982(define-public guile2.2-zlib
983 (package-for-guile-2.2 guile-zlib))
984
985(define-public guile-lzlib
986 (package
987 (name "guile-lzlib")
988 (version "0.4.1")
989 (home-page "https://codeberg.org/guile-compression/guile-lzlib")
990 (source
991 (origin
992 ;; Note: Until "builtin:git-download" can be taken for granted, this
993 ;; must be 'url-fetch', not 'git-fetch', to avoid a circular dependency
994 ;; with the 'git-fetch' derivation on systems that lack
995 ;; "builtin:git-download".
996 (method url-fetch)
997 (uri (string-append home-page "/releases/download/" version
998 "/guile-lzlib-" version ".tar.gz"))
999 ;; content nar-sha256: 1iz6kg9sd5c2ab47rj2jqgalppjwjpkl5jn4sy4s6681vj83fzma
1000 (sha256
1001 (base32
1002 "0hj6566pn3cgarvd66748bjkxi9y50h32924bl7r2k5n9ykr1swv"))))
1003 (build-system gnu-build-system)
1004 (arguments
1005 (list
1006 #:make-flags #~'("GUILE_AUTO_COMPILE=0"))) ;prevent guild warnings
1007 (native-inputs (list autoconf automake pkg-config guile-3.0))
1008 (inputs (list guile-3.0 lzlib))
1009 (synopsis "Guile bindings to lzlib")
1010 (description
1011 "This package provides Guile bindings for lzlib, a C library for
1012in-memory LZMA compression and decompression. The bindings are written in
1013pure Scheme by using Guile's foreign function interface.")
1014 (license license:gpl3+)))
1015
1016(define-public guile2.2-lzlib
1017 (package-for-guile-2.2 guile-lzlib))
1018
1019(define-public guile-zstd
1020 (package
1021 (name "guile-zstd")
1022 (version "0.1.2")
1023 (home-page "https://codeberg.org/guile-compression/guile-zstd")
1024 (source (origin
1025 (method git-fetch)
1026 (uri (git-reference (url home-page)
1027 (commit (string-append "v" version))))
1028 (file-name (git-file-name name version))
1029 (sha256
1030 (base32
1031 "1rlbjqq0jb3xkrsa0pnk6irgcpyksvf5n3gk89w7arf5yjycm05h"))))
1032 (build-system gnu-build-system)
1033 (native-inputs (list autoconf automake pkg-config guile-3.0))
1034 (inputs (list `(,zstd "lib") guile-3.0))
1035 (synopsis "GNU Guile bindings to the zstd compression library")
1036 (description
1037 "This package provides a GNU Guile interface to the zstd (``zstandard'')
1038compression library.")
1039 (license license:gpl3+)))
1040
1041(define-public guile-lzma
1042 (package
1043 (name "guile-lzma")
1044 (version "0.1.1")
1045 (source
1046 (origin
1047 (method url-fetch)
1048 (uri (string-append "https://files.ngyro.com/guile-lzma/guile-lzma-"
1049 version ".tar.gz"))
1050 (sha256
1051 (base32 "0pnfzk92p9y5ymjq6rq619b9fy0dflv56jwg00wlvvbjssb6i1ib"))))
1052 (build-system gnu-build-system)
1053 (native-inputs
1054 (list autoconf automake guile-3.0 guile-bytestructures pkg-config))
1055 (inputs (list guile-3.0 xz))
1056 (propagated-inputs (list guile-bytestructures))
1057 (home-page "https://ngyro.com/software/guile-lzma.html")
1058 (synopsis "Guile bindings for liblzma (XZ)")
1059 (description "Guile-LZMA is a Guile wrapper for the liblzma (XZ)
1060library. It exposes an interface similar to other Guile compression
1061libraries, like Guile-zlib.")
1062 (license license:gpl3+)))
1063
1064(define-public guile-bzip2
1065 (package
1066 (name "guile-bzip2")
1067 (version "0.1.0")
1068 (source
1069 (origin
1070 (method url-fetch)
1071 (uri (string-append "https://files.ngyro.com/guile-bzip2/guile-bzip2-"
1072 version ".tar.gz"))
1073 (sha256
1074 (base32 "1qnxk5fzg8m9ik1ckhjvi22kkhd810mrg8jzxiizhk920b69wbdh"))))
1075 (build-system gnu-build-system)
1076 (native-inputs (list guile-3.0 guile-bytestructures pkg-config))
1077 (inputs (list guile-3.0 bzip2))
1078 (propagated-inputs (list guile-bytestructures))
1079 (home-page "https://ngyro.com/software/guile-bzip2.html")
1080 (synopsis "Guile bindings for libbzip2")
1081 (description "Guile-bzip2 is a Guile wrapper for the libbzip2
1082library. It exposes an interface similar to other Guile compression
1083libraries, like Guile-zlib.")
1084 (license license:gpl3+)))
1085
1086;;; guile.scm ends here