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