1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 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 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 utils)
63 #:use-module (ice-9 match)
64 #:use-module ((srfi srfi-1) #:prefix srfi-1:))
68 ;;; GNU Guile, and modules and extensions.
72 (define-public guile-1.8
78 (uri (string-append "mirror://gnu/guile/guile-" version
82 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
83 (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
84 (build-system gnu-build-system)
85 (arguments '(#:configure-flags '("--disable-error-on-warning")
87 ;; Insert a phase before `configure' to patch things up.
89 (modify-phases %standard-phases
90 (add-before 'configure 'patch-stuff
91 (lambda* (#:key outputs #:allow-other-keys)
92 ;; Add a call to `lt_dladdsearchdir' so that
93 ;; `libguile-readline.so' & co. are in the
94 ;; loader's search path.
95 (substitute* "libguile/dynl.c"
96 (("lt_dlinit.*$" match)
98 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
100 (assoc-ref outputs "out"))))
102 ;; The usual /bin/sh...
103 (substitute* "ice-9/popen.scm"
104 (("/bin/sh") (which "sh")))
106 (inputs `(("gawk" ,gawk)
107 ("readline" ,readline)))
109 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
111 (propagated-inputs `(("gmp" ,gmp)
112 ("libltdl" ,libltdl)))
114 ;; When cross-compiling, a native version of Guile itself is needed.
115 (self-native-input? #t)
118 (list (search-path-specification
119 (variable "GUILE_LOAD_PATH")
120 (files '("share/guile/site")))))
122 (synopsis "Scheme implementation intended especially for extensions")
124 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
125 official extension language of the GNU system. It is an implementation of
126 the Scheme language which can be easily embedded in other applications to
127 provide a convenient means of extending the functionality of the application
128 without requiring the source code to be rewritten.")
129 (home-page "https://www.gnu.org/software/guile/")
130 (license license:lgpl2.0+)))
132 (define-public guile-2.0
138 (uri (string-append "mirror://gnu/guile/guile-" version
142 "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
143 (build-system gnu-build-system)
144 (native-inputs `(("pkgconfig" ,pkg-config)))
145 (inputs `(("libffi" ,libffi)
146 ,@(libiconv-if-needed)
148 ;; We need Bash when cross-compiling because some of the scripts
149 ;; in bin/ refer to it. Use 'bash-minimal' because we don't need
150 ;; an interactive Bash with Readline and all.
151 ,@(if (target-mingw?) '() `(("bash" ,bash-minimal)))))
153 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
154 ;; reads `-lltdl -lunistring', adding them here will add the needed
155 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
156 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
157 ("libunistring" ,libunistring)
159 ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
160 ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
163 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
164 ;; must be propagated.
168 (self-native-input? #t)
170 (outputs '("out" "debug"))
173 `(#:configure-flags '("--disable-static") ; saves 3 MiB
175 (modify-phases %standard-phases
176 (add-before 'configure 'pre-configure
177 (lambda* (#:key inputs #:allow-other-keys)
178 ;; Tell (ice-9 popen) the file name of Bash.
179 (let ((bash (assoc-ref inputs "bash")))
180 (substitute* "module/ice-9/popen.scm"
181 ;; If bash is #f allow fallback for user to provide
182 ;; "bash" in PATH. This happens when cross-building to
183 ;; MinGW for which we do not have Bash yet.
185 ,@(if (target-mingw?)
187 (string-append bash "/bin/bash")
189 '((string-append bash "/bin/bash")))))
193 (list (search-path-specification
194 (variable "GUILE_LOAD_PATH")
195 (files '("share/guile/site/2.0")))
196 (search-path-specification
197 (variable "GUILE_LOAD_COMPILED_PATH")
198 (files '("lib/guile/2.0/site-ccache")))))
200 (synopsis "Scheme implementation intended especially for extensions")
202 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
203 official extension language of the GNU system. It is an implementation of
204 the Scheme language which can be easily embedded in other applications to
205 provide a convenient means of extending the functionality of the application
206 without requiring the source code to be rewritten.")
207 (home-page "https://www.gnu.org/software/guile/")
208 (license license:lgpl3+)))
210 (define-public guile-2.0.13
211 ;; For testing a "minimal" Guix
213 (package (inherit guile-2.0)
218 (uri (string-append "mirror://gnu/guile/guile-" version
222 "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p")))))))
224 (define-public guile-2.2
225 (package (inherit guile-2.0)
231 ;; Note: we are limited to one of the compression formats
232 ;; supported by the bootstrap binaries, so no lzip here.
233 (uri (string-append "mirror://gnu/guile/guile-" version
237 "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))
238 (modules '((guix build utils)))
240 ;; Remove the pre-built object files. Instead, build everything
241 ;; from source, at the expense of significantly longer build
242 ;; times (almost 3 hours on a 4-core Intel i5).
244 (for-each delete-file
245 (find-files "prebuilt" "\\.go$"))
247 (properties '((timeout . 72000) ;20 hours
248 (max-silent-time . 36000))) ;10 hours (needed on ARM
249 ; when heavily loaded)
251 (list (search-path-specification
252 (variable "GUILE_LOAD_PATH")
253 (files '("share/guile/site/2.2")))
254 (search-path-specification
255 (variable "GUILE_LOAD_COMPILED_PATH")
256 (files '("lib/guile/2.2/site-ccache")))))
259 (if (%current-target-system)
260 (substitute-keyword-arguments (package-arguments guile-2.0)
261 ((#:phases phases '%standard-phases)
262 `(modify-phases ,phases
263 (add-after 'unpack 'sacrifice-elisp-support
265 ;; Cross-compiling language/elisp/boot.el fails, so
267 ;; <https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=988aa29238fca862c7e2cb55f15762a69b4c16ce>
268 ;; for the upstream fix.
269 (substitute* "module/Makefile.in"
270 (("language/elisp/boot\\.el")
274 `((add-after 'unpack 'allow-madvise-ENOSYS
276 ;; Do not warn about ENOSYS on 'madvise'. This is
278 ;; 45e4ace6603e00b297e6542362273041aebe7305 does.
279 ;; TODO: Remove for Guile >= 2.2.5.
280 (substitute* "libguile/vm.c"
281 (("perror \\(\"madvise failed\"\\)")
282 "if (errno != ENOSYS) perror (\"madvised failed\");"))
285 (package-arguments guile-2.0)))))
287 (define-public guile-2.2/fixed
288 ;; A package of Guile 2.2 that's rarely changed. It is the one used
289 ;; in the `base' module, and thus changing it entails a full rebuild.
292 (properties '((hidden? . #t) ;people should install 'guile-2.2'
293 (timeout . 72000) ;20 hours
294 (max-silent-time . 36000))))) ;10 hours (needed on ARM
295 ; when heavily loaded)
297 (define-public guile-next
298 ;; This is the upcoming Guile 3.0, with JIT support.
299 (let ((commit "6f3357b0df64c4be17e72079864c09a542f1c779")
306 (inherit (package-source guile-2.2))
307 (uri (string-append "https://alpha.gnu.org/gnu/guile/guile-"
311 "0iba93yqn6mvgid0rfsrg4amym36pg9m8cqdplxsy222blrj9gh1"))))
313 (list (search-path-specification
314 (variable "GUILE_LOAD_PATH")
315 (files '("share/guile/site/3.0")))
316 (search-path-specification
317 (variable "GUILE_LOAD_COMPILED_PATH")
318 (files '("lib/guile/3.0/site-ccache"
319 "share/guile/site/3.0")))))
320 (properties '((ftp-server . "alpha.gnu.org")
321 (upstream-name . "guile"))))))
323 (define (make-guile-readline guile)
325 (name "guile-readline")
326 (version (package-version guile))
327 (source (package-source guile))
328 (build-system gnu-build-system)
330 '(#:configure-flags '("--disable-silent-rules")
331 #:phases (modify-phases %standard-phases
332 (add-before 'build 'chdir
333 (lambda* (#:key outputs #:allow-other-keys)
334 (invoke "make" "-C" "libguile" "scmconfig.h")
335 (invoke "make" "-C" "lib")
336 (chdir "guile-readline")
338 (substitute* "Makefile"
339 (("../libguile/libguile-[[:graph:]]+\\.la")
340 ;; Remove dependency on libguile-X.Y.la.
342 (("^READLINE_LIBS = (.*)$" _ libs)
343 ;; Link against the provided libguile.
344 (string-append "READLINE_LIBS = "
345 "-lguile-$(GUILE_EFFECTIVE_VERSION) "
347 (("\\$\\(top_builddir\\)/meta/build-env")
348 ;; Use the provided Guile, not the one from
352 ;; Install modules to the 'site' directories.
354 "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
355 (("^ccachedir = .*$")
356 "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
358 ;; Load 'guile-readline.so' from the right place.
359 (substitute* "ice-9/readline.scm"
360 (("load-extension \"guile-readline\"")
361 (format #f "load-extension \
362 (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
363 (assoc-ref outputs "out"))))
365 (home-page (package-home-page guile))
366 (native-inputs (package-native-inputs guile))
368 `(,@(package-inputs guile) ;to placate 'configure'
369 ,@(package-propagated-inputs guile)
371 ("readline" ,readline)))
372 (synopsis "Line editing support for GNU Guile")
374 "This module provides line editing support via the Readline library for
375 GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
376 @code{activate-readline} procedure to enable it.")
377 (license license:gpl3+)))
379 (define-public guile-readline
380 (make-guile-readline guile-2.2))
382 (define (guile-variant-package-name prefix)
384 "Return NAME with PREFIX instead of \"guile-\", when applicable."
385 (if (string-prefix? "guile-" name)
386 (string-append prefix "-"
388 (string-length "guile-")))
391 (define package-for-guile-2.0
392 ;; A procedure that rewrites the dependency tree of the given package to use
393 ;; GUILE-2.0 instead of GUILE-2.2.
394 (package-input-rewriting (delay `((,guile-2.2 . ,guile-2.0)))
395 (guile-variant-package-name "guile2.0")))
397 (define-public guile-for-guile-emacs
398 (package (inherit guile-2.2)
399 (name "guile-for-guile-emacs")
400 (version "20150510.d8d9a8d")
404 (url "git://git.hcoop.net/git/bpt/guile.git")
405 (commit "d8d9a8da05ec876acba81a559798eb5eeceb5a17")))
406 (file-name (string-append name "-" version "-checkout"))
409 "00sprsshy16y8pxjy126hr2adqcvvzzz96hjyjwgg8swva1qh6b0"))))
411 `(;; Tests aren't passing for now.
412 ;; Obviously we should re-enable this!
414 ,@(package-arguments guile-2.2)))
416 `(("autoconf" ,autoconf)
417 ("automake" ,automake)
421 ("gettext" ,gettext-minimal)
422 ,@(package-native-inputs guile-2.2)))
423 ;; Same as in guile-2.0
425 (list (search-path-specification
426 (variable "GUILE_LOAD_PATH")
427 (files '("share/guile/site/2.0")))
428 (search-path-specification
429 (variable "GUILE_LOAD_COMPILED_PATH")
430 (files '("lib/guile/2.0/site-ccache"
431 "share/guile/site/2.0")))))))
438 (define-public guile-json
442 (home-page "https://github.com/aconchillo/guile-json")
445 (uri (string-append "https://download.savannah.nongnu.org/releases/"
446 name "/" name "-" version ".tar.gz"))
449 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
450 (build-system gnu-build-system)
451 (native-inputs `(("pkg-config" ,pkg-config)
452 ("guile" ,guile-2.2)))
453 (inputs `(("guile" ,guile-2.2)))
454 (synopsis "JSON module for Guile")
456 "Guile-JSON supports parsing and building JSON documents according to the
457 specification. These are the main features:
460 @item Strictly complies to @uref{http://json.org, specification}.
461 @item Build JSON documents programmatically via macros.
462 @item Unicode support for strings.
463 @item Allows JSON pretty printing.
466 ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
467 (license license:gpl3+)))
469 (define-public guile2.2-json
470 (deprecated-package "guile2.2-json" guile-json))
472 (define-public guile2.0-json
473 (package-for-guile-2.0 guile-json))
475 (define-public guile-json-3
476 ;; This version is incompatible with 1.x; see the 'NEWS' file.
483 (uri (string-append "https://download.savannah.nongnu.org/releases/"
484 name "/" name "-" version ".tar.gz"))
487 "1yfqscz74i4vxylabd3s9l0wbdp8bg9qxnv1ixdm3b1l7zdx00z3"))))))
489 ;; There are two guile-gdbm packages, one using the FFI and one with
490 ;; direct C bindings, hence the verbose name.
492 (define-public guile-gdbm-ffi
494 (name "guile-gdbm-ffi")
495 (version "20120209.fa1d5b6")
499 (url "https://github.com/ijp/guile-gdbm.git")
500 (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
501 (file-name (string-append name "-" version "-checkout"))
502 (patches (search-patches
503 "guile-gdbm-ffi-support-gdbm-1.14.patch"))
506 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
507 (build-system guile-build-system)
509 '(#:phases (modify-phases %standard-phases
510 (add-after 'unpack 'move-examples
511 (lambda* (#:key outputs #:allow-other-keys)
512 ;; Move examples where they belong.
513 (let* ((out (assoc-ref outputs "out"))
514 (doc (string-append out "/share/doc/"
515 (strip-store-file-name out)
517 (copy-recursively "examples" doc)
518 (delete-file-recursively "examples")
520 (add-after 'unpack 'set-libgdbm-file-name
521 (lambda* (#:key inputs #:allow-other-keys)
522 (substitute* "gdbm.scm"
523 (("\\(dynamic-link \"libgdbm\"\\)")
524 (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
525 (assoc-ref inputs "gdbm"))))
528 `(("guile" ,guile-2.2)))
531 (home-page "https://github.com/ijp/guile-gdbm")
532 (synopsis "Guile bindings to the GDBM library via Guile's FFI")
534 "Guile bindings to the GDBM key-value storage system, using
535 Guile's foreign function interface.")
536 (license license:gpl3+)))
538 (define-public guile2.0-gdbm-ffi
539 (package-for-guile-2.0 guile-gdbm-ffi))
541 (define-public guile2.2-gdbm-ffi
542 (deprecated-package "guile2.2-gdbm-ffi" guile-gdbm-ffi))
544 (define-public guile-sqlite3
546 (name "guile-sqlite3")
548 (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
553 (commit (string-append "v" version))))
556 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
557 (file-name (string-append name "-" version "-checkout"))))
558 (build-system gnu-build-system)
560 `(("autoconf" ,autoconf)
561 ("automake" ,automake)
562 ("pkg-config" ,pkg-config)))
564 `(("guile" ,guile-2.2)
566 (synopsis "Access SQLite databases from Guile")
568 "This package provides Guile bindings to the SQLite database system.")
569 (license license:gpl3+)))
571 (define-public guile2.0-sqlite3
572 (package-for-guile-2.0 guile-sqlite3))
574 (define-public guile-bytestructures
576 (name "guile-bytestructures")
580 (uri (string-append "https://github.com/TaylanUB/scheme-bytestructures"
581 "/releases/download/v" version
582 "/bytestructures-" version ".tar.gz"))
585 "0ibk7fjwpb450lnrva4bx45sgln3pbyb645az4ansvh1spgani43"))))
586 (build-system gnu-build-system)
588 `(("pkg-config" ,pkg-config)))
590 `(("guile" ,guile-2.2)))
591 (home-page "https://github.com/TaylanUB/scheme-bytestructures")
592 (synopsis "Structured access to bytevector contents for Guile")
594 "Guile bytestructures offers a system imitating the type system
595 of the C programming language, to be used on bytevectors. C's type
596 system works on raw memory, and Guile works on bytevectors which are
597 an abstraction over raw memory. It's also more powerful than the C
598 type system, elevating types to first-class status.")
599 (license license:gpl3+)))
601 (define-public guile2.0-bytestructures
602 (package-for-guile-2.0 guile-bytestructures))
604 (define-public guile-git
608 (home-page "https://gitlab.com/guile-git/guile-git.git")
611 (uri (git-reference (url home-page)
612 (commit (string-append "v" version))))
615 "018hmfsh0rjwfvr4h7y10jc6k8a2k9xsirngghy3pjasin4nd2yz"))
616 (file-name (git-file-name name version))))
617 (build-system gnu-build-system)
619 `(("autoconf" ,autoconf)
620 ("automake" ,automake)
622 ("pkg-config" ,pkg-config)))
624 `(("guile" ,guile-2.2)
625 ("libgit2" ,libgit2)))
627 `(("guile-bytestructures" ,guile-bytestructures)))
628 (synopsis "Guile bindings for libgit2")
630 "This package provides Guile bindings to libgit2, a library to
631 manipulate repositories of the Git version control system.")
632 (license license:gpl3+)))
634 (define-public guile2.0-git
635 (package-for-guile-2.0 guile-git))
637 ;;; guile.scm ends here