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