1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
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>
6 ;;; Copyright © 2015, 2017 Christopher Allan Webber <cwebber@dustycloud.org>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
9 ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
10 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
11 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
12 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
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>
16 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
17 ;;; Copyright © 2019 Taylan Kammer <taylan.kammer@gmail.com>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
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.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages guile)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bash)
40 #:use-module (gnu packages bdw-gc)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages dbm)
43 #:use-module (gnu packages flex)
44 #:use-module (gnu packages gawk)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages hurd)
47 #:use-module (gnu packages libffi)
48 #:use-module (gnu packages libunistring)
49 #:use-module (gnu packages linux)
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)
54 #:use-module (gnu packages sqlite)
55 #:use-module (gnu packages texinfo)
56 #:use-module (gnu packages version-control)
57 #:use-module (guix packages)
58 #:use-module (guix download)
59 #:use-module (guix git-download)
60 #:use-module (guix build-system gnu)
61 #:use-module (guix build-system guile)
62 #:use-module (guix deprecation)
63 #:use-module (guix utils)
64 #:use-module (ice-9 match)
65 #:use-module ((srfi srfi-1) #:prefix srfi-1:))
69 ;;; GNU Guile, and modules and extensions.
73 (define-public guile-1.8
79 (uri (string-append "mirror://gnu/guile/guile-" version
83 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
84 (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
85 (build-system gnu-build-system)
86 (arguments '(#:configure-flags '("--disable-error-on-warning")
88 ;; Insert a phase before `configure' to patch things up.
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)
99 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
101 (assoc-ref outputs "out"))))
103 ;; The usual /bin/sh...
104 (substitute* "ice-9/popen.scm"
105 (("/bin/sh") (which "sh")))
108 ;; When cross-compiling, a native version of Guile itself is needed.
109 (native-inputs (if (%current-target-system)
110 `(("self" ,this-package))
113 (inputs `(("gawk" ,gawk)
114 ("readline" ,readline)))
116 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
118 (propagated-inputs `(("gmp" ,gmp)
119 ("libltdl" ,libltdl)))
122 (list (search-path-specification
123 (variable "GUILE_LOAD_PATH")
124 (files '("share/guile/site")))))
126 (synopsis "Scheme implementation intended especially for extensions")
128 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
129 official extension language of the GNU system. It is an implementation of
130 the Scheme language which can be easily embedded in other applications to
131 provide a convenient means of extending the functionality of the application
132 without requiring the source code to be rewritten.")
133 (home-page "https://www.gnu.org/software/guile/")
134 (license license:lgpl2.0+)))
136 (define-public guile-2.0
142 (uri (string-append "mirror://gnu/guile/guile-" version
146 "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
147 (build-system gnu-build-system)
149 ;; When cross-compiling, a native version of Guile itself is needed.
150 (native-inputs `(,@(if (%current-target-system)
151 `(("self" ,this-package))
153 ("pkgconfig" ,pkg-config)))
154 (inputs `(("libffi" ,libffi)
155 ,@(libiconv-if-needed)
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)))))
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)
168 ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
169 ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
172 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
173 ;; must be propagated.
177 (outputs '("out" "debug"))
180 `(#:configure-flags '("--disable-static") ; saves 3 MiB
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.
192 ,@(if (target-mingw?)
194 (string-append bash "/bin/bash")
196 '((string-append bash "/bin/bash")))))
200 (list (search-path-specification
201 (variable "GUILE_LOAD_PATH")
202 (files '("share/guile/site/2.0")))
203 (search-path-specification
204 (variable "GUILE_LOAD_COMPILED_PATH")
205 (files '("lib/guile/2.0/site-ccache")))))
207 (synopsis "Scheme implementation intended especially for extensions")
209 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
210 official extension language of the GNU system. It is an implementation of
211 the Scheme language which can be easily embedded in other applications to
212 provide a convenient means of extending the functionality of the application
213 without requiring the source code to be rewritten.")
214 (home-page "https://www.gnu.org/software/guile/")
215 (license license:lgpl3+)))
217 (define-public guile-2.2
218 (package (inherit guile-2.0)
224 ;; Note: we are limited to one of the compression formats
225 ;; supported by the bootstrap binaries, so no lzip here.
226 (uri (string-append "mirror://gnu/guile/guile-" version
230 "1269ymxm56j1z1lvq1y42rm961f2n7rinm3k6l00p9k52hrpcddk"))
231 (modules '((guix build utils)))
232 (patches (search-patches
233 "guile-2.2-skip-oom-test.patch"))
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).
239 (for-each delete-file
240 (find-files "prebuilt" "\\.go$"))
242 (properties '((timeout . 72000) ;20 hours
243 (max-silent-time . 36000))) ;10 hours (needed on ARM
244 ; when heavily loaded)
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")
251 (files '("lib/guile/2.2/site-ccache")))))))
253 (define-public guile-2.2.7
254 ;; This version contains a bug fix for a relatively rare crash that could
255 ;; affect shepherd as PID 1: <https://bugs.gnu.org/37757>.
260 (inherit (package-source guile-2.2))
261 (uri (string-append "mirror://gnu/guile/guile-" version
265 "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))))))
267 (define-deprecated guile-2.2/bug-fix guile-2.2.7)
269 (define-public guile-2.2/fixed
270 ;; A package of Guile 2.2 that's rarely changed. It is the one used
271 ;; in the `base' module, and thus changing it entails a full rebuild.
274 (properties '((hidden? . #t) ;people should install 'guile-2.2'
275 (timeout . 72000) ;20 hours
276 (max-silent-time . 36000))))) ;10 hours (needed on ARM
277 ; when heavily loaded)
278 (define-public guile-2.2.4
283 (inherit (package-source guile-2.2))
284 (uri (string-append "mirror://gnu/guile/guile-" version
288 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
290 (define-public guile-3.0
291 ;; This is the latest Guile stable version.
294 (name "guile-next") ;to be renamed to "guile"
297 (inherit (package-source guile-2.2))
298 (uri (string-append "mirror://gnu/guile/guile-"
302 "0x8ca6q1qdmk29lh12gj6ngvgn7kp79w42rxfgwrpxm9jmjqs4y9"))))
304 (substitute-keyword-arguments (package-arguments guile-2.2)
305 ;; XXX: On ARMv7, work around <https://bugs.gnu.org/39208> by disabling
307 ((#:configure-flags flags '())
309 `(cons "--disable-jit" ,flags)
312 (list (search-path-specification
313 (variable "GUILE_LOAD_PATH")
314 (files '("share/guile/site/3.0")))
315 (search-path-specification
316 (variable "GUILE_LOAD_COMPILED_PATH")
317 (files '("lib/guile/3.0/site-ccache"
318 "share/guile/site/3.0")))))))
320 (define-public guile-next guile-3.0)
322 (define* (make-guile-readline guile #:optional (name "guile-readline"))
325 (version (package-version guile))
326 (source (package-source guile))
327 (build-system gnu-build-system)
329 '(#:configure-flags '("--disable-silent-rules")
330 #:phases (modify-phases %standard-phases
331 (add-before 'build 'chdir
332 (lambda* (#:key outputs #:allow-other-keys)
333 (invoke "make" "-C" "libguile" "scmconfig.h")
334 (invoke "make" "-C" "lib")
335 (chdir "guile-readline")
337 (substitute* "Makefile"
338 (("../libguile/libguile-[[:graph:]]+\\.la")
339 ;; Remove dependency on libguile-X.Y.la.
341 (("^READLINE_LIBS = (.*)$" _ libs)
342 ;; Link against the provided libguile.
343 (string-append "READLINE_LIBS = "
344 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
346 (("\\$\\(top_builddir\\)/meta/build-env")
347 ;; Use the provided Guile, not the one from
351 ;; Install modules to the 'site' directories.
353 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
354 (("^ccachedir = .*$")
355 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
357 ;; Load 'guile-readline.so' from the right place.
358 (substitute* "ice-9/readline.scm"
359 (("load-extension \"guile-readline\"")
360 (format #f "load-extension \
361 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
362 (assoc-ref outputs "out"))))
364 (home-page (package-home-page guile))
365 (native-inputs (package-native-inputs guile))
367 `(,@(package-inputs guile) ;to placate 'configure'
368 ,@(package-propagated-inputs guile)
370 ("readline" ,readline)))
371 (synopsis "Line editing support for GNU Guile")
373 "This module provides line editing support via the Readline library for
374 GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
375 @code{activate-readline} procedure to enable it.")
376 (license license:gpl3+)))
378 (define-public guile-readline
379 (make-guile-readline guile-2.2))
381 (define-public guile3.0-readline
382 (make-guile-readline guile-next "guile3.0-readline"))
384 (define (guile-variant-package-name prefix)
386 "Return NAME with PREFIX instead of \"guile-\", when applicable."
387 (if (string-prefix? "guile-" name)
388 (string-append prefix "-"
390 (string-length "guile-")))
393 (define package-for-guile-2.0
394 ;; A procedure that rewrites the dependency tree of the given package to use
395 ;; GUILE-2.0 instead of GUILE-2.2.
396 (package-input-rewriting `((,guile-2.2 . ,guile-2.0))
397 (guile-variant-package-name "guile2.0")))
399 (define package-for-guile-3.0
400 (package-input-rewriting `((,guile-2.2 . ,guile-next))
401 (guile-variant-package-name "guile3.0")))
403 (define-public guile-for-guile-emacs
404 (package (inherit guile-2.2)
405 (name "guile-for-guile-emacs")
406 (version "20150510.d8d9a8d")
410 (url "git://git.hcoop.net/git/bpt/guile.git")
411 (commit "d8d9a8da05ec876acba81a559798eb5eeceb5a17")))
412 (file-name (string-append name "-" version "-checkout"))
415 "00sprsshy16y8pxjy126hr2adqcvvzzz96hjyjwgg8swva1qh6b0"))))
417 `(;; Tests aren't passing for now.
418 ;; Obviously we should re-enable this!
420 ,@(package-arguments guile-2.2)))
422 `(("autoconf" ,autoconf)
423 ("automake" ,automake)
427 ("gettext" ,gettext-minimal)
428 ,@(package-native-inputs guile-2.2)))
429 ;; Same as in guile-2.0
431 (list (search-path-specification
432 (variable "GUILE_LOAD_PATH")
433 (files '("share/guile/site/2.0")))
434 (search-path-specification
435 (variable "GUILE_LOAD_COMPILED_PATH")
436 (files '("lib/guile/2.0/site-ccache"
437 "share/guile/site/2.0")))))))
444 (define-public guile-json-1
448 (home-page "https://github.com/aconchillo/guile-json")
451 (uri (string-append "mirror://savannah/guile-json/guile-json-"
455 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
456 (build-system gnu-build-system)
457 (native-inputs `(("pkg-config" ,pkg-config)
458 ("guile" ,guile-2.2)))
459 (inputs `(("guile" ,guile-2.2)))
460 (synopsis "JSON module for Guile")
462 "Guile-JSON supports parsing and building JSON documents according to the
463 specification. These are the main features:
466 @item Strictly complies to @uref{http://json.org, specification}.
467 @item Build JSON documents programmatically via macros.
468 @item Unicode support for strings.
469 @item Allows JSON pretty printing.
472 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
473 (license license:gpl3+)))
475 ;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
476 ;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
478 (define-deprecated guile-json guile-json-1)
481 (define-public guile2.0-json
482 (package-for-guile-2.0 guile-json-1))
484 (define-public guile-json-3
485 ;; This version is incompatible with 1.x; see the 'NEWS' file.
487 (inherit guile-json-1)
492 (uri (string-append "mirror://savannah/guile-json/guile-json-"
496 "14m6b6g2maw0mkvfm4x63rqb54vgbpn1gcqs715ijw4bikfzlqfz"))))))
498 (define-public guile3.0-json
499 (package-for-guile-3.0 guile-json-3))
501 ;; There are two guile-gdbm packages, one using the FFI and one with
502 ;; direct C bindings, hence the verbose name.
504 (define-public guile-gdbm-ffi
506 (name "guile-gdbm-ffi")
507 (version "20120209.fa1d5b6")
511 (url "https://github.com/ijp/guile-gdbm.git")
512 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
513 (file-name (string-append name "-" version "-checkout"))
514 (patches (search-patches
515 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
518 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
519 (build-system guile-build-system)
521 '(#:phases (modify-phases %standard-phases
522 (add-after 'unpack 'move-examples
523 (lambda* (#:key outputs #:allow-other-keys)
524 ;; Move examples where they belong.
525 (let* ((out (assoc-ref outputs "out"))
526 (doc (string-append out "/share/doc/"
527 (strip-store-file-name out)
529 (copy-recursively "examples" doc)
530 (delete-file-recursively "examples")
532 (add-after 'unpack 'set-libgdbm-file-name
533 (lambda* (#:key inputs #:allow-other-keys)
534 (substitute* "gdbm.scm"
535 (("\\(dynamic-link \"libgdbm\"\\)")
536 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
537 (assoc-ref inputs "gdbm"))))
540 `(("guile" ,guile-2.2)))
543 (home-page "https://github.com/ijp/guile-gdbm")
544 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
546 "Guile bindings to the GDBM key-value storage system, using
547 Guile's foreign function interface.")
548 (license license:gpl3+)))
550 (define-public guile2.0-gdbm-ffi
551 (package-for-guile-2.0 guile-gdbm-ffi))
553 (define-public guile3.0-gdbm-ffi
554 (package-for-guile-3.0 guile-gdbm-ffi))
556 (define-public guile-sqlite3
558 (name "guile-sqlite3")
560 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
565 (commit (string-append "v" version))))
568 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
569 (file-name (string-append name "-" version "-checkout"))
570 (modules '((guix build utils)))
573 ;; Allow builds with Guile 3.0.
574 (substitute* "configure.ac"
576 "GUILE_PKG([3.0 2.2 2.0])\n"))
578 (build-system gnu-build-system)
580 `(("autoconf" ,autoconf)
581 ("automake" ,automake)
582 ("pkg-config" ,pkg-config)))
584 `(("guile" ,guile-2.2)
586 (synopsis "Access SQLite databases from Guile")
588 "This package provides Guile bindings to the SQLite database system.")
589 (license license:gpl3+)))
591 (define-public guile2.0-sqlite3
592 (package-for-guile-2.0 guile-sqlite3))
594 (define-public guile3.0-sqlite3
595 (package-for-guile-3.0 guile-sqlite3))
597 (define-public guile-bytestructures
599 (name "guile-bytestructures")
601 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
606 (commit (string-append "v" version))))
607 (file-name (git-file-name name version))
610 "0q0habjiy3h9cigb7q1br9kz6z212dn2ab31f6dgd3rrmsfn5rvb"))))
611 (build-system gnu-build-system)
613 `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
615 #:phases (modify-phases %standard-phases
616 (add-after 'install 'install-doc
617 (lambda* (#:key outputs #:allow-other-keys)
618 (let* ((out (assoc-ref outputs "out"))
619 (package ,(package-full-name this-package "-"))
620 (doc (string-append out "/share/doc/" package)))
621 (install-file "README.md" doc)
624 `(("autoconf" ,autoconf)
625 ("automake" ,automake)
626 ("pkg-config" ,pkg-config)
627 ("guile" ,guile-2.2)))
629 `(("guile" ,guile-2.2)))
630 (synopsis "Structured access to bytevector contents for Guile")
632 "Guile bytestructures offers a system imitating the type system
633 of the C programming language, to be used on bytevectors. C's type
634 system works on raw memory, and Guile works on bytevectors which are
635 an abstraction over raw memory. It's also more powerful than the C
636 type system, elevating types to first-class status.")
637 (license license:gpl3+)
638 (properties '((upstream-name . "bytestructures")))))
640 (define-public guile2.0-bytestructures
641 (package-for-guile-2.0 guile-bytestructures))
643 (define-public guile3.0-bytestructures
644 (package-for-guile-3.0 guile-bytestructures))
646 (define-public guile-git
650 (home-page "https://gitlab.com/guile-git/guile-git.git")
653 (uri (string-append "https://gitlab.com/guile-git/guile-git/uploads/"
654 "4c563d8e7e1ff84396abe8ca7011bcaf/guile-git-"
658 "0c5i3d16hp7gp9rd78vk9zc45js8bphf92m4lbb5gyi4l1yl7kkm"))))
659 (build-system gnu-build-system)
661 `(("pkg-config" ,pkg-config)
663 ("guile-bytestructures" ,guile-bytestructures)))
665 `(("guile" ,guile-2.2)
666 ("libgit2" ,libgit2)))
668 `(("guile-bytestructures" ,guile-bytestructures)))
669 (synopsis "Guile bindings for libgit2")
671 "This package provides Guile bindings to libgit2, a library to
672 manipulate repositories of the Git version control system.")
673 (license license:gpl3+)))
675 (define-public guile3.0-git
676 (package-for-guile-3.0 guile-git))
678 (define-public guile2.0-git
679 (let ((base (package-for-guile-2.0 guile-git)))
682 ;; Libgit2's Guile test driver requires (ice-9 textual-ports), which is
683 ;; not in Guile 2.0. Thus, keep LIBGIT2 as-is here (i.e., built against
685 (inputs `(("libgit2" ,libgit2)
686 ,@(srfi-1:alist-delete "libgit2"
687 (package-inputs base)))))))
689 ;;; guile.scm ends here