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