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