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