gnu: chez-scheme: Move to new module.
[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 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages scheme)
26 #:use-module (gnu packages)
27 #:use-module ((guix licenses)
28 #:select (gpl2+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3
29 cc-by-sa4.0))
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix utils)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system trivial)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages m4)
38 #:use-module (gnu packages multiprecision)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages emacs)
42 #:use-module (gnu packages ghostscript)
43 #:use-module (gnu packages netpbm)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages tex)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages avahi)
50 #:use-module (gnu packages libphidget)
51 #:use-module (gnu packages gcc)
52 #:use-module (gnu packages glib)
53 #:use-module (gnu packages gtk)
54 #:use-module (gnu packages libffi)
55 #:use-module (gnu packages fontutils)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages xorg)
58 #:use-module (gnu packages tls)
59 #:use-module (gnu packages gl)
60 #:use-module (ice-9 match))
61
62 (define (mit-scheme-source-directory system version)
63 (string-append "mit-scheme-"
64 (if (or (string-prefix? "x86_64" system)
65 (string-prefix? "i686" system))
66 ""
67 "c-")
68 version))
69
70 (define-public mit-scheme
71 (package
72 (name "mit-scheme")
73 (version "9.2")
74 (source #f) ; see below
75 (outputs '("out" "doc"))
76 (build-system gnu-build-system)
77 (arguments
78 `(#:tests? #f ; no "check" target
79 #:modules ((guix build gnu-build-system)
80 (guix build utils)
81 (srfi srfi-1))
82 #:phases
83 (modify-phases %standard-phases
84 (replace 'unpack
85 (lambda* (#:key inputs #:allow-other-keys)
86 (and (zero? (system* "tar" "xzvf"
87 (assoc-ref inputs "source")))
88 (chdir ,(mit-scheme-source-directory (%current-system)
89 version))
90 (begin
91 ;; Delete these dangling symlinks since they break
92 ;; `patch-shebangs'.
93 (for-each delete-file
94 (append '("src/lib/shim-config.scm")
95 (find-files "src/lib/lib" "\\.so$")
96 (find-files "src/lib" "^liarc-")
97 (find-files "src/compiler" "^make\\.")))
98 (chdir "src")
99 #t))))
100 (replace 'build
101 (lambda* (#:key system outputs #:allow-other-keys)
102 (let ((out (assoc-ref outputs "out")))
103 (if (or (string-prefix? "x86_64" system)
104 (string-prefix? "i686" system))
105 (zero? (system* "make" "compile-microcode"))
106 (zero? (system* "./etc/make-liarc.sh"
107 (string-append "--prefix=" out)))))))
108 (add-after 'configure 'configure-doc
109 (lambda* (#:key outputs inputs #:allow-other-keys)
110 (with-directory-excursion "../doc"
111 (let* ((out (assoc-ref outputs "out"))
112 (bash (assoc-ref inputs "bash"))
113 (bin/sh (string-append bash "/bin/sh")))
114 (system* bin/sh "./configure"
115 (string-append "--prefix=" out)
116 (string-append "SHELL=" bin/sh))
117 (substitute* '("Makefile" "make-common")
118 (("/lib/mit-scheme/doc")
119 (string-append "/share/doc/" ,name "-" ,version)))
120 #t))))
121 (add-after 'build 'build-doc
122 (lambda* _
123 (with-directory-excursion "../doc"
124 (zero? (system* "make")))))
125 (add-after 'install 'install-doc
126 (lambda* (#:key outputs #:allow-other-keys)
127 (let* ((out (assoc-ref outputs "out"))
128 (doc (assoc-ref outputs "doc"))
129 (old-doc-dir (string-append out "/share/doc"))
130 (new-doc/mit-scheme-dir
131 (string-append doc "/share/doc/" ,name "-" ,version)))
132 (with-directory-excursion "../doc"
133 (for-each (lambda (target)
134 (system* "make" target))
135 '("install-config" "install-info-gz" "install-man"
136 "install-html" "install-pdf")))
137 (mkdir-p new-doc/mit-scheme-dir)
138 (copy-recursively
139 (string-append old-doc-dir "/" ,name "-" ,version)
140 new-doc/mit-scheme-dir)
141 (delete-file-recursively old-doc-dir)
142 #t))))))
143 (native-inputs
144 `(("texlive" ,texlive)
145 ("texinfo" ,texinfo)
146 ("m4" ,m4)))
147 (inputs
148 `(("libx11" ,libx11)
149
150 ("source"
151
152 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
153 ;; compile from the architecture-specific tarballs, which contain
154 ;; pre-built binaries. It leads to more efficient code than when
155 ;; building the tarball that contains generated C code instead of
156 ;; those binaries.
157 ,(origin
158 (method url-fetch)
159 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
160 version "/mit-scheme-"
161 (match (%current-system)
162 ("x86_64-linux"
163 (string-append version "-x86-64"))
164 ("i686-linux"
165 (string-append version "-i386"))
166 (_
167 (string-append "c-" version)))
168 ".tar.gz"))
169 (sha256
170 (match (%current-system)
171 ("x86_64-linux"
172 (base32
173 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
174 ("i686-linux"
175 (base32
176 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
177 (_
178 (base32
179 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
180
181 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
182 (supported-systems (delete "mips64el-linux" %supported-systems))
183
184 (home-page "http://www.gnu.org/software/mit-scheme/")
185 (synopsis "A Scheme implementation with integrated editor and debugger")
186 (description
187 "GNU/MIT Scheme is an implementation of the Scheme programming
188 language. It provides an interpreter, a compiler and a debugger. It also
189 features an integrated Emacs-like editor and a large runtime library.")
190 (license gpl2+)
191 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
192
193 (define-public bigloo
194 (package
195 (name "bigloo")
196 (version "4.1a")
197 (source (origin
198 (method url-fetch)
199 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
200 version ".tar.gz"))
201 (sha256
202 (base32
203 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
204 (patches (search-patches "bigloo-gc-shebangs.patch"))))
205 (build-system gnu-build-system)
206 (arguments
207 `(#:test-target "test"
208 #:phases (alist-replace
209 'configure
210 (lambda* (#:key outputs #:allow-other-keys)
211
212 (substitute* "configure"
213 (("^shell=.*$")
214 (string-append "shell=" (which "bash") "\n")))
215
216 ;; Since libgc's pthread redirects are used, we end up
217 ;; using libgc symbols, so we must link against it.
218 ;; Reported on 2013-06-25.
219 (substitute* "api/pthread/src/Makefile"
220 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
221 (string-append "EXTRALIBS = "
222 (string-trim-right value)
223 " -l$(GCLIB)_fth-$(RELEASE)"
224 " -Wl,-rpath=" (assoc-ref outputs "out")
225 "/lib/bigloo/" ,version)))
226
227 ;; Those variables are used by libgc's `configure'.
228 (setenv "SHELL" (which "sh"))
229 (setenv "CONFIG_SHELL" (which "sh"))
230
231 ;; ... but they turned out to be overridden later, so work
232 ;; around that.
233 (substitute* (find-files "gc" "^configure-gc")
234 (("sh=/bin/sh")
235 (string-append "sh=" (which "sh"))))
236
237 ;; The `configure' script doesn't understand options
238 ;; of those of Autoconf.
239 (let ((out (assoc-ref outputs "out")))
240 (zero?
241 (system* "./configure"
242 (string-append "--prefix=" out)
243 ;; FIXME: Currently fails, see
244 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
245 ;; "--customgc=no" ; use our libgc
246 (string-append"--mv=" (which "mv"))
247 (string-append "--rm=" (which "rm"))
248 (string-append "--ldflags=-Wl,-rpath="
249 (assoc-ref outputs "out")
250 "/lib/bigloo/" ,version)))))
251 (alist-cons-after
252 '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=emacs24")
258 (string-append "EMACSDIR=" dir)))))
259 %standard-phases))))
260 (inputs
261 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
262
263 ;; Optional APIs for which Bigloo has bindings.
264 ("avahi" ,avahi)
265 ("libphidget" ,libphidget)))
266 (native-inputs
267 `(("pkg-config" ,pkg-config)))
268 (propagated-inputs
269 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
270 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
271 (synopsis "Efficient Scheme compiler")
272 (description
273 "Bigloo is a Scheme implementation devoted to one goal: enabling
274 Scheme based programming style where C(++) is usually
275 required. Bigloo attempts to make Scheme practical by offering
276 features usually presented by traditional programming languages
277 but not offered by Scheme and functional programming. Bigloo
278 compiles Scheme modules. It delivers small and fast stand alone
279 binary executables. Bigloo enables full connections between
280 Scheme and C programs and between Scheme and Java programs.")
281 (license gpl2+)))
282
283 (define-public hop
284 (package
285 (name "hop")
286 (version "2.4.0")
287 (source (origin
288 (method url-fetch)
289 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
290 version ".tar.gz"))
291 (sha256
292 (base32
293 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
294 (patches (search-patches "hop-bigloo-4.0b.patch"
295 "hop-linker-flags.patch"))))
296 (build-system gnu-build-system)
297 (arguments
298 `(#:phases
299 (alist-replace
300 'configure
301 (lambda* (#:key outputs #:allow-other-keys)
302 (let ((out (assoc-ref outputs "out")))
303 (zero?
304 (system* "./configure"
305 (string-append "--prefix=" out)
306 (string-append "--blflags="
307 ;; user flags completely override useful
308 ;; default flags, so repeat them here.
309 "-copt \\$(CPICFLAGS) -L\\$(BUILDLIBDIR) "
310 "-ldopt -Wl,-rpath," out "/lib")))))
311 %standard-phases)
312 #:tests? #f)) ; no test suite
313 (inputs `(("avahi" ,avahi)
314 ("bigloo" ,bigloo)
315 ("which" ,which)))
316 (home-page "http://hop.inria.fr/")
317 (synopsis "Multi-tier programming language for the Web 2.0")
318 (description
319 "HOP is a multi-tier programming language for the Web 2.0 and the
320 so-called diffuse Web. It is designed for programming interactive web
321 applications in many fields such as multimedia (web galleries, music players,
322 ...), ubiquitous and house automation (SmartPhones, personal appliance),
323 mashups, office (web agendas, mail clients, ...), etc.")
324 (license gpl2+)))
325
326 (define-public chicken
327 (package
328 (name "chicken")
329 (version "4.11.0")
330 (source (origin
331 (method url-fetch)
332 (uri (string-append "http://code.call-cc.org/releases/"
333 version "/chicken-" version ".tar.gz"))
334 (sha256
335 (base32
336 "12ddyiikqknpr8h6llsxbg2fz75xnayvcnsvr1cwv8xnjn7jpp73"))))
337 (build-system gnu-build-system)
338 (arguments
339 `(#:modules ((guix build gnu-build-system)
340 (guix build utils)
341 (srfi srfi-1))
342
343 ;; No `configure' script; run "make check" after "make install" as
344 ;; prescribed by README.
345 #:phases
346 (modify-phases %standard-phases
347 (delete 'configure)
348 (delete 'check)
349 (add-after 'install 'check
350 (assoc-ref %standard-phases 'check))
351 (add-after 'unpack 'disable-broken-tests
352 (lambda _
353 ;; The port tests fail with this error:
354 ;; Error: (line 294) invalid escape-sequence '\x o'
355 (substitute* "tests/runtests.sh"
356 (("\\$interpret -s port-tests\\.scm") ""))
357 #t)))
358
359 #:make-flags (let ((out (assoc-ref %outputs "out")))
360 (list "PLATFORM=linux"
361 (string-append "PREFIX=" out)
362 (string-append "VARDIR=" out "/var/lib")))
363
364 ;; Parallel builds are not supported, as noted in README.
365 #:parallel-build? #f))
366 ;; One of the tests ("testing direct invocation can detect calls of too
367 ;; many arguments...") times out when building with a more recent GCC.
368 ;; The problem was reported here:
369 ;; https://lists.gnu.org/archive/html/chicken-hackers/2015-04/msg00059.html
370 (native-inputs
371 `(("gcc" ,gcc-4.8)))
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.6")
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 "1kzdi1n6h6hmz8zd9k8r5a5yp2ryi4w3c2fjm1k6cqicn18cwaxz"))))
417 (build-system gnu-build-system)
418 (arguments
419 '(#:phases
420 (alist-cons-before
421 '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 (alist-cons-after
482 'unpack 'patch-/bin/sh
483 (lambda _
484 (substitute* "collects/racket/system.rkt"
485 (("/bin/sh") (which "sh"))))
486 %standard-phases))
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.7.4")
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/gambc-v"
527 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
528 ".tgz"))
529 (sha256
530 (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs"))))
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 (alist-cons-before
539 '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 %standard-phases)))
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://code.google.com/p/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 (file-name (string-append name "-" version ".tar.gz"))
614 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
615 "/scmutils-tarballs/" name "-" version
616 "-x86-64-gnu-linux.tar.gz"))
617 (sha256
618 (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
619 (build-system gnu-build-system)
620 (inputs
621 `(("mit-scheme" ,mit-scheme)
622 ("emacs" ,emacs-minimal)))
623 (arguments
624 `(#:tests? #f ;; no tests-suite
625 #:modules ((guix build gnu-build-system)
626 (guix build utils)
627 (guix build emacs-utils))
628 #:imported-modules (,@%gnu-build-system-modules
629 (guix build emacs-utils))
630 #:phases
631 (modify-phases %standard-phases
632 (replace 'configure
633 ;; No standard build procedure is used. We set the correct
634 ;; runtime path in the custom build system.
635 (lambda* (#:key outputs #:allow-other-keys)
636 (let ((out (assoc-ref outputs "out")))
637 ;; Required to find .bci files at runtime.
638 (with-directory-excursion "scmutils"
639 (rename-file "src" "scmutils"))
640 (substitute* "scmutils/scmutils/load.scm"
641 (("/usr/local/scmutils/")
642 (string-append out "/lib/mit-scheme-"
643 ,(system-suffix) "/")))
644 #t)))
645 (replace 'build
646 ;; Compile the code and build a band.
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let* ((out (assoc-ref outputs "out"))
649 (make-img (string-append
650 "echo '(load \"load\") "
651 "(disk-save \"edwin-mechanics.com\")'"
652 "| mit-scheme")))
653 (with-directory-excursion "scmutils/scmutils"
654 (and (zero? (system "mit-scheme < compile.scm"))
655 (zero? (system make-img)))))))
656 (add-before 'install 'fix-directory-names
657 ;; Correct directory names in the startup script.
658 (lambda* (#:key inputs outputs #:allow-other-keys)
659 (let* ((out (assoc-ref outputs "out"))
660 (scm-root (assoc-ref inputs "mit-scheme")))
661 (substitute* "bin/mechanics"
662 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
663 (string-append
664 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
665 "LIB=\"${ROOT}/lib/mit-scheme-"
666 ,(system-suffix) ":"
667 out "/lib/mit-scheme-" ,(system-suffix) "\""))
668 (("EDWIN_INFO_DIRECTORY=.*\n") "")
669 (("SCHEME=.*\n")
670 (string-append "SCHEME=\"${ROOT}/bin/scheme "
671 "--library ${LIB}\"\n"))
672 (("export EDWIN_INFO_DIRECTORY") ""))
673 #t)))
674 (add-before 'install 'emacs-tags
675 ;; Generate Emacs's tags for easy reference to source
676 ;; code.
677 (lambda* (#:key inputs outputs #:allow-other-keys)
678 (with-directory-excursion "scmutils/scmutils"
679 (zero? (apply system* "etags"
680 (find-files "." "\\.scm"))))))
681 (replace 'install
682 ;; Copy files to the store.
683 (lambda* (#:key outputs #:allow-other-keys)
684 (define* (copy-files-to-directory files dir
685 #:optional (delete? #f))
686 (for-each (lambda (f)
687 (copy-file f (string-append dir "/" f))
688 (when delete? (delete-file f)))
689 files))
690
691 (let* ((out (assoc-ref outputs "out"))
692 (bin (string-append out "/bin"))
693 (doc (string-append out "/share/doc/"
694 ,name "-" ,version))
695 (lib (string-append out "/lib/mit-scheme-"
696 ,(system-suffix)
697 "/scmutils")))
698 (for-each mkdir-p (list lib doc bin))
699 (with-directory-excursion "scmutils/scmutils"
700 (copy-files-to-directory '("COPYING" "LICENSE")
701 doc #t)
702 (for-each delete-file (find-files "." "\\.bin"))
703 (copy-files-to-directory '("edwin-mechanics.com")
704 (string-append lib "/..") #t)
705 (copy-recursively "." lib))
706 (with-directory-excursion "bin"
707 (copy-files-to-directory (find-files ".") bin))
708 (with-directory-excursion "scmutils/manual"
709 (copy-files-to-directory (find-files ".") doc))
710 #t)))
711 (add-after 'install 'emacs-helpers
712 ;; Add convenience Emacs commands to easily load the
713 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
714 ;; and to easily load code tags.
715 (lambda* (#:key inputs outputs #:allow-other-keys)
716 (let* ((out (assoc-ref outputs "out"))
717 (mit-root (assoc-ref inputs "mit-scheme"))
718 (emacs-lisp-dir
719 (string-append out "/share/emacs/site-lisp"
720 "/guix.d/" ,name "-" ,version))
721 (el-file (string-append emacs-lisp-dir
722 "/scmutils.el"))
723 (lib-relative-path
724 (string-append "/lib/mit-scheme-"
725 ,(system-suffix))))
726 (mkdir-p emacs-lisp-dir)
727 (call-with-output-file el-file
728 (lambda (p)
729 (format p
730 ";;;###autoload
731 (defun scmutils-load ()
732 (interactive)
733 (require 'xscheme)
734 (let ((mit-root \"~a\")
735 (scmutils \"~a\"))
736 (run-scheme
737 (concat mit-root \"/bin/scheme --library \"
738 mit-root \"~a:\" scmutils \"~a\"
739 \" --band edwin-mechanics.com\"
740 \" --emacs\"))))
741
742 ;;;###autoload
743 (defun scmutils-load-tags ()
744 (interactive)
745 (let ((scmutils \"~a\"))
746 (visit-tags-table (concat scmutils \"/TAGS\"))))
747 "
748 mit-root out
749 lib-relative-path
750 lib-relative-path
751 (string-append out lib-relative-path
752 "/scmutils"))))
753 (emacs-generate-autoloads ,name emacs-lisp-dir)
754 (emacs-byte-compile-directory emacs-lisp-dir)
755 #t))))))
756 (home-page
757 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
758 (synopsis "Scmutils library for MIT Scheme")
759 (description "The Scmutils system is an integrated library of
760 procedures, embedded in the programming language Scheme, and intended to
761 support teaching and research in mathematical physics and electrical
762 engineering.")
763 (license gpl2+))))
764
765 (define-public sicp
766 (let ((commit "5b52db566968d28a89fbbaf338d207f01cc81cac"))
767 (package
768 (name "sicp")
769 (version (string-append "20160220-1." (string-take commit 7)))
770 (source (origin
771 (method git-fetch)
772 (uri (git-reference
773 (url "https://github.com/sarabander/sicp")
774 (commit commit)))
775 (sha256
776 (base32
777 "10h6h7szwlfbshwh18bnl2hvyddj5i7106l79s145l0sjjv15cxb"))
778 (file-name (string-append name "-" version "-checkout"))))
779 (build-system trivial-build-system)
780 (native-inputs `(("gzip" ,gzip)
781 ("source" ,source)
782 ("texinfo" ,texinfo)))
783 (arguments
784 `(#:modules ((guix build utils)
785 (srfi srfi-1)
786 (srfi srfi-26))
787 #:builder
788 (begin
789 (use-modules (guix build utils)
790 (srfi srfi-1)
791 (srfi srfi-26))
792 (let ((gzip (assoc-ref %build-inputs "gzip"))
793 (source (assoc-ref %build-inputs "source"))
794 (texinfo (assoc-ref %build-inputs "texinfo"))
795 (info-dir (string-append %output "/share/info")))
796 (setenv "PATH" (string-append gzip "/bin"
797 ":" texinfo "/bin"))
798 (mkdir-p info-dir)
799 (and (zero?
800 (system* "makeinfo" "--output"
801 (string-append info-dir "/sicp.info")
802 (string-append source "/sicp-pocket.texi")))
803 (every zero?
804 (map (cut system* "gzip" "-9n" <>)
805 (find-files info-dir))))))))
806 (home-page "http://sarabander.github.io/sicp")
807 (synopsis "Structure and Interpretation of Computer Programs")
808 (description "Structure and Interpretation of Computer Programs (SICP) is
809 a textbook aiming to teach the principles of computer programming.
810
811 Using Scheme, a dialect of the Lisp programming language, the book explains
812 core computer science concepts such as abstraction in programming,
813 metalinguistic abstraction, recursion, interpreters, and modular programming.")
814 (license cc-by-sa4.0))))