Correct name and Email for ng0.
[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 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 '(for-each delete-file-recursively
216 '("gc" "gmp" "libuv")))))
217 (build-system gnu-build-system)
218 (arguments
219 `(#:test-target "test"
220 #:phases
221 (modify-phases %standard-phases
222 (replace 'configure
223 (lambda* (#:key inputs outputs #:allow-other-keys)
224
225 (substitute* "configure"
226 (("^shell=.*$")
227 (string-append "shell=" (which "bash") "\n"))
228 (("`date`") "0"))
229 (substitute* "autoconf/runtest.in"
230 ((", @DATE@") ""))
231 (substitute* "autoconf/osversion"
232 (("^version.*$") "version=\"\"\n"))
233 (substitute* "comptime/Makefile"
234 (("\\$\\(LDCOMPLIBS\\)")
235 "$(LDCOMPLIBS) $(LDFLAGS)"))
236
237 ;; The `configure' script doesn't understand options
238 ;; of those of Autoconf.
239 (let ((out (assoc-ref outputs "out")))
240 (invoke "./configure"
241 (string-append "--prefix=" out)
242 ; use system libraries
243 "--customgc=no"
244 "--customunistring=no"
245 "--customlibuv=no"
246 (string-append"--mv=" (which "mv"))
247 (string-append "--rm=" (which "rm"))
248 "--cflags=-fPIC"
249 (string-append "--ldflags=-Wl,-rpath="
250 (assoc-ref outputs "out")
251 "/lib/bigloo/" ,version)
252 (string-append "--lispdir=" out
253 "/share/emacs/site-lisp")
254 "--sharedbde=yes"
255 "--sharedcompiler=yes"
256 "--disable-patch"))))
257 (add-after 'install 'install-emacs-modes
258 (lambda* (#:key outputs #:allow-other-keys)
259 (let* ((out (assoc-ref outputs "out"))
260 (dir (string-append out "/share/emacs/site-lisp")))
261 (invoke "make" "-C" "bmacs" "all" "install"
262 (string-append "EMACSBRAND=emacs25")
263 (string-append "EMACSDIR=" dir))))))))
264 (inputs
265 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
266 ("libgc" ,libgc)
267 ("libunistring" ,libunistring)
268 ("libuv" ,libuv)
269 ("openssl" ,openssl)
270 ("sqlite" ,sqlite)
271
272 ;; Optional APIs for which Bigloo has bindings.
273 ("avahi" ,avahi)
274 ("libphidget" ,libphidget)
275 ("pcre" ,pcre)))
276 (native-inputs
277 `(("pkg-config" ,pkg-config)))
278 (propagated-inputs
279 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
280 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
281 (synopsis "Efficient Scheme compiler")
282 (description
283 "Bigloo is a Scheme implementation devoted to one goal: enabling
284 Scheme based programming style where C(++) is usually
285 required. Bigloo attempts to make Scheme practical by offering
286 features usually presented by traditional programming languages
287 but not offered by Scheme and functional programming. Bigloo
288 compiles Scheme modules. It delivers small and fast stand alone
289 binary executables. Bigloo enables full connections between
290 Scheme and C programs and between Scheme and Java programs.")
291 (license gpl2+)))
292
293 (define-public hop
294 (package
295 (name "hop")
296 (version "3.1.0-pre2")
297 (source (origin
298 (method url-fetch)
299 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
300 version ".tar.gz"))
301 (sha256
302 (base32
303 "09m7pahjsp7wxzd20cdph9j3mgf2nq5dyckcjljcd40m25v85kks"))))
304 (build-system gnu-build-system)
305 (arguments
306 `(#:test-target "test"
307 #:make-flags '("BIGLOO=bigloo")
308 #:parallel-build? #f
309 #:phases
310 (modify-phases %standard-phases
311 (replace 'configure
312 (lambda* (#:key inputs outputs #:allow-other-keys)
313 (let ((out (assoc-ref outputs "out")))
314 (zero?
315 (system* "./configure"
316 (string-append "--prefix=" out)
317 (string-append "--blflags="
318 ;; user flags completely override useful
319 ;; default flags, so repeat them here.
320 "-copt \\$(CPICFLAGS) "
321 "-L \\$(BUILDLIBDIR) "
322 "-ldopt -Wl,-rpath," out "/lib")))))))))
323 (inputs `(("avahi" ,avahi)
324 ("bigloo" ,bigloo)
325 ("libgc" ,libgc)
326 ("libunistring" ,libunistring)
327 ("libuv" ,libuv)
328 ("pcre" ,pcre)
329 ("sqlite" ,sqlite)
330 ("which" ,which)))
331 (home-page "http://hop.inria.fr/")
332 (synopsis "Multi-tier programming language for the Web 2.0")
333 (description
334 "HOP is a multi-tier programming language for the Web 2.0 and the
335 so-called diffuse Web. It is designed for programming interactive web
336 applications in many fields such as multimedia (web galleries, music players,
337 ...), ubiquitous and house automation (SmartPhones, personal appliance),
338 mashups, office (web agendas, mail clients, ...), etc.")
339 (license gpl2+)))
340
341 (define-public chicken
342 (package
343 (name "chicken")
344 (version "4.13.0")
345 (source (origin
346 (method url-fetch)
347 (uri (string-append "https://code.call-cc.org/releases/"
348 version "/chicken-" version ".tar.gz"))
349 (sha256
350 (base32
351 "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd"))))
352 (build-system gnu-build-system)
353 (arguments
354 `(#:modules ((guix build gnu-build-system)
355 (guix build utils)
356 (srfi srfi-1))
357
358 ;; No `configure' script; run "make check" after "make install" as
359 ;; prescribed by README.
360 #:phases
361 (modify-phases %standard-phases
362 (delete 'configure)
363 (delete 'check)
364 (add-after 'install 'check
365 (assoc-ref %standard-phases 'check)))
366
367 #:make-flags (let ((out (assoc-ref %outputs "out")))
368 (list "PLATFORM=linux"
369 (string-append "PREFIX=" out)
370 (string-append "VARDIR=" out "/var/lib")))
371
372 ;; Parallel builds are not supported, as noted in README.
373 #:parallel-build? #f))
374 (home-page "http://www.call-cc.org/")
375 (synopsis "R5RS Scheme implementation that compiles native code via C")
376 (description
377 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
378 produces portable and efficient C, supports almost all of the R5RS Scheme
379 language standard, and includes many enhancements and extensions.")
380 (license bsd-3)))
381
382 (define-public scheme48
383 (package
384 (name "scheme48")
385 (version "1.9.2")
386 (source (origin
387 (method url-fetch)
388 (uri (string-append "http://s48.org/" version
389 "/scheme48-" version ".tgz"))
390 (sha256
391 (base32
392 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
393 (patches (search-patches "scheme48-tests.patch"))))
394 (build-system gnu-build-system)
395 (home-page "http://s48.org/")
396 (synopsis "Scheme implementation using a bytecode interpreter")
397 (description
398 "Scheme 48 is an implementation of Scheme based on a byte-code
399 interpreter and is designed to be used as a testbed for experiments in
400 implementation techniques and as an expository tool.")
401
402 ;; Most files are BSD-3; see COPYING for the few exceptions.
403 (license bsd-3)))
404
405 (define-public racket
406 (package
407 (name "racket")
408 (version "6.11")
409 (source (origin
410 (method url-fetch)
411 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
412 version "/racket-" version "-src.tgz")
413 (string-append
414 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
415 version "/racket-" version "-src.tgz")))
416 (sha256
417 (base32
418 "1nk7705x24jjlbqqhj8yvbgqkfscxx3m81bry1g56kjxysjmf3sw"))))
419 (build-system gnu-build-system)
420 (arguments
421 '(#:phases
422 (modify-phases %standard-phases
423 (add-before 'configure 'pre-configure
424 (lambda* (#:key inputs #:allow-other-keys)
425 ;; Patch dynamically loaded libraries with their absolute paths.
426 (let* ((library-path (search-path-as-string->list
427 (getenv "LIBRARY_PATH")))
428 (find-so (lambda (soname)
429 (search-path
430 library-path
431 (format #f "~a.so" soname))))
432 (patch-ffi-libs (lambda (file libs)
433 (for-each
434 (lambda (lib)
435 (substitute* file
436 (((format #f "\"~a\"" lib))
437 (format #f "\"~a\"" (find-so lib)))))
438 libs))))
439 (substitute* "collects/db/private/sqlite3/ffi.rkt"
440 (("ffi-lib sqlite-so")
441 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
442 (substitute* "collects/openssl/libssl.rkt"
443 (("ffi-lib libssl-so")
444 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
445 (substitute* "collects/openssl/libcrypto.rkt"
446 (("ffi-lib libcrypto-so")
447 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
448 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
449 (("ffi-lib libgmp-so")
450 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
451 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
452 (("ffi-lib libmpfr-so")
453 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
454 (for-each
455 (lambda (x) (apply patch-ffi-libs x))
456 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
457 ("libfontconfig" "libcairo"))
458 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
459 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
460 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
461 ("libjpeg"))
462 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
463 ("libpango-1.0" "libpangocairo-1.0"))
464 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
465 ("libpng"))
466 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
467 ("libodbc"))
468 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
469 ("libX11"))
470 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
471 ("libgio-2.0"))
472 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
473 ("libgdk-3" "libgtk-3"))
474 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
475 ("libunique-1.0"))
476 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
477 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
478 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
479 ("libGL"))
480 ("share/pkgs/sgl/gl.rkt"
481 ("libGL" "libGLU")))))
482 (chdir "src")
483 #t))
484 (add-after 'unpack 'patch-/bin/sh
485 (lambda _
486 (substitute* "collects/racket/system.rkt"
487 (("/bin/sh") (which "sh")))
488 #t)))
489 #:tests? #f ; XXX: how to run them?
490 ))
491 (inputs
492 `(("libffi" ,libffi)
493 ;; Hardcode dynamically loaded libraries for better functionality.
494 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
495 ("cairo" ,cairo)
496 ("fontconfig" ,fontconfig)
497 ("glib" ,glib)
498 ("glu" ,glu)
499 ("gmp" ,gmp)
500 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
501 ("libjpeg" ,libjpeg)
502 ("libpng" ,libpng)
503 ("libx11" ,libx11)
504 ("mesa" ,mesa)
505 ("mpfr" ,mpfr)
506 ("openssl" ,openssl)
507 ("pango" ,pango)
508 ("sqlite" ,sqlite)
509 ("unixodbc" ,unixodbc)))
510 (home-page "http://racket-lang.org")
511 (synopsis "Implementation of Scheme and related languages")
512 (description
513 "Racket is an implementation of the Scheme programming language (R5RS and
514 R6RS) and related languages, such as Typed Racket. It features a compiler and
515 a virtual machine with just-in-time native compilation, as well as a large set
516 of libraries.")
517 (license lgpl2.0+)))
518
519 (define-public gambit-c
520 (package
521 (name "gambit-c")
522 (version "4.8.9")
523 (source
524 (origin
525 (method url-fetch)
526 (uri (string-append
527 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
528 (version-major+minor version) "/source/gambit-v"
529 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
530 ".tgz"))
531 (sha256
532 (base32 "16sg1s8myzxqpimj5ry6lfza0qfs157zj28bvmxwwgy89jd9m5v7"))))
533 (build-system gnu-build-system)
534 (arguments
535 '(#:configure-flags
536 ;; According to the ./configure script, this makes the build slower and
537 ;; use >= 1 GB memory, but makes Gambit much faster.
538 '("--enable-single-host")
539 #:phases
540 (modify-phases %standard-phases
541 (add-before 'check 'fix-tests
542 (lambda _
543 (substitute* '("tests/makefile")
544 ;; '-:' is how run-time options are set. 'tl' sets some terminal
545 ;; option, which makes it fail in our build environment. It
546 ;; recommends using 'd-' as a solution, which sets the REPL
547 ;; interaction channel to stdin/stdout.
548 (("gsi -:tl") "gsi -:d-,tl"))
549 #t)))))
550 (home-page "http://www.iro.umontreal.ca/~gambit/")
551 (synopsis "Efficient Scheme interpreter and compiler")
552 (description
553 "Gambit consists of two main programs: gsi, the Gambit Scheme
554 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
555 the complete execution and debugging environment. The compiler is the
556 interpreter extended with the capability of generating executable files. The
557 compiler can produce standalone executables or compiled modules which can be
558 loaded at run time. Interpreted code and compiled code can be freely
559 mixed.")
560 ;; Dual license.
561 (license (list lgpl2.1+ asl2.0))))
562
563 (define-public chibi-scheme
564 (package
565 (name "chibi-scheme")
566 (version "0.7.3")
567 (source
568 (origin
569 (method url-fetch)
570 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
571 version ".tar.gz"))
572 (sha256
573 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
574 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
575 (build-system gnu-build-system)
576 (arguments
577 `(#:phases (modify-phases %standard-phases
578 (delete 'configure)
579 (add-before 'build 'set-cc
580 (lambda _
581 (setenv "CC" "gcc"))))
582 #:make-flags (let ((out (assoc-ref %outputs "out")))
583 (list (string-append "PREFIX=" out)
584 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
585 #:test-target "test"))
586 (home-page "https://github.com/ashinn/chibi-scheme")
587 (synopsis "Small embeddable Scheme implementation")
588 (description
589 "Chibi-Scheme is a very small library with no external dependencies
590 intended for use as an extension and scripting language in C programs. In
591 addition to support for lightweight VM-based threads, each VM itself runs in
592 an isolated heap allowing multiple VMs to run simultaneously in different OS
593 threads.")
594 (license bsd-3)))
595
596 (define-public scmutils
597 (let ()
598 (define (system-suffix)
599 (cond
600 ((string-prefix? "x86_64" (or (%current-target-system)
601 (%current-system)))
602 "x86-64")
603 (else "i386")))
604
605 (package
606 (name "scmutils")
607 (version "20160827")
608 (source
609 (origin
610 (method url-fetch/tarbomb)
611 (modules '((guix build utils)))
612 (snippet
613 ;; Remove binary code
614 '(delete-file-recursively "scmutils/mit-scheme"))
615 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
616 "/scmutils-tarballs/" name "-" version
617 "-x86-64-gnu-linux.tar.gz"))
618 (sha256
619 (base32 "00ly5m0s4dy5kxravjaqlpii5zcnr6b9nqm0607lr7xcs52i4j8b"))))
620 (build-system gnu-build-system)
621 (inputs
622 `(("mit-scheme" ,mit-scheme)
623 ("emacs" ,emacs-minimal)))
624 (arguments
625 `(#:tests? #f ;; no tests-suite
626 #:modules ((guix build gnu-build-system)
627 (guix build utils)
628 (guix build emacs-utils))
629 #:imported-modules (,@%gnu-build-system-modules
630 (guix build emacs-utils))
631 #:phases
632 (modify-phases %standard-phases
633 (replace 'configure
634 ;; No standard build procedure is used. We set the correct
635 ;; runtime path in the custom build system.
636 (lambda* (#:key outputs #:allow-other-keys)
637 (let ((out (assoc-ref outputs "out")))
638 ;; Required to find .bci files at runtime.
639 (with-directory-excursion "scmutils"
640 (rename-file "src" "scmutils"))
641 (substitute* "scmutils/scmutils/load.scm"
642 (("/usr/local/scmutils/")
643 (string-append out "/lib/mit-scheme-"
644 ,(system-suffix) "/")))
645 #t)))
646 (replace 'build
647 ;; Compile the code and build a band.
648 (lambda* (#:key outputs #:allow-other-keys)
649 (let* ((out (assoc-ref outputs "out"))
650 (make-img (string-append
651 "echo '(load \"load\") "
652 "(disk-save \"edwin-mechanics.com\")'"
653 "| mit-scheme")))
654 (with-directory-excursion "scmutils/scmutils"
655 (and (zero? (system "mit-scheme < compile.scm"))
656 (zero? (system make-img)))))))
657 (add-before 'install 'fix-directory-names
658 ;; Correct directory names in the startup script.
659 (lambda* (#:key inputs outputs #:allow-other-keys)
660 (let* ((out (assoc-ref outputs "out"))
661 (scm-root (assoc-ref inputs "mit-scheme")))
662 (substitute* "bin/mechanics"
663 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
664 (string-append
665 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
666 "LIB=\"${ROOT}/lib/mit-scheme-"
667 ,(system-suffix) ":"
668 out "/lib/mit-scheme-" ,(system-suffix) "\""))
669 (("EDWIN_INFO_DIRECTORY=.*\n") "")
670 (("SCHEME=.*\n")
671 (string-append "SCHEME=\"${ROOT}/bin/scheme "
672 "--library ${LIB}\"\n"))
673 (("export EDWIN_INFO_DIRECTORY") ""))
674 #t)))
675 (add-before 'install 'emacs-tags
676 ;; Generate Emacs's tags for easy reference to source
677 ;; code.
678 (lambda* (#:key inputs outputs #:allow-other-keys)
679 (with-directory-excursion "scmutils/scmutils"
680 (zero? (apply system* "etags"
681 (find-files "." "\\.scm"))))))
682 (replace 'install
683 ;; Copy files to the store.
684 (lambda* (#:key outputs #:allow-other-keys)
685 (define* (copy-files-to-directory files dir
686 #:optional (delete? #f))
687 (for-each (lambda (f)
688 (copy-file f (string-append dir "/" f))
689 (when delete? (delete-file f)))
690 files))
691
692 (let* ((out (assoc-ref outputs "out"))
693 (bin (string-append out "/bin"))
694 (doc (string-append out "/share/doc/"
695 ,name "-" ,version))
696 (lib (string-append out "/lib/mit-scheme-"
697 ,(system-suffix)
698 "/scmutils")))
699 (for-each mkdir-p (list lib doc bin))
700 (with-directory-excursion "scmutils/scmutils"
701 (copy-files-to-directory '("COPYING" "LICENSE")
702 doc #t)
703 (for-each delete-file (find-files "." "\\.bin"))
704 (copy-files-to-directory '("edwin-mechanics.com")
705 (string-append lib "/..") #t)
706 (copy-recursively "." lib))
707 (with-directory-excursion "bin"
708 (copy-files-to-directory (find-files ".") bin))
709 (with-directory-excursion "scmutils/manual"
710 (copy-files-to-directory (find-files ".") doc))
711 #t)))
712 (add-after 'install 'emacs-helpers
713 ;; Add convenience Emacs commands to easily load the
714 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
715 ;; and to easily load code tags.
716 (lambda* (#:key inputs outputs #:allow-other-keys)
717 (let* ((out (assoc-ref outputs "out"))
718 (mit-root (assoc-ref inputs "mit-scheme"))
719 (emacs-lisp-dir
720 (string-append out "/share/emacs/site-lisp"
721 "/guix.d/" ,name "-" ,version))
722 (el-file (string-append emacs-lisp-dir
723 "/scmutils.el"))
724 (lib-relative-path
725 (string-append "/lib/mit-scheme-"
726 ,(system-suffix))))
727 (mkdir-p emacs-lisp-dir)
728 (call-with-output-file el-file
729 (lambda (p)
730 (format p
731 ";;;###autoload
732 (defun scmutils-load ()
733 (interactive)
734 (require 'xscheme)
735 (let ((mit-root \"~a\")
736 (scmutils \"~a\"))
737 (run-scheme
738 (concat mit-root \"/bin/scheme --library \"
739 mit-root \"~a:\" scmutils \"~a\"
740 \" --band edwin-mechanics.com\"
741 \" --emacs\"))))
742
743 ;;;###autoload
744 (defun scmutils-load-tags ()
745 (interactive)
746 (let ((scmutils \"~a\"))
747 (visit-tags-table (concat scmutils \"/TAGS\"))))
748 "
749 mit-root out
750 lib-relative-path
751 lib-relative-path
752 (string-append out lib-relative-path
753 "/scmutils"))))
754 (emacs-generate-autoloads ,name emacs-lisp-dir)
755 (emacs-byte-compile-directory emacs-lisp-dir)
756 #t))))))
757 (home-page
758 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
759 (synopsis "Scmutils library for MIT Scheme")
760 (description "The Scmutils system is an integrated library of
761 procedures, embedded in the programming language Scheme, and intended to
762 support teaching and research in mathematical physics and electrical
763 engineering.")
764 (license gpl2+))))
765
766 (define-public sicp
767 (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
768 (package
769 (name "sicp")
770 (version (string-append "20170703-1." (string-take commit 7)))
771 (source (origin
772 (method git-fetch)
773 (uri (git-reference
774 (url "https://github.com/sarabander/sicp")
775 (commit commit)))
776 (sha256
777 (base32
778 "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
779 (file-name (string-append name "-" version "-checkout"))))
780 (build-system trivial-build-system)
781 (native-inputs `(("gzip" ,gzip)
782 ("source" ,source)
783 ("texinfo" ,texinfo)))
784 (arguments
785 `(#:modules ((guix build utils)
786 (srfi srfi-1)
787 (srfi srfi-26))
788 #:builder
789 (begin
790 (use-modules (guix build utils)
791 (srfi srfi-1)
792 (srfi srfi-26))
793 (let ((gzip (assoc-ref %build-inputs "gzip"))
794 (source (assoc-ref %build-inputs "source"))
795 (texinfo (assoc-ref %build-inputs "texinfo"))
796 (html-dir (string-append %output "/share/doc/" ,name "/html"))
797 (info-dir (string-append %output "/share/info")))
798 (copy-recursively (string-append source "/html") html-dir)
799 (setenv "PATH" (string-append gzip "/bin"
800 ":" texinfo "/bin"))
801 (mkdir-p info-dir)
802 (and (zero?
803 (system* "makeinfo" "--output"
804 (string-append info-dir "/sicp.info")
805 (string-append source "/sicp-pocket.texi")))
806 (every zero?
807 (map (cut system* "gzip" "-9n" <>)
808 (find-files info-dir))))))))
809 (home-page "https://sarabander.github.io/sicp")
810 (synopsis "Structure and Interpretation of Computer Programs")
811 (description "Structure and Interpretation of Computer Programs (SICP) is
812 a textbook aiming to teach the principles of computer programming.
813
814 Using Scheme, a dialect of the Lisp programming language, the book explains
815 core computer science concepts such as abstraction in programming,
816 metalinguistic abstraction, recursion, interpreters, and modular programming.")
817 (license cc-by-sa4.0))))
818
819 (define-public scheme48-rx
820 (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
821 (revision "2"))
822 (package
823 (name "scheme48-rx")
824 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
825 (source
826 (origin
827 (method git-fetch)
828 (uri (git-reference
829 (url "https://github.com/scheme/rx")
830 (commit commit)))
831 (sha256
832 (base32
833 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
834 (file-name (string-append name "-" version "-checkout"))))
835 (build-system trivial-build-system)
836 (arguments
837 `(#:modules ((guix build utils))
838 #:builder
839 (begin
840 (use-modules (guix build utils))
841 (let ((share (string-append %output
842 "/share/scheme48-"
843 ,(package-version scheme48)
844 "/rx")))
845 (chdir (assoc-ref %build-inputs "source"))
846 (mkdir-p share)
847 (copy-recursively "." share)))))
848 (native-inputs
849 `(("source" ,source)
850 ("scheme48" ,scheme48)))
851 (home-page "https://github.com/scheme/rx/")
852 (synopsis "SRE String pattern-matching library for scheme48")
853 (description
854 "String pattern-matching library for scheme48 based on the SRE
855 regular-expression notation.")
856 (license bsd-3))))
857
858 (define-public slib
859 (package
860 (name "slib")
861 (version "3b5")
862 (source (origin
863 (method url-fetch)
864 (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
865 version ".zip"))
866 (sha256
867 (base32
868 "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
869 (build-system gnu-build-system)
870 (arguments
871 `(#:tests? #f ; There is no check target.
872 #:phases
873 (modify-phases %standard-phases
874 (add-after 'install 'remove-bin-share
875 (lambda* (#:key inputs outputs #:allow-other-keys)
876 (delete-file-recursively
877 (string-append (assoc-ref outputs "out") "/bin"))))
878 (replace 'configure
879 (lambda* (#:key inputs outputs #:allow-other-keys)
880 (zero? (system* "./configure"
881 (string-append "--prefix="
882 (assoc-ref outputs "out")))))))))
883 (native-inputs `(("unzip" ,unzip)
884 ("texinfo" ,texinfo)))
885 (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
886 (synopsis "Compatibility and utility library for Scheme")
887 (description "SLIB is a portable Scheme library providing compatibility and
888 utility functions for all standard Scheme implementations.")
889 (license (non-copyleft
890 "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
891 "Or see COPYING in the distribution."))))
892
893 (define-public scm
894 (package
895 (name "scm")
896 (version "5f2")
897 (source (origin
898 (method url-fetch)
899 (uri (string-append
900 "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
901 version ".zip"))
902 (sha256
903 (base32
904 "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
905 (build-system gnu-build-system)
906 (arguments
907 `(#:phases
908 (modify-phases %standard-phases
909 (replace 'configure
910 (lambda* (#:key inputs outputs #:allow-other-keys)
911 (zero? (system* "./configure"
912 (string-append "--prefix="
913 (assoc-ref outputs "out"))))))
914 (add-before 'build 'pre-build
915 (lambda* (#:key inputs #:allow-other-keys)
916 (substitute* "Makefile"
917 (("ginstall-info") "install-info"))))
918 (replace 'build
919 (lambda* (#:key inputs outputs #:allow-other-keys)
920 (setenv "SCHEME_LIBRARY_PATH"
921 (string-append (assoc-ref inputs "slib")
922 "/lib/slib/"))
923 (and
924 (zero? (system* "make" "scmlit" "CC=gcc"))
925 (zero? (system* "make" "all")))))
926 (add-after 'install 'post-install
927 (lambda* (#:key inputs outputs #:allow-other-keys)
928 (let ((req
929 (string-append (assoc-ref outputs "out")
930 "/lib/scm/require.scm")))
931 (and
932 (delete-file req)
933 (format (open req (logior O_WRONLY O_CREAT))
934 "(define (library-vicinity) ~s)\n"
935 (string-append (assoc-ref inputs "slib")
936 "/lib/slib/"))
937
938 ;; We must generate the slibcat file
939 (zero? (system*
940 (string-append
941 (assoc-ref outputs "out")
942 "/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+)))