gnu: guix: Update to 0.10.0.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
CommitLineData
e117772d 1;;; GNU Guix --- Functional package management for GNU
d3206af6 2;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
07f4aef0 3;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
c093f9f6 4;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
d0d94110 5;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
e117772d
LC
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
1ffa7090 22(define-module (gnu packages scheme)
59a43334 23 #:use-module (gnu packages)
e117772d
LC
24 #:use-module (guix licenses)
25 #:use-module (guix packages)
26 #:use-module (guix download)
07f4aef0 27 #:use-module (guix utils)
e117772d 28 #:use-module (guix build-system gnu)
1ffa7090
LC
29 #:use-module (gnu packages m4)
30 #:use-module (gnu packages multiprecision)
d3206af6 31 #:use-module (gnu packages databases)
1ffa7090
LC
32 #:use-module (gnu packages emacs)
33 #:use-module (gnu packages texinfo)
f163c290 34 #:use-module (gnu packages texlive)
ce0614dd 35 #:use-module (gnu packages base)
cf53ecf5
LC
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages avahi)
38 #:use-module (gnu packages libphidget)
ffc13e75 39 #:use-module (gnu packages gcc)
30645251 40 #:use-module (gnu packages glib)
9d3c4dae 41 #:use-module (gnu packages gtk)
30645251 42 #:use-module (gnu packages libffi)
d3206af6 43 #:use-module (gnu packages fontutils)
e55354b8 44 #:use-module (gnu packages image)
bc11c72c 45 #:use-module (gnu packages xorg)
e117772d
LC
46 #:use-module (ice-9 match))
47
a0efb39a 48(define (mit-scheme-source-directory system version)
ecb26c10
AE
49 (string-append "mit-scheme-"
50 (if (or (string-prefix? "x86_64" system)
a0efb39a 51 (string-prefix? "i686" system))
ecb26c10
AE
52 ""
53 "c-")
54 version))
55
e117772d
LC
56(define-public mit-scheme
57 (package
58 (name "mit-scheme")
6c4a2884 59 (version "9.2")
e117772d 60 (source #f) ; see below
f163c290 61 (outputs '("out" "doc"))
e117772d
LC
62 (build-system gnu-build-system)
63 (arguments
64 `(#:tests? #f ; no "check" target
f163c290
FB
65 #:modules ((guix build gnu-build-system)
66 (guix build utils)
67 (srfi srfi-1))
e117772d 68 #:phases
af00e633
FB
69 (modify-phases %standard-phases
70 (replace 'unpack
71 (lambda* (#:key inputs #:allow-other-keys)
72 (and (zero? (system* "tar" "xzvf"
73 (assoc-ref inputs "source")))
74 (chdir ,(mit-scheme-source-directory (%current-system)
75 version))
76 (begin
77 ;; Delete these dangling symlinks since they break
78 ;; `patch-shebangs'.
79 (for-each delete-file
80 (append '("src/lib/shim-config.scm")
81 (find-files "src/lib/lib" "\\.so$")
82 (find-files "src/lib" "^liarc-")
83 (find-files "src/compiler" "^make\\.")))
84 (chdir "src")
85 #t))))
86 (replace 'build
87 (lambda* (#:key system outputs #:allow-other-keys)
88 (let ((out (assoc-ref outputs "out")))
89 (if (or (string-prefix? "x86_64" system)
90 (string-prefix? "i686" system))
91 (zero? (system* "make" "compile-microcode"))
92 (zero? (system* "./etc/make-liarc.sh"
f163c290
FB
93 (string-append "--prefix=" out)))))))
94 (add-after 'configure 'configure-doc
95 (lambda* (#:key outputs inputs #:allow-other-keys)
96 (with-directory-excursion "../doc"
97 (let* ((out (assoc-ref outputs "out"))
98 (bash (assoc-ref inputs "bash"))
99 (bin/sh (string-append bash "/bin/sh")))
100 (system* bin/sh "./configure"
101 (string-append "--prefix=" out)
102 (string-append "SHELL=" bin/sh))
103 (substitute* '("Makefile" "make-common")
104 (("/lib/mit-scheme/doc")
105 (string-append "/share/doc/" ,name "-" ,version)))
106 #t))))
107 (add-after 'build 'build-doc
108 (lambda* _
109 (with-directory-excursion "../doc"
110 (zero? (system* "make")))))
111 (add-after 'install 'install-doc
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (doc (assoc-ref outputs "doc"))
115 (old-doc-dir (string-append out "/share/doc"))
116 (new-doc/mit-scheme-dir
117 (string-append doc "/share/doc/" ,name "-" ,version)))
118 (with-directory-excursion "../doc"
119 (for-each (lambda (target)
120 (system* "make" target))
121 '("install-config" "install-info-gz" "install-man"
122 "install-html" "install-pdf")))
123 (mkdir-p new-doc/mit-scheme-dir)
124 (copy-recursively
125 (string-append old-doc-dir "/" ,name "-" ,version)
126 new-doc/mit-scheme-dir)
127 (delete-file-recursively old-doc-dir)
128 #t))))))
129 (native-inputs
130 `(("texlive" ,texlive)
131 ("texinfo" ,texinfo)
132 ("m4" ,m4)))
e117772d 133 (inputs
f163c290 134 `(("libx11" ,libx11)
e117772d
LC
135
136 ("source"
dd6b9a37
LC
137
138 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
139 ;; compile from the architecture-specific tarballs, which contain
140 ;; pre-built binaries. It leads to more efficient code than when
141 ;; building the tarball that contains generated C code instead of
142 ;; those binaries.
143 ,(origin
144 (method url-fetch)
145 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
146 version "/mit-scheme-"
dd6b9a37 147 (match (%current-system)
ecb26c10
AE
148 ("x86_64-linux"
149 (string-append version "-x86-64"))
150 ("i686-linux"
151 (string-append version "-i386"))
152 (_
153 (string-append "c-" version)))
dd6b9a37
LC
154 ".tar.gz"))
155 (sha256
156 (match (%current-system)
157 ("x86_64-linux"
158 (base32
6c4a2884 159 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
dd6b9a37
LC
160 ("i686-linux"
161 (base32
6c4a2884 162 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
dd6b9a37
LC
163 (_
164 (base32
6c4a2884 165 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
75af27f7
LC
166
167 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
7491edaf 168 (supported-systems (delete "mips64el-linux" %supported-systems))
75af27f7 169
e117772d 170 (home-page "http://www.gnu.org/software/mit-scheme/")
a2b63d58 171 (synopsis "A Scheme implementation with integrated editor and debugger")
e117772d 172 (description
79c311b8 173 "GNU/MIT Scheme is an implementation of the Scheme programming
a22dc0c4
LC
174language. It provides an interpreter, a compiler and a debugger. It also
175features an integrated Emacs-like editor and a large runtime library.")
e117772d
LC
176 (license gpl2+)))
177
178(define-public bigloo
179 (package
180 (name "bigloo")
7fe492e8 181 (version "4.1a")
e117772d
LC
182 (source (origin
183 (method url-fetch)
184 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
185 version ".tar.gz"))
186 (sha256
187 (base32
7fe492e8 188 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
01eafd38 189 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
e117772d
LC
190 (build-system gnu-build-system)
191 (arguments
01eafd38 192 `(#:test-target "test"
e117772d
LC
193 #:phases (alist-replace
194 'configure
195 (lambda* (#:key outputs #:allow-other-keys)
196
197 (substitute* "configure"
198 (("^shell=.*$")
199 (string-append "shell=" (which "bash") "\n")))
200
6e1c4093
LC
201 ;; Since libgc's pthread redirects are used, we end up
202 ;; using libgc symbols, so we must link against it.
203 ;; Reported on 2013-06-25.
204 (substitute* "api/pthread/src/Makefile"
205 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
206 (string-append "EXTRALIBS = "
207 (string-trim-right value)
208 " -l$(GCLIB)_fth-$(RELEASE)"
209 " -Wl,-rpath=" (assoc-ref outputs "out")
210 "/lib/bigloo/" ,version)))
211
e117772d 212 ;; Those variables are used by libgc's `configure'.
e858326a
LC
213 (setenv "SHELL" (which "sh"))
214 (setenv "CONFIG_SHELL" (which "sh"))
215
216 ;; ... but they turned out to be overridden later, so work
217 ;; around that.
218 (substitute* (find-files "gc" "^configure-gc")
219 (("sh=/bin/sh")
220 (string-append "sh=" (which "sh"))))
e117772d
LC
221
222 ;; The `configure' script doesn't understand options
223 ;; of those of Autoconf.
224 (let ((out (assoc-ref outputs "out")))
225 (zero?
226 (system* "./configure"
227 (string-append "--prefix=" out)
7fe492e8
LC
228 ;; FIXME: Currently fails, see
229 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
230 ;; "--customgc=no" ; use our libgc
e117772d 231 (string-append"--mv=" (which "mv"))
f0ad3c76
LC
232 (string-append "--rm=" (which "rm"))
233 (string-append "--ldflags=-Wl,-rpath="
234 (assoc-ref outputs "out")
235 "/lib/bigloo/" ,version)))))
e117772d 236 (alist-cons-after
e858326a
LC
237 'install 'install-emacs-modes
238 (lambda* (#:key outputs #:allow-other-keys)
239 (let* ((out (assoc-ref outputs "out"))
240 (dir (string-append out "/share/emacs/site-lisp")))
241 (zero? (system* "make" "-C" "bmacs" "all" "install"
242 (string-append "EMACSBRAND=emacs24")
243 (string-append "EMACSDIR=" dir)))))
244 %standard-phases))))
e117772d 245 (inputs
69383a47 246 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
cf53ecf5
LC
247
248 ;; Optional APIs for which Bigloo has bindings.
249 ("avahi" ,avahi)
250 ("libphidget" ,libphidget)))
251 (native-inputs
252 `(("pkg-config" ,pkg-config)))
10879c4e
LC
253 (propagated-inputs
254 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
e117772d 255 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
35b9e423 256 (synopsis "Efficient Scheme compiler")
e117772d
LC
257 (description
258 "Bigloo is a Scheme implementation devoted to one goal: enabling
259Scheme based programming style where C(++) is usually
260required. Bigloo attempts to make Scheme practical by offering
261features usually presented by traditional programming languages
262but not offered by Scheme and functional programming. Bigloo
263compiles Scheme modules. It delivers small and fast stand alone
264binary executables. Bigloo enables full connections between
14e72a18 265Scheme and C programs and between Scheme and Java programs.")
e117772d 266 (license gpl2+)))
e6e82f62
LC
267
268(define-public hop
269 (package
270 (name "hop")
271 (version "2.4.0")
272 (source (origin
273 (method url-fetch)
274 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
275 version ".tar.gz"))
276 (sha256
277 (base32
01eafd38 278 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
76071c70
EB
279 (patches (list (search-patch "hop-bigloo-4.0b.patch")
280 (search-patch "hop-linker-flags.patch")))))
e6e82f62
LC
281 (build-system gnu-build-system)
282 (arguments
8a629613 283 `(#:phases
d8707db0
LC
284 (alist-replace
285 'configure
76071c70 286 (lambda* (#:key outputs #:allow-other-keys)
d8707db0
LC
287 (let ((out (assoc-ref outputs "out")))
288 (zero?
289 (system* "./configure"
76071c70
EB
290 (string-append "--prefix=" out)
291 (string-append "--blflags="
292 ;; user flags completely override useful
293 ;; default flags, so repeat them here.
294 "-copt \\$(CPICFLAGS) -L\\$(BUILDLIBDIR) "
295 "-ldopt -Wl,-rpath," out "/lib")))))
296 %standard-phases)
297 #:tests? #f)) ; no test suite
a394c60a
AE
298 (inputs `(("avahi" ,avahi)
299 ("bigloo" ,bigloo)
8a629613 300 ("which" ,which)))
e6e82f62 301 (home-page "http://hop.inria.fr/")
9e771e3b 302 (synopsis "Multi-tier programming language for the Web 2.0")
e6e82f62
LC
303 (description
304 "HOP is a multi-tier programming language for the Web 2.0 and the
305so-called diffuse Web. It is designed for programming interactive web
306applications in many fields such as multimedia (web galleries, music players,
307...), ubiquitous and house automation (SmartPhones, personal appliance),
308mashups, office (web agendas, mail clients, ...), etc.")
309 (license gpl2+)))
8cc9e7f9
LC
310
311(define-public chicken
312 (package
313 (name "chicken")
d0d94110 314 (version "4.10.0")
8cc9e7f9
LC
315 (source (origin
316 (method url-fetch)
d0d94110
RW
317 (uri (string-append "http://code.call-cc.org/releases/"
318 version "/chicken-" version ".tar.gz"))
8cc9e7f9
LC
319 (sha256
320 (base32
d0d94110 321 "16w96jrhb6qf62fgznk53f55yhfv81damghdjn31k5hirnmza1qf"))))
8cc9e7f9
LC
322 (build-system gnu-build-system)
323 (arguments
324 `(#:modules ((guix build gnu-build-system)
325 (guix build utils)
326 (srfi srfi-1))
327
328 ;; No `configure' script; run "make check" after "make install" as
329 ;; prescribed by README.
acb38070
RW
330 #:phases
331 (modify-phases %standard-phases
332 (delete 'configure)
333 (delete 'check)
334 (add-after 'install 'check
416a5a9a
RW
335 (assoc-ref %standard-phases 'check))
336 (add-after 'unpack 'disable-broken-tests
337 (lambda _
338 ;; The port tests fail with this error:
339 ;; Error: (line 294) invalid escape-sequence '\x o'
340 (substitute* "tests/runtests.sh"
341 (("\\$interpret -s port-tests\\.scm") ""))
342 #t)))
8cc9e7f9
LC
343
344 #:make-flags (let ((out (assoc-ref %outputs "out")))
345 (list "PLATFORM=linux"
346 (string-append "PREFIX=" out)
347 (string-append "VARDIR=" out "/var/lib")))
348
349 ;; Parallel builds are not supported, as noted in README.
350 #:parallel-build? #f))
ffc13e75
RW
351 ;; One of the tests ("testing direct invocation can detect calls of too
352 ;; many arguments...") times out when building with a more recent GCC.
353 ;; The problem was reported here:
354 ;; https://lists.gnu.org/archive/html/chicken-hackers/2015-04/msg00059.html
355 (native-inputs
356 `(("gcc" ,gcc-4.8)))
8cc9e7f9
LC
357 (home-page "http://www.call-cc.org/")
358 (synopsis "R5RS Scheme implementation that compiles native code via C")
359 (description
360 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
361produces portable and efficient C, supports almost all of the R5RS Scheme
2c4b49ed 362language standard, and includes many enhancements and extensions.")
8cc9e7f9 363 (license bsd-3)))
f7ce90e7
LC
364
365(define-public scheme48
366 (package
367 (name "scheme48")
368 (version "1.9")
369 (source (origin
370 (method url-fetch)
371 (uri (string-append "http://s48.org/" version
372 "/scheme48-" version ".tgz"))
373 (sha256
374 (base32
01eafd38
LC
375 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
376 (patches (list (search-patch "scheme48-tests.patch")))))
f7ce90e7 377 (build-system gnu-build-system)
f7ce90e7
LC
378 (home-page "http://s48.org/")
379 (synopsis "Scheme implementation using a bytecode interpreter")
380 (description
381 "Scheme 48 is an implementation of Scheme based on a byte-code
382interpreter and is designed to be used as a testbed for experiments in
383implementation techniques and as an expository tool.")
384
385 ;; Most files are BSD-3; see COPYING for the few exceptions.
386 (license bsd-3)))
30645251
LC
387
388(define-public racket
389 (package
390 (name "racket")
64a71920 391 (version "6.2.1")
30645251
LC
392 (source (origin
393 (method url-fetch)
d3206af6
LC
394 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
395 version "/racket-" version "-src.tgz")
30645251
LC
396 (string-append
397 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
398 version "/racket/racket-" version "-src-unix.tgz")))
399 (sha256
d3206af6 400 (base32
64a71920 401 "0555j63k7fs10iv0icmivlxpzgp6s7gwcbfddmbwxlf2rk80qhq0"))))
30645251
LC
402 (build-system gnu-build-system)
403 (arguments
404 '(#:phases
405 (let* ((gui-libs
406 (lambda (inputs)
9d3c4dae
LC
407 (define (lib input)
408 (string-append (assoc-ref inputs input) "/lib"))
409
410 (list (lib "glib")
411 (lib "cairo")
412 (lib "pango")
413 (lib "libjpeg")
414 (lib "gtk")
d3206af6
LC
415 (lib "gdk-pixbuf")
416 (lib "fontconfig")
417 (lib "sqlite"))))) ;to build the doc
30645251
LC
418 (alist-cons-before
419 'configure 'pre-configure
420 (lambda* (#:key inputs #:allow-other-keys)
421 (chdir "src")
422
423 ;; The GUI libs are dynamically opened through the FFI, so they
424 ;; must be in the loader's search path.
425 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
426 (alist-cons-after
427 'unpack 'patch-/bin/sh
428 (lambda _
429 (substitute* "collects/racket/system.rkt"
430 (("/bin/sh") (which "sh"))))
431 (alist-cons-after
432 'install 'wrap-programs
433 (lambda* (#:key inputs outputs #:allow-other-keys)
434 (let ((out (assoc-ref outputs "out")))
435 (define (wrap prog)
436 (wrap-program prog
437 `("LD_LIBRARY_PATH" ":" prefix
438 ,(gui-libs inputs))))
439
440 (with-directory-excursion (string-append out "/bin")
441 (for-each wrap
442 (list "gracket" "drracket" "slideshow" "mred"))
443 #t)))
444 %standard-phases))))
445 #:tests? #f ; XXX: how to run them?
446 ))
447 (inputs `(("libffi" ,libffi)
448 ("glib" ,glib) ; for DrRacket
449 ("cairo" ,cairo)
450 ("pango" ,pango)
9d3c4dae 451 ("libjpeg" ,libjpeg-8)
d3206af6 452 ("fontconfig" ,fontconfig)
9d3c4dae 453 ("gdk-pixbuf" ,gdk-pixbuf)
d3206af6
LC
454 ("gtk" ,gtk+-2)
455 ("sqlite" ,sqlite))) ;needed to build the doc
30645251
LC
456 (home-page "http://racket-lang.org")
457 (synopsis "Implementation of Scheme and related languages")
458 (description
459 "Racket is an implementation of the Scheme programming language (R5RS and
460R6RS) and related languages, such as Typed Racket. It features a compiler and
461a virtual machine with just-in-time native compilation, as well as a large set
462of libraries.")
39d0ce93 463 (license lgpl2.0+)))
07f4aef0
TUBK
464
465(define-public gambit-c
466 (package
467 (name "gambit-c")
468 (version "4.7.4")
469 (source
470 (origin
471 (method url-fetch)
472 (uri (string-append
473 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
474 (version-major+minor version) "/source/gambc-v"
475 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
476 ".tgz"))
477 (sha256
478 (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs"))))
479 (build-system gnu-build-system)
480 (arguments
481 '(#:configure-flags
482 ;; According to the ./configure script, this makes the build slower and
483 ;; use >= 1 GB memory, but makes Gambit much faster.
484 '("--enable-single-host")
485 #:phases
486 (alist-cons-before
487 'check 'fix-tests
488 (lambda _
489 (substitute* '("tests/makefile")
490 ;; '-:' is how run-time options are set. 'tl' sets some terminal
491 ;; option, which makes it fail in our build environment. It
492 ;; recommends using 'd-' as a solution, which sets the REPL
493 ;; interaction channel to stdin/stdout.
494 (("gsi -:tl") "gsi -:d-,tl")))
495 %standard-phases)))
496 (home-page "http://www.iro.umontreal.ca/~gambit/")
497 (synopsis "Efficient Scheme interpreter and compiler")
498 (description
499 "Gambit consists of two main programs: gsi, the Gambit Scheme
500interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
501the complete execution and debugging environment. The compiler is the
502interpreter extended with the capability of generating executable files. The
503compiler can produce standalone executables or compiled modules which can be
504loaded at run time. Interpreted code and compiled code can be freely
505mixed.")
506 ;; Dual license.
507 (license (list lgpl2.1+ asl2.0))))
3e92f4f9
TUBK
508
509(define-public chibi-scheme
510 (package
511 (name "chibi-scheme")
51960939 512 (version "0.7.3")
3e92f4f9
TUBK
513 (source
514 (origin
515 (method url-fetch)
51960939
TUBK
516 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
517 version ".tar.gz"))
3e92f4f9 518 (sha256
51960939
TUBK
519 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
520 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
3e92f4f9
TUBK
521 (build-system gnu-build-system)
522 (arguments
523 `(#:phases
524 (alist-delete
525 'configure
526 (alist-cons-before
527 'build 'set-cc
528 (lambda _
529 (setenv "CC" "gcc"))
530 %standard-phases))
531 #:make-flags (let ((out (assoc-ref %outputs "out")))
532 (list (string-append "PREFIX=" out)
533 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
534 #:test-target "test"))
535 (home-page "https://code.google.com/p/chibi-scheme/")
536 (synopsis "Small embeddable Scheme implementation")
537 (description
538 "Chibi-Scheme is a very small library with no external dependencies
539intended for use as an extension and scripting language in C programs. In
540addition to support for lightweight VM-based threads, each VM itself runs in
541an isolated heap allowing multiple VMs to run simultaneously in different OS
542threads.")
543 (license bsd-3)))
c093f9f6 544
c093f9f6
FB
545(define-public scmutils
546 (let ()
547 (define (system-suffix)
548 (cond
549 ((string-prefix? "x86_64" (or (%current-target-system)
550 (%current-system)))
551 "x86-64")
552 (else "i386")))
553
554 (package
555 (name "scmutils")
556 (version "20140302")
557 (source
558 (origin
95001d4b 559 (method url-fetch/tarbomb)
c093f9f6
FB
560 (modules '((guix build utils)))
561 (snippet
562 ;; Remove binary code
563 '(delete-file-recursively "scmutils/mit-scheme"))
564 (file-name (string-append name "-" version ".tar.gz"))
565 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
566 "/scmutils-tarballs/" name "-" version
567 "-x86-64-gnu-linux.tar.gz"))
568 (sha256
569 (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
570 (build-system gnu-build-system)
571 (inputs
572 `(("mit-scheme" ,mit-scheme)
573 ("emacs" ,emacs-no-x)))
574 (arguments
575 `(#:tests? #f ;; no tests-suite
576 #:modules ((guix build gnu-build-system)
577 (guix build utils)
578 (guix build emacs-utils))
579 #:imported-modules (,@%gnu-build-system-modules
580 (guix build emacs-utils))
581 #:phases
582 (modify-phases %standard-phases
583 (replace 'configure
584 ;; No standard build procedure is used. We set the correct
585 ;; runtime path in the custom build system.
586 (lambda* (#:key outputs #:allow-other-keys)
587 (let ((out (assoc-ref outputs "out")))
588 ;; Required to find .bci files at runtime.
589 (with-directory-excursion "scmutils"
590 (rename-file "src" "scmutils"))
591 (substitute* "scmutils/scmutils/load.scm"
592 (("/usr/local/scmutils/")
593 (string-append out "/lib/mit-scheme-"
594 ,(system-suffix) "/")))
595 #t)))
596 (replace 'build
597 ;; Compile the code and build a band.
598 (lambda* (#:key outputs #:allow-other-keys)
599 (let* ((out (assoc-ref outputs "out"))
600 (make-img (string-append
601 "echo '(load \"load\") "
602 "(disk-save \"edwin-mechanics.com\")'"
603 "| mit-scheme")))
604 (with-directory-excursion "scmutils/scmutils"
605 (and (zero? (system "mit-scheme < compile.scm"))
606 (zero? (system make-img)))))))
607 (add-before 'install 'fix-directory-names
608 ;; Correct directory names in the startup script.
609 (lambda* (#:key inputs outputs #:allow-other-keys)
610 (let* ((out (assoc-ref outputs "out"))
611 (scm-root (assoc-ref inputs "mit-scheme")))
612 (substitute* "bin/mechanics"
613 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
614 (string-append
615 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
616 "LIB=\"${ROOT}/lib/mit-scheme-"
617 ,(system-suffix) ":"
618 out "/lib/mit-scheme-" ,(system-suffix) "\""))
619 (("EDWIN_INFO_DIRECTORY=.*\n") "")
620 (("SCHEME=.*\n")
621 (string-append "SCHEME=\"${ROOT}/bin/scheme "
622 "--library ${LIB}\"\n"))
623 (("export EDWIN_INFO_DIRECTORY") ""))
624 #t)))
625 (add-before 'install 'emacs-tags
626 ;; Generate Emacs's tags for easy reference to source
627 ;; code.
628 (lambda* (#:key inputs outputs #:allow-other-keys)
629 (with-directory-excursion "scmutils/scmutils"
630 (zero? (apply system* "etags"
631 (find-files "." "\\.scm"))))))
632 (replace 'install
633 ;; Copy files to the store.
634 (lambda* (#:key outputs #:allow-other-keys)
635 (define* (copy-files-to-directory files dir
636 #:optional (delete? #f))
637 (for-each (lambda (f)
638 (copy-file f (string-append dir "/" f))
639 (when delete? (delete-file f)))
640 files))
641
642 (let* ((out (assoc-ref outputs "out"))
643 (bin (string-append out "/bin"))
644 (doc (string-append out "/share/doc/"
645 ,name "-" ,version))
646 (lib (string-append out "/lib/mit-scheme-"
647 ,(system-suffix)
648 "/scmutils")))
649 (for-each mkdir-p (list lib doc bin))
650 (with-directory-excursion "scmutils/scmutils"
651 (copy-files-to-directory '("COPYING" "LICENSE")
652 doc #t)
653 (for-each delete-file (find-files "." "\\.bin"))
654 (copy-files-to-directory '("edwin-mechanics.com")
655 (string-append lib "/..") #t)
656 (copy-recursively "." lib))
657 (with-directory-excursion "bin"
658 (copy-files-to-directory (find-files ".") bin))
659 (with-directory-excursion "scmutils/manual"
660 (copy-files-to-directory (find-files ".") doc))
661 #t)))
662 (add-after 'install 'emacs-helpers
663 ;; Add convenience Emacs commands to easily load the
664 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
665 ;; and to easily load code tags.
666 (lambda* (#:key inputs outputs #:allow-other-keys)
667 (let* ((out (assoc-ref outputs "out"))
668 (mit-root (assoc-ref inputs "mit-scheme"))
669 (emacs-lisp-dir
670 (string-append out "/share/emacs/site-lisp"
671 "/guix.d/" ,name "-" ,version))
672 (el-file (string-append emacs-lisp-dir
673 "/scmutils.el"))
674 (lib-relative-path
675 (string-append "/lib/mit-scheme-"
676 ,(system-suffix))))
677 (mkdir-p emacs-lisp-dir)
678 (call-with-output-file el-file
679 (lambda (p)
680 (format p
681 ";;;###autoload
682(defun scmutils-load ()
683 (interactive)
684 (require 'xscheme)
685 (let ((mit-root \"~a\")
686 (scmutils \"~a\"))
687 (run-scheme
688 (concat mit-root \"/bin/scheme --library \"
689 mit-root \"~a:\" scmutils \"~a\"
690 \" --band edwin-mechanics.com\"
691 \" --emacs\"))))
692
693;;;###autoload
694(defun scmutils-load-tags ()
695 (interactive)
696 (let ((scmutils \"~a\"))
697 (visit-tags-table (concat scmutils \"/TAGS\"))))
698"
699 mit-root out
700 lib-relative-path
701 lib-relative-path
702 (string-append out lib-relative-path
703 "/scmutils"))))
aad4a48a
FB
704 (emacs-generate-autoloads ,name emacs-lisp-dir)
705 (emacs-byte-compile-directory emacs-lisp-dir)
c093f9f6
FB
706 #t))))))
707 (home-page
708 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
709 (synopsis "Scmutils library for MIT Scheme")
710 (description "The Scmutils system is an integrated library of
711procedures, embedded in the programming language Scheme, and intended to
712support teaching and research in mathematical physics and electrical
713engineering.")
714 (license gpl2+))))