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