gnu: sicp: Do not import module from the host Guile.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
4 ;;; Copyright © 2015, 2016 Federico Beffa <beffa@fbengineering.ch>
5 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
9 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
10 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
11 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
13 ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages scheme)
31 #:use-module (gnu packages)
32 #:use-module ((guix licenses)
33 #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
34 cc-by-sa4.0 non-copyleft))
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix utils)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages bdw-gc)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages libevent)
46 #:use-module (gnu packages libunistring)
47 #:use-module (gnu packages m4)
48 #:use-module (gnu packages multiprecision)
49 #:use-module (gnu packages ncurses)
50 #:use-module (gnu packages pcre)
51 #:use-module (gnu packages emacs)
52 #:use-module (gnu packages ghostscript)
53 #:use-module (gnu packages netpbm)
54 #:use-module (gnu packages texinfo)
55 #:use-module (gnu packages tex)
56 #:use-module (gnu packages base)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages avahi)
60 #:use-module (gnu packages libphidget)
61 #:use-module (gnu packages gcc)
62 #:use-module (gnu packages glib)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages libffi)
65 #:use-module (gnu packages fontutils)
66 #:use-module (gnu packages image)
67 #:use-module (gnu packages xorg)
68 #:use-module (gnu packages sqlite)
69 #:use-module (gnu packages tls)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages libedit)
72 #:use-module (srfi srfi-1)
73 #:use-module (ice-9 match))
74
75 (define (mit-scheme-source-directory system version)
76 (string-append "mit-scheme-"
77 (if (or (string-prefix? "x86_64" system)
78 (string-prefix? "i686" system))
79 ""
80 "c-")
81 version))
82
83 (define-public mit-scheme
84 (package
85 (name "mit-scheme")
86 (version "10.1.3")
87 (source #f) ; see below
88 (outputs '("out" "doc"))
89 (build-system gnu-build-system)
90 (arguments
91 `(#:modules ((guix build gnu-build-system)
92 (guix build utils)
93 (srfi srfi-1))
94 #:phases
95 (modify-phases %standard-phases
96 (replace 'unpack
97 (lambda* (#:key inputs #:allow-other-keys)
98 (invoke "tar" "xzvf"
99 (assoc-ref inputs "source"))
100 (chdir ,(mit-scheme-source-directory (%current-system)
101 version))
102 ;; Delete these dangling symlinks since they break
103 ;; `patch-shebangs'.
104 (for-each delete-file
105 (find-files "src/compiler" "^make\\."))
106 (chdir "src")
107 #t))
108 (add-after 'unpack 'patch-/bin/sh
109 (lambda _
110 (setenv "CONFIG_SHELL" (which "sh"))
111 (substitute* '("../tests/ffi/autogen.sh"
112 "../tests/ffi/autobuild.sh"
113 "../tests/ffi/test-ffi.sh"
114 "../tests/runtime/test-process.scm"
115 "runtime/unxprm.scm")
116 (("/bin/sh") (which "sh"))
117 (("\\./autogen\\.sh")
118 (string-append (which "sh") " autogen.sh"))
119 (("\\./configure")
120 (string-append (which "sh") " configure")))
121 #t))
122 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
123 ;; them in HOME, so it needs to be writeable.
124 (add-before 'build 'set-HOME
125 (lambda _ (setenv "HOME" "/tmp") #t))
126 (replace 'build
127 (lambda* (#:key system outputs #:allow-other-keys)
128 (let ((out (assoc-ref outputs "out")))
129 (if (or (string-prefix? "x86_64" system)
130 (string-prefix? "i686" system))
131 (invoke "make" "compile-microcode")
132 (invoke "./etc/make-liarc.sh"
133 (string-append "--prefix=" out)))
134 #t)))
135 (add-after 'configure 'configure-doc
136 (lambda* (#:key outputs inputs #:allow-other-keys)
137 (with-directory-excursion "../doc"
138 (let* ((out (assoc-ref outputs "out"))
139 (bash (assoc-ref inputs "bash"))
140 (bin/sh (string-append bash "/bin/sh")))
141 (invoke bin/sh "./configure"
142 (string-append "--prefix=" out)
143 (string-append "SHELL=" bin/sh))
144 #t))))
145 (add-after 'build 'build-doc
146 (lambda* _
147 (with-directory-excursion "../doc"
148 (invoke "make"))
149 #t))
150 (add-after 'install 'install-doc
151 (lambda* (#:key outputs #:allow-other-keys)
152 (let* ((out (assoc-ref outputs "out"))
153 (doc (assoc-ref outputs "doc"))
154 (old-doc-dir (string-append out "/share/doc"))
155 (new-doc/mit-scheme-dir
156 (string-append doc "/share/doc/" ,name "-" ,version)))
157 (with-directory-excursion "../doc"
158 (for-each (lambda (target)
159 (invoke "make" target))
160 '("install-info-gz" "install-man"
161 "install-html" "install-pdf")))
162 (mkdir-p new-doc/mit-scheme-dir)
163 (copy-recursively
164 (string-append old-doc-dir "/" ,name)
165 new-doc/mit-scheme-dir)
166 (delete-file-recursively old-doc-dir)
167 #t))))))
168 (native-inputs
169 `(;; Autoconf, Automake, and Libtool are necessary for the FFI tests.
170 ("autoconf" ,autoconf)
171 ("automake" ,automake)
172 ("libtool" ,libtool)
173 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
174 ("texinfo" ,texinfo)
175 ("m4" ,m4)))
176 (inputs
177 `(("libx11" ,libx11)
178
179 ("source"
180
181 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
182 ;; compile from the architecture-specific tarballs, which contain
183 ;; pre-built binaries. It leads to more efficient code than when
184 ;; building the tarball that contains generated C code instead of
185 ;; those binaries.
186 ,(origin
187 (method url-fetch)
188 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
189 version "/mit-scheme-"
190 (match (%current-system)
191 ("x86_64-linux"
192 (string-append version "-x86-64"))
193 ("i686-linux"
194 (string-append version "-i386"))
195 (_
196 (string-append "c-" version)))
197 ".tar.gz"))
198 (sha256
199 (match (%current-system)
200 ("x86_64-linux"
201 (base32
202 "03m7cc035w3avs91j2pcz9f15ssgvgp3rm045d1vbydqrkzfyw8k"))
203 ("i686-linux"
204 (base32
205 "05sjyz90xxfnmi87qv8x0yx0fcallnzl1dciygdafp317pn489is"))
206 (_
207 (base32
208 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))))))))
209
210 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
211 ;; Also, the portable C version of MIT/GNU Scheme did not work in time for
212 ;; release in version 10.1.
213 (supported-systems '("x86_64-linux" "i686-linux"))
214
215 (home-page "https://www.gnu.org/software/mit-scheme/")
216 (synopsis "A Scheme implementation with integrated editor and debugger")
217 (description
218 "GNU/MIT Scheme is an implementation of the Scheme programming
219 language. It provides an interpreter, a compiler and a debugger. It also
220 features an integrated Emacs-like editor and a large runtime library.")
221 (license gpl2+)
222 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
223
224 (define-public bigloo
225 ;; Upstream modifies source tarballs in place, making significant changes
226 ;; long after the initial publication: <https://bugs.gnu.org/33525>.
227 (let ((upstream-version "4.3f"))
228 (package
229 (name "bigloo")
230 (version "4.3f")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
234 upstream-version ".tar.gz"))
235 (sha256
236 (base32
237 "09whj8z91qbihk59dw2yb2ccbx9nk1c4l65j62pfs1pz822cpyh9"))
238 ;; Remove bundled libraries.
239 (modules '((guix build utils)))
240 (snippet
241 '(begin
242 (for-each delete-file-recursively
243 '("gc" "gmp" "libuv"))
244 #t))))
245 (build-system gnu-build-system)
246 (arguments
247 `(#:test-target "test"
248 #:phases
249 (modify-phases %standard-phases
250 (replace 'configure
251 (lambda* (#:key inputs outputs #:allow-other-keys)
252
253 (substitute* "configure"
254 (("^shell=.*$")
255 (string-append "shell=" (which "bash") "\n"))
256 (("`date`") "0"))
257 (substitute* "autoconf/runtest.in"
258 ((", @DATE@") ""))
259 (substitute* "autoconf/osversion"
260 (("^version.*$") "version=\"\"\n"))
261 (substitute* "comptime/Makefile"
262 (("\\$\\(LDCOMPLIBS\\)")
263 "$(LDCOMPLIBS) $(LDFLAGS)"))
264
265 ;; The `configure' script doesn't understand options
266 ;; of those of Autoconf.
267 (let ((out (assoc-ref outputs "out")))
268 (invoke "./configure"
269 (string-append "--prefix=" out)
270 ; use system libraries
271 "--customgc=no"
272 "--customunistring=no"
273 "--customlibuv=no"
274 (string-append"--mv=" (which "mv"))
275 (string-append "--rm=" (which "rm"))
276 "--cflags=-fPIC"
277 (string-append "--ldflags=-Wl,-rpath="
278 (assoc-ref outputs "out")
279 "/lib/bigloo/" ,upstream-version)
280 (string-append "--lispdir=" out
281 "/share/emacs/site-lisp")
282 "--sharedbde=yes"
283 "--sharedcompiler=yes"
284 "--disable-patch"))))
285 (add-after 'install 'install-emacs-modes
286 (lambda* (#:key outputs #:allow-other-keys)
287 (let* ((out (assoc-ref outputs "out"))
288 (dir (string-append out "/share/emacs/site-lisp")))
289 (invoke "make" "-C" "bmacs" "all" "install"
290 (string-append "EMACSBRAND=emacs25")
291 (string-append "EMACSDIR=" dir))))))))
292 (inputs
293 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
294 ("libgc" ,libgc)
295 ("libunistring" ,libunistring)
296 ("libuv" ,libuv)
297 ("openssl" ,openssl)
298 ("sqlite" ,sqlite)
299
300 ;; Optional APIs for which Bigloo has bindings.
301 ("avahi" ,avahi)
302 ("libphidget" ,libphidget)
303 ("pcre" ,pcre)))
304 (native-inputs
305 `(("pkg-config" ,pkg-config)))
306 (propagated-inputs
307 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
308 (home-page "https://www-sop.inria.fr/indes/fp/Bigloo/")
309 (synopsis "Efficient Scheme compiler")
310 (description
311 "Bigloo is a Scheme implementation devoted to one goal: enabling Scheme
312 based programming style where C(++) is usually required. Bigloo attempts to
313 make Scheme practical by offering features usually presented by traditional
314 programming languages but not offered by Scheme and functional programming.
315 Bigloo compiles Scheme modules. It delivers small and fast stand alone binary
316 executables. Bigloo enables full connections between Scheme and C programs
317 and between Scheme and Java programs.")
318 (license gpl2+))))
319
320 (define-public hop
321 (package
322 (name "hop")
323 (version "3.2.0-pre1")
324 (source (origin
325 (method url-fetch)
326 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
327 version ".tar.gz"))
328 (sha256
329 (base32
330 "0jf418d0s9imv98s6qrpjxr1mdaxr37knh5qyfl5y4a9cc41mlg5"))))
331 (build-system gnu-build-system)
332 (arguments
333 `(#:test-target "test"
334 #:make-flags '("BIGLOO=bigloo")
335 #:parallel-build? #f
336 #:phases
337 (modify-phases %standard-phases
338 (replace 'configure
339 (lambda* (#:key inputs outputs #:allow-other-keys)
340 (let ((out (assoc-ref outputs "out")))
341 (substitute* '("tools/Makefile"
342 "test/hopjs/TEST.in")
343 (("/bin/rm") (which "rm")))
344 (invoke "./configure"
345 (string-append "--prefix=" out)
346 "--hostcc=gcc"
347 (string-append "--blflags="
348 ;; user flags completely override useful
349 ;; default flags, so repeat them here.
350 "-copt \\$(CPICFLAGS) "
351 "-L \\$(BUILDLIBDIR) "
352 "-ldopt -Wl,-rpath," out "/lib"))))))))
353 (inputs `(("avahi" ,avahi)
354 ("bigloo" ,bigloo)
355 ("libgc" ,libgc)
356 ("libunistring" ,libunistring)
357 ("libuv" ,libuv)
358 ("pcre" ,pcre)
359 ("sqlite" ,sqlite)
360 ("which" ,which)))
361 (home-page "http://hop.inria.fr/")
362 (synopsis "Multi-tier programming language for the Web 2.0")
363 (description
364 "HOP is a multi-tier programming language for the Web 2.0 and the
365 so-called diffuse Web. It is designed for programming interactive web
366 applications in many fields such as multimedia (web galleries, music players,
367 ...), ubiquitous and house automation (SmartPhones, personal appliance),
368 mashups, office (web agendas, mail clients, ...), etc.")
369 (license gpl2+)))
370
371 (define-public chicken
372 (package
373 (name "chicken")
374 (version "5.0.0")
375 (source (origin
376 (method url-fetch)
377 (uri (string-append "https://code.call-cc.org/releases/"
378 version "/chicken-" version ".tar.gz"))
379 (sha256
380 (base32
381 "15b5yrzfa8aimzba79x7v6y282f898rxqxfxrr446sjx9jwlpfd8"))))
382 (build-system gnu-build-system)
383 (arguments
384 `(#:modules ((guix build gnu-build-system)
385 (guix build utils)
386 (srfi srfi-1))
387
388 ;; No `configure' script; run "make check" after "make install" as
389 ;; prescribed by README.
390 #:phases
391 (modify-phases %standard-phases
392 (delete 'configure)
393 (delete 'check)
394 (add-after 'install 'check
395 (assoc-ref %standard-phases 'check)))
396
397 #:make-flags (let ((out (assoc-ref %outputs "out")))
398 (list "PLATFORM=linux"
399 (string-append "PREFIX=" out)
400 (string-append "VARDIR=" out "/var/lib")))
401
402 ;; Parallel builds are not supported, as noted in README.
403 #:parallel-build? #f))
404 (home-page "http://www.call-cc.org/")
405 (synopsis "R5RS Scheme implementation that compiles native code via C")
406 (description
407 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
408 produces portable and efficient C, supports almost all of the R5RS Scheme
409 language standard, and includes many enhancements and extensions.")
410 (license bsd-3)))
411
412 (define-public scheme48
413 (package
414 (name "scheme48")
415 (version "1.9.2")
416 (source (origin
417 (method url-fetch)
418 (uri (string-append "http://s48.org/" version
419 "/scheme48-" version ".tgz"))
420 (sha256
421 (base32
422 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
423 (patches (search-patches "scheme48-tests.patch"))))
424 (build-system gnu-build-system)
425 (home-page "http://s48.org/")
426 (synopsis "Scheme implementation using a bytecode interpreter")
427 (description
428 "Scheme 48 is an implementation of Scheme based on a byte-code
429 interpreter and is designed to be used as a testbed for experiments in
430 implementation techniques and as an expository tool.")
431
432 ;; Most files are BSD-3; see COPYING for the few exceptions.
433 (license bsd-3)))
434
435 (define-public racket
436 (package
437 (name "racket")
438 (version "7.3")
439 (source (origin
440 (method url-fetch)
441 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
442 version "/racket-" version "-src.tgz")
443 (string-append
444 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
445 version "/racket-" version "-src.tgz")))
446 (sha256
447 (base32
448 "0h6072njhb87rkz4arijvahxgjzn8r14s4wns0ijvxm89bg136yl"))
449 (patches (search-patches
450 "racket-store-checksum-override.patch"))))
451 (build-system gnu-build-system)
452 (arguments
453 '(#:phases
454 (modify-phases %standard-phases
455 (add-before 'configure 'pre-configure
456 (lambda* (#:key inputs #:allow-other-keys)
457 ;; Patch dynamically loaded libraries with their absolute paths.
458 (let* ((library-path (search-path-as-string->list
459 (getenv "LIBRARY_PATH")))
460 (find-so (lambda (soname)
461 (search-path
462 library-path
463 (format #f "~a.so" soname))))
464 (patch-ffi-libs (lambda (file libs)
465 (for-each
466 (lambda (lib)
467 (substitute* file
468 (((format #f "\"~a\"" lib))
469 (format #f "\"~a\"" (find-so lib)))))
470 libs))))
471 (substitute* "collects/db/private/sqlite3/ffi.rkt"
472 (("ffi-lib sqlite-so")
473 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
474 (substitute* "collects/openssl/libssl.rkt"
475 (("ffi-lib libssl-so")
476 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
477 (substitute* "collects/openssl/libcrypto.rkt"
478 (("ffi-lib libcrypto-so")
479 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
480 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
481 (("ffi-lib libgmp-so")
482 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
483 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
484 (("ffi-lib libmpfr-so")
485 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
486 (substitute* "share/pkgs/readline-lib/readline/rktrl.rkt"
487 (("\\(getenv \"PLT_READLINE_LIB\"\\)")
488 (format #f "\"~a\"" (find-so "libedit"))))
489 (for-each
490 (lambda (x) (apply patch-ffi-libs x))
491 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
492 ("libfontconfig" "libcairo"))
493 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
494 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
495 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
496 ("libjpeg"))
497 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
498 ("libpango-1.0" "libpangocairo-1.0"))
499 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
500 ("libpng"))
501 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
502 ("libodbc"))
503 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
504 ("libX11"))
505 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
506 ("libgio-2.0"))
507 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
508 ("libgdk-3" "libgtk-3"))
509 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
510 ("libunique-1.0"))
511 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
512 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
513 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
514 ("libGL"))
515 ("share/pkgs/sgl/gl.rkt"
516 ("libGL" "libGLU")))))
517 (chdir "src")
518 #t))
519 (add-after 'unpack 'patch-/bin/sh
520 (lambda _
521 (substitute* "collects/racket/system.rkt"
522 (("/bin/sh") (which "sh")))
523 #t)))
524 #:tests? #f ; XXX: how to run them?
525 ))
526 (inputs
527 `(("libffi" ,libffi)
528 ;; Hardcode dynamically loaded libraries for better functionality.
529 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
530 ("cairo" ,cairo)
531 ("fontconfig" ,fontconfig)
532 ("glib" ,glib)
533 ("glu" ,glu)
534 ("gmp" ,gmp)
535 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
536 ("libjpeg" ,libjpeg)
537 ("libpng" ,libpng)
538 ("libx11" ,libx11)
539 ("mesa" ,mesa)
540 ("mpfr" ,mpfr)
541 ("openssl" ,openssl)
542 ("pango" ,pango)
543 ("sqlite" ,sqlite)
544 ("unixodbc" ,unixodbc)
545 ("libedit" ,libedit)))
546 (home-page "http://racket-lang.org")
547 (synopsis "Implementation of Scheme and related languages")
548 (description
549 "Racket is an implementation of the Scheme programming language (R5RS and
550 R6RS) and related languages, such as Typed Racket. It features a compiler and
551 a virtual machine with just-in-time native compilation, as well as a large set
552 of libraries.")
553 (license lgpl2.0+)))
554
555 (define-public gambit-c
556 (package
557 (name "gambit-c")
558 (version "4.9.3")
559 (source
560 (origin
561 (method url-fetch)
562 (uri (string-append
563 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
564 (version-major+minor version) "/source/gambit-v"
565 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
566 ".tgz"))
567 (sha256
568 (base32 "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk"))))
569 (build-system gnu-build-system)
570 (arguments
571 '(#:configure-flags
572 ;; According to the ./configure script, this makes the build slower and
573 ;; use >= 1 GB memory, but makes Gambit much faster.
574 '("--enable-single-host")))
575 (home-page "http://dynamo.iro.umontreal.ca/wiki/index.php/Main_Page")
576 (synopsis "Efficient Scheme interpreter and compiler")
577 (description
578 "Gambit consists of two main programs: gsi, the Gambit Scheme
579 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
580 the complete execution and debugging environment. The compiler is the
581 interpreter extended with the capability of generating executable files. The
582 compiler can produce standalone executables or compiled modules which can be
583 loaded at run time. Interpreted code and compiled code can be freely
584 mixed.")
585 ;; Dual license.
586 (license (list lgpl2.1+ asl2.0))))
587
588 (define-public chibi-scheme
589 (package
590 (name "chibi-scheme")
591 (version "0.8")
592 (home-page "https://github.com/ashinn/chibi-scheme")
593 (source
594 (origin
595 (method git-fetch)
596 (uri (git-reference (url home-page) (commit version)))
597 (file-name (git-file-name name version))
598 (sha256
599 (base32
600 "0269d5fhaz7nqjb41vh7yz63mp5s4z08fn4sspwc06z32xksigw9"))))
601 (build-system gnu-build-system)
602 (arguments
603 `(#:phases (modify-phases %standard-phases
604 (delete 'configure)
605 (add-before 'build 'set-cc
606 (lambda _
607 (setenv "CC" "gcc"))))
608 #:make-flags (let ((out (assoc-ref %outputs "out")))
609 (list (string-append "PREFIX=" out)
610 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
611 #:test-target "test"))
612 (synopsis "Small embeddable Scheme implementation")
613 (description
614 "Chibi-Scheme is a very small library with no external dependencies
615 intended for use as an extension and scripting language in C programs. In
616 addition to support for lightweight VM-based threads, each VM itself runs in
617 an isolated heap allowing multiple VMs to run simultaneously in different OS
618 threads.")
619 (license bsd-3)))
620
621 (define-public sicp
622 (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
623 (package
624 (name "sicp")
625 (version (string-append "20170703-1." (string-take commit 7)))
626 (source (origin
627 (method git-fetch)
628 (uri (git-reference
629 (url "https://github.com/sarabander/sicp")
630 (commit commit)))
631 (sha256
632 (base32
633 "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
634 (file-name (string-append name "-" version "-checkout"))))
635 (build-system trivial-build-system)
636 (native-inputs `(("gzip" ,gzip)
637 ("source" ,source)
638 ("texinfo" ,texinfo)))
639 (arguments
640 `(#:modules ((guix build utils))
641 #:builder
642 (begin
643 (use-modules (guix build utils)
644 (srfi srfi-26))
645 (let ((gzip (assoc-ref %build-inputs "gzip"))
646 (source (assoc-ref %build-inputs "source"))
647 (texinfo (assoc-ref %build-inputs "texinfo"))
648 (html-dir (string-append %output "/share/doc/" ,name "/html"))
649 (info-dir (string-append %output "/share/info")))
650 (copy-recursively (string-append source "/html") html-dir)
651 (setenv "PATH" (string-append gzip "/bin"
652 ":" texinfo "/bin"))
653 (mkdir-p info-dir)
654 (invoke "makeinfo" "--output"
655 (string-append info-dir "/sicp.info")
656 (string-append source "/sicp-pocket.texi"))
657 (for-each (cut invoke "gzip" "-9n" <>)
658 (find-files info-dir))
659 #t))))
660 (home-page "https://sarabander.github.io/sicp")
661 (synopsis "Structure and Interpretation of Computer Programs")
662 (description "Structure and Interpretation of Computer Programs (SICP) is
663 a textbook aiming to teach the principles of computer programming.
664
665 Using Scheme, a dialect of the Lisp programming language, the book explains
666 core computer science concepts such as abstraction in programming,
667 metalinguistic abstraction, recursion, interpreters, and modular programming.")
668 (license cc-by-sa4.0))))
669
670 (define-public scheme48-rx
671 (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
672 (revision "2"))
673 (package
674 (name "scheme48-rx")
675 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
676 (source
677 (origin
678 (method git-fetch)
679 (uri (git-reference
680 (url "https://github.com/scheme/rx")
681 (commit commit)))
682 (sha256
683 (base32
684 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
685 (file-name (string-append name "-" version "-checkout"))))
686 (build-system trivial-build-system)
687 (arguments
688 `(#:modules ((guix build utils))
689 #:builder
690 (begin
691 (use-modules (guix build utils))
692 (let ((share (string-append %output
693 "/share/scheme48-"
694 ,(package-version scheme48)
695 "/rx")))
696 (chdir (assoc-ref %build-inputs "source"))
697 (mkdir-p share)
698 (copy-recursively "." share)
699 #t))))
700 (native-inputs
701 `(("source" ,source)
702 ("scheme48" ,scheme48)))
703 (home-page "https://github.com/scheme/rx/")
704 (synopsis "SRE String pattern-matching library for scheme48")
705 (description
706 "String pattern-matching library for scheme48 based on the SRE
707 regular-expression notation.")
708 (license bsd-3))))
709
710 (define-public slib
711 (package
712 (name "slib")
713 (version "3b5")
714 (source (origin
715 (method url-fetch)
716 (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
717 version ".zip"))
718 (sha256
719 (base32
720 "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
721 (build-system gnu-build-system)
722 (arguments
723 `(#:tests? #f ; There is no check target.
724 #:phases
725 (modify-phases %standard-phases
726 (add-after 'install 'remove-bin-share
727 (lambda* (#:key inputs outputs #:allow-other-keys)
728 (delete-file-recursively
729 (string-append (assoc-ref outputs "out") "/bin"))
730 #t))
731 (replace 'configure
732 (lambda* (#:key inputs outputs #:allow-other-keys)
733 (invoke "./configure"
734 (string-append "--prefix="
735 (assoc-ref outputs "out"))))))))
736 (native-inputs `(("unzip" ,unzip)
737 ("texinfo" ,texinfo)))
738 (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
739 (synopsis "Compatibility and utility library for Scheme")
740 (description "SLIB is a portable Scheme library providing compatibility and
741 utility functions for all standard Scheme implementations.")
742 (license (non-copyleft
743 "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
744 "Or see COPYING in the distribution."))))
745
746 (define-public scm
747 (package
748 (name "scm")
749 (version "5f2")
750 (source (origin
751 (method url-fetch)
752 (uri (string-append
753 "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
754 version ".zip"))
755 (sha256
756 (base32
757 "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
758 (build-system gnu-build-system)
759 (arguments
760 `(#:phases
761 (modify-phases %standard-phases
762 (replace 'configure
763 (lambda* (#:key inputs outputs #:allow-other-keys)
764 (invoke "./configure"
765 (string-append "--prefix="
766 (assoc-ref outputs "out")))))
767 (add-before 'build 'pre-build
768 (lambda* (#:key inputs #:allow-other-keys)
769 (substitute* "Makefile"
770 (("ginstall-info") "install-info"))
771 #t))
772 (replace 'build
773 (lambda* (#:key inputs outputs #:allow-other-keys)
774 (setenv "SCHEME_LIBRARY_PATH"
775 (string-append (assoc-ref inputs "slib")
776 "/lib/slib/"))
777 (invoke "make" "scmlit" "CC=gcc")
778 (invoke "make" "all")))
779 (add-after 'install 'post-install
780 (lambda* (#:key inputs outputs #:allow-other-keys)
781 (let* ((out (assoc-ref outputs "out"))
782 (req (string-append out "/lib/scm/require.scm")))
783 (delete-file req)
784 (format (open req (logior O_WRONLY O_CREAT))
785 "(define (library-vicinity) ~s)\n"
786 (string-append (assoc-ref inputs "slib")
787 "/lib/slib/"))
788
789 ;; We must generate the slibcat file.
790 (invoke (string-append out "/bin/scm")
791 "-br" "new-catalog")))))))
792 (inputs `(("slib" ,slib)))
793 (native-inputs `(("unzip" ,unzip)
794 ("texinfo" ,texinfo)))
795 (home-page "http://people.csail.mit.edu/jaffer/SCM")
796 (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
797 (description "GNU SCM is an implementation of Scheme. This
798 implementation includes Hobbit, a Scheme-to-C compiler, which can
799 generate C files whose binaries can be dynamically or statically
800 linked with a SCM executable.")
801 (license lgpl3+)))
802
803 (define-public tinyscheme
804 (package
805 (name "tinyscheme")
806 (version "1.41")
807 (source (origin
808 (method url-fetch)
809 (uri (string-append "mirror://sourceforge/" name "/" name "/"
810 name "-" version "/" name "-" version ".zip"))
811 (sha256
812 (base32
813 "0yqma4jrjgj95f3hf30h542x97n8ah234n19yklbqq0phfsa08wf"))))
814 (build-system gnu-build-system)
815 (native-inputs
816 `(("unzip" ,unzip)))
817 (arguments
818 `(#:phases
819 (modify-phases %standard-phases
820 (replace 'unpack
821 (lambda* (#:key source #:allow-other-keys)
822 (invoke "unzip" source)
823 (chdir (string-append ,name "-" ,version))
824 #t))
825 (add-after 'unpack 'set-scm-directory
826 ;; Hard-code ‘our’ init.scm instead of looking in the current
827 ;; working directory, so invoking ‘scheme’ just works.
828 (lambda* (#:key outputs #:allow-other-keys)
829 (let* ((out (assoc-ref outputs "out"))
830 (scm (string-append out "/share/" ,name)))
831 (substitute* "scheme.c"
832 (("init.scm" all)
833 (string-append scm "/" all)))
834 #t)))
835 (delete 'configure) ; no configure script
836 (replace 'install
837 ;; There's no ‘install’ target. Install files manually.
838 (lambda* (#:key outputs #:allow-other-keys)
839 (let* ((out (assoc-ref outputs "out"))
840 (bin (string-append out "/bin"))
841 (doc (string-append out "/share/doc/"
842 ,name "-" ,version))
843 (include (string-append out "/include"))
844 (lib (string-append out "/lib"))
845 (scm (string-append out "/share/" ,name)))
846 (install-file "scheme" bin)
847 (install-file "Manual.txt" doc)
848 (install-file "scheme.h" include)
849 (install-file "libtinyscheme.so" lib)
850 (install-file "init.scm" scm)
851 #t))))
852 #:tests? #f)) ; no tests
853 (home-page "http://tinyscheme.sourceforge.net/")
854 (synopsis "Light-weight interpreter for the Scheme programming language")
855 (description
856 "TinyScheme is a light-weight Scheme interpreter that implements as large a
857 subset of R5RS as was possible without getting very large and complicated.
858
859 It's meant to be used as an embedded scripting interpreter for other programs.
860 As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or
861 extensive toolkits, although it does sport a small (and optional) top-level
862 loop.
863
864 As an embedded interpreter, it allows multiple interpreter states to coexist in
865 the same program, without any interference between them. Foreign functions in C
866 can be added and values can be defined in the Scheme environment. Being quite a
867 small program, it is easy to comprehend, get to grips with, and use.")
868 (license bsd-3))) ; there are no licence headers
869
870 (define-public stalin
871 (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
872 ;; FIXME: The Stalin "source" contains C code generated by itself:
873 ;; 'stalin-AMD64.c', etc.
874 (package
875 (name "stalin")
876 (version "0.11")
877 (source (origin
878 ;; Use Pearlmutter's upstream branch with AMD64 patches
879 ;; applied. Saves us from including those 20M! patches
880 ;; in Guix. For more info, see:
881 ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
882 (method git-fetch)
883 (uri (git-reference
884 (url "https://github.com/barak/stalin.git")
885 (commit commit)))
886 (file-name (string-append name "-" version "-checkout"))
887 (sha256
888 (base32
889 "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
890 (modules '((guix build utils)))
891 (snippet
892 ;; remove gc libs from build, we have them as input
893 '(begin
894 (delete-file "gc6.8.tar.gz")
895 (delete-file-recursively "benchmarks")
896 (substitute* "build"
897 ((".*gc6.8.*") "")
898 ((" cd \\.\\.") "")
899 ((".*B include/libgc.a") "")
900 ((".*make.*") ""))
901 #t))))
902 (build-system gnu-build-system)
903 (arguments
904 `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
905 #:phases
906 (modify-phases %standard-phases
907 (replace 'configure
908 (lambda* (#:key outputs #:allow-other-keys)
909 (let* ((out (assoc-ref outputs "out"))
910 (include-out (string-append out "/include")))
911 (invoke "./build")
912 (for-each (lambda (fname)
913 (install-file fname include-out))
914 (find-files "include"))
915 (substitute* "makefile"
916 (("\\./include") include-out))
917 (substitute* "post-make"
918 (("`pwd`") out))
919 #t)))
920 (delete 'check)
921 (replace 'install
922 (lambda* (#:key outputs #:allow-other-keys)
923 (let ((out (assoc-ref outputs "out")))
924 (install-file "stalin.1"
925 (string-append out "/share/man/man1"))
926 (install-file "stalin"
927 (string-append out "/bin"))
928 #t))))))
929 (inputs
930 `(("libx11" ,libx11)))
931 (propagated-inputs
932 `(("libgc" ,libgc)))
933 (supported-systems '("x86_64-linux"))
934 (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
935 (synopsis "Brutally efficient Scheme compiler")
936 (description
937 "Stalin is an aggressively optimizing whole-program compiler
938 for Scheme that does polyvariant interprocedural flow analysis,
939 flow-directed interprocedural escape analysis, flow-directed
940 lightweight CPS conversion, flow-directed lightweight closure
941 conversion, flow-directed interprocedural lifetime analysis, automatic
942 in-lining, unboxing, and flow-directed program-specific and
943 program-point-specific low-level representation selection and code
944 generation.")
945 (license gpl2+))))
946
947 (define-public femtolisp
948 (let ((commit "ec7601076a976f845bc05ad6bd3ed5b8cde58a97")
949 (revision "2"))
950 (package
951 (name "femtolisp")
952 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
953 (source (origin
954 (method git-fetch)
955 (uri (git-reference
956 (url "https://github.com/JeffBezanson/femtolisp.git")
957 (commit commit)))
958 (file-name (string-append name "-" version "-checkout"))
959 (sha256
960 (base32
961 "1fcyiqlqn27nd4wxi27km8mhmlzpzzsxzpwsl1bxbmhraq468njw"))))
962 ;; See "utils.h" for supported systems. Upstream bug:
963 ;; https://github.com/JeffBezanson/femtolisp/issues/25
964 (supported-systems
965 (fold delete %supported-systems
966 '("armhf-linux" "mips64el-linux" "aarch64-linux")))
967 (build-system gnu-build-system)
968 (arguments
969 `(#:make-flags '("CC=gcc" "release")
970 #:test-target "test"
971 #:phases
972 (modify-phases %standard-phases
973 (delete 'bootstrap)
974 (delete 'configure) ; No configure script
975 (replace 'install ; Makefile has no 'install phase
976 (lambda* (#:key outputs #:allow-other-keys)
977 (let* ((out (assoc-ref outputs "out"))
978 (bin (string-append out "/bin")))
979 (install-file "flisp" bin)
980 #t)))
981 ;; The flisp binary is now available, run bootstrap to
982 ;; generate flisp.boot and afterwards runs make test.
983 (add-after 'install 'bootstrap-gen-and-test
984 (lambda* (#:key outputs #:allow-other-keys)
985 (let* ((out (assoc-ref outputs "out"))
986 (bin (string-append out "/bin")))
987 (invoke "./bootstrap.sh")
988 (install-file "flisp.boot" bin)
989 #t))))))
990 (synopsis "Scheme-like lisp implementation")
991 (description
992 "@code{femtolisp} is a scheme-like lisp implementation with a
993 simple, elegant Scheme dialect. It is a lisp-1 with lexical scope.
994 The core is 12 builtin special forms and 33 builtin functions.")
995 (home-page "https://github.com/JeffBezanson/femtolisp")
996 (license bsd-3))))
997
998 (define-public gauche
999 (package
1000 (name "gauche")
1001 (version "0.9.9")
1002 (home-page "http://practical-scheme.net/gauche/index.html")
1003 (source
1004 (origin
1005 (method url-fetch)
1006 (uri (string-append
1007 "mirror://sourceforge/gauche/Gauche/Gauche-"
1008 version ".tgz"))
1009 (sha256
1010 (base32 "1yzpszhw52vkpr65r5d4khf3489mnnvnw58dd2wsvvx7499k5aac"))
1011 (modules '((guix build utils)))
1012 (snippet '(begin
1013 ;; Remove libatomic-ops.
1014 (delete-file-recursively "gc/libatomic_ops")
1015 #t))))
1016 (build-system gnu-build-system)
1017 (inputs
1018 `(("libatomic-ops" ,libatomic-ops)
1019 ("zlib" ,zlib)))
1020 (native-inputs
1021 `(("texinfo" ,texinfo)
1022 ("openssl" ,openssl) ; needed for tests
1023 ("pkg-config" ,pkg-config))) ; needed to find external libatomic-ops
1024 (arguments
1025 `(#:phases
1026 (modify-phases %standard-phases
1027 (add-after 'unpack 'patch-/bin/sh
1028 ;; Needed only for tests.
1029 (lambda _
1030 (substitute* '("configure"
1031 "test/www.scm"
1032 "ext/tls/test.scm"
1033 "gc/configure"
1034 "lib/gauche/configure.scm"
1035 "lib/gauche/package/util.scm"
1036 "lib/gauche/process.scm")
1037 (("/bin/sh") (which "sh")))
1038 #t))
1039 (add-after 'build 'build-doc
1040 (lambda _
1041 (with-directory-excursion "doc"
1042 (invoke "make" "info"))
1043 #t))
1044 (add-before 'check 'patch-normalize-test
1045 ;; Neutralize sys-normalize-pathname test as it relies on
1046 ;; the home directory; (setenv "HOME" xx) isn't enough).
1047 (lambda _
1048 (substitute* "test/system.scm"
1049 (("~/abc") "//abc"))
1050 #t))
1051 (add-before 'check 'patch-network-tests
1052 ;; Remove net checks.
1053 (lambda _
1054 (substitute* "ext/Makefile"
1055 (("binary net termios") "binary termios"))
1056 #t))
1057 (add-after 'install 'install-docs
1058 (lambda _
1059 (with-directory-excursion "doc"
1060 (invoke "make" "install"))
1061 #t)))))
1062 (synopsis "Scheme scripting engine")
1063 (description "Gauche is a R7RS Scheme scripting engine aiming at being a
1064 handy tool that helps programmers and system administrators to write small to
1065 large scripts quickly. Quick startup, built-in system interface, native
1066 multilingual support are some of the goals. Gauche comes with a package
1067 manager/installer @code{gauche-package} which can download, compile, install
1068 and list gauche extension packages.")
1069 (license bsd-3)))