gnu: mit-scheme: Fix typo in 'supported-systems'.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages scheme)
20 #:use-module (gnu packages)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages m4)
26 #:use-module (gnu packages multiprecision)
27 #:use-module (gnu packages emacs)
28 #:use-module (gnu packages texinfo)
29 #:use-module (gnu packages elf)
30 #:use-module (gnu packages which)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages avahi)
33 #:use-module (gnu packages libphidget)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages libffi)
37 #:use-module (gnu packages image)
38 #:use-module (ice-9 match))
39
40 (define (mit-scheme-source-directory system version)
41 (string-append "mit-scheme-"
42 (if (or (string-prefix? "x86_64" system)
43 (string-prefix? "i686" system))
44 ""
45 "c-")
46 version))
47
48 (define-public mit-scheme
49 (package
50 (name "mit-scheme")
51 (version "9.2")
52 (source #f) ; see below
53 (build-system gnu-build-system)
54 (arguments
55 `(#:tests? #f ; no "check" target
56 #:phases
57 (alist-replace
58 'unpack
59 (lambda* (#:key inputs #:allow-other-keys)
60 (and (zero? (system* "tar" "xzvf"
61 (assoc-ref inputs "source")))
62 (chdir ,(mit-scheme-source-directory (%current-system)
63 version))
64 (begin
65 ;; Delete these dangling symlinks since they break
66 ;; `patch-shebangs'.
67 (for-each delete-file
68 (append '("src/lib/shim-config.scm")
69 (find-files "src/lib/lib" "\\.so$")
70 (find-files "src/lib" "^liarc-")
71 (find-files "src/compiler" "^make\\.")))
72 (chdir "src")
73 #t)))
74 (alist-replace
75 'build
76 (lambda* (#:key system outputs #:allow-other-keys)
77 (let ((out (assoc-ref outputs "out")))
78 (if (or (string-prefix? "x86_64" system)
79 (string-prefix? "i686" system))
80 (zero? (system* "make" "compile-microcode"))
81 (zero? (system* "./etc/make-liarc.sh"
82 (string-append "--prefix=" out))))))
83 %standard-phases))))
84 (inputs
85 `(;; TODO: Build doc when TeX Live is available.
86 ;; ("automake" ,automake)
87 ;; ("texlive-core" ,texlive-core)
88 ("texinfo" ,texinfo)
89 ("m4" ,m4)
90
91 ("source"
92
93 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
94 ;; compile from the architecture-specific tarballs, which contain
95 ;; pre-built binaries. It leads to more efficient code than when
96 ;; building the tarball that contains generated C code instead of
97 ;; those binaries.
98 ,(origin
99 (method url-fetch)
100 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
101 version "/mit-scheme-"
102 (match (%current-system)
103 ("x86_64-linux"
104 (string-append version "-x86-64"))
105 ("i686-linux"
106 (string-append version "-i386"))
107 (_
108 (string-append "c-" version)))
109 ".tar.gz"))
110 (sha256
111 (match (%current-system)
112 ("x86_64-linux"
113 (base32
114 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
115 ("i686-linux"
116 (base32
117 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
118 (_
119 (base32
120 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
121
122 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
123 (supported-systems (delete "mips64el-linux" %supported-systems))
124
125 (home-page "http://www.gnu.org/software/mit-scheme/")
126 (synopsis "Scheme implementation with integrated editor and debugger")
127 (description
128 "GNU/MIT Scheme is an implementation of the Scheme programming
129 language. It provides an interpreter, a compiler and a debugger. It also
130 features an integrated Emacs-like editor and a large runtime library.")
131 (license gpl2+)))
132
133 (define-public bigloo
134 (package
135 (name "bigloo")
136 (version "4.1a")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
140 version ".tar.gz"))
141 (sha256
142 (base32
143 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
144 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
145 (build-system gnu-build-system)
146 (arguments
147 `(#:test-target "test"
148 #:phases (alist-replace
149 'configure
150 (lambda* (#:key outputs #:allow-other-keys)
151
152 (substitute* "configure"
153 (("^shell=.*$")
154 (string-append "shell=" (which "bash") "\n")))
155
156 ;; Since libgc's pthread redirects are used, we end up
157 ;; using libgc symbols, so we must link against it.
158 ;; Reported on 2013-06-25.
159 (substitute* "api/pthread/src/Makefile"
160 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
161 (string-append "EXTRALIBS = "
162 (string-trim-right value)
163 " -l$(GCLIB)_fth-$(RELEASE)"
164 " -Wl,-rpath=" (assoc-ref outputs "out")
165 "/lib/bigloo/" ,version)))
166
167 ;; Those variables are used by libgc's `configure'.
168 (setenv "SHELL" (which "sh"))
169 (setenv "CONFIG_SHELL" (which "sh"))
170
171 ;; ... but they turned out to be overridden later, so work
172 ;; around that.
173 (substitute* (find-files "gc" "^configure-gc")
174 (("sh=/bin/sh")
175 (string-append "sh=" (which "sh"))))
176
177 ;; The `configure' script doesn't understand options
178 ;; of those of Autoconf.
179 (let ((out (assoc-ref outputs "out")))
180 (zero?
181 (system* "./configure"
182 (string-append "--prefix=" out)
183 ;; FIXME: Currently fails, see
184 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
185 ;; "--customgc=no" ; use our libgc
186 (string-append"--mv=" (which "mv"))
187 (string-append "--rm=" (which "rm"))))))
188 (alist-cons-after
189 'install 'install-emacs-modes
190 (lambda* (#:key outputs #:allow-other-keys)
191 (let* ((out (assoc-ref outputs "out"))
192 (dir (string-append out "/share/emacs/site-lisp")))
193 (zero? (system* "make" "-C" "bmacs" "all" "install"
194 (string-append "EMACSBRAND=emacs24")
195 (string-append "EMACSDIR=" dir)))))
196 %standard-phases))))
197 (inputs
198 `(("emacs" ,emacs)
199
200 ;; Optional APIs for which Bigloo has bindings.
201 ("avahi" ,avahi)
202 ("libphidget" ,libphidget)))
203 (native-inputs
204 `(("pkg-config" ,pkg-config)))
205 (propagated-inputs
206 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
207 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
208 (synopsis "Efficient Scheme compiler")
209 (description
210 "Bigloo is a Scheme implementation devoted to one goal: enabling
211 Scheme based programming style where C(++) is usually
212 required. Bigloo attempts to make Scheme practical by offering
213 features usually presented by traditional programming languages
214 but not offered by Scheme and functional programming. Bigloo
215 compiles Scheme modules. It delivers small and fast stand alone
216 binary executables. Bigloo enables full connections between
217 Scheme and C programs and between Scheme and Java programs.")
218 (license gpl2+)))
219
220 (define-public hop
221 (package
222 (name "hop")
223 (version "2.4.0")
224 (source (origin
225 (method url-fetch)
226 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
227 version ".tar.gz"))
228 (sha256
229 (base32
230 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
231 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
232 (build-system gnu-build-system)
233 (arguments
234 '(#:phases
235 (alist-replace
236 'configure
237 (lambda* (#:key inputs outputs #:allow-other-keys)
238 (let ((out (assoc-ref outputs "out")))
239 (zero?
240 (system* "./configure"
241 (string-append "--prefix=" out)))))
242 (alist-cons-after
243 'strip 'patch-rpath
244 (lambda* (#:key outputs #:allow-other-keys)
245 ;; Patch the RPATH of every installed library to point to $out/lib
246 ;; instead of $TMPDIR. Note that "patchelf --set-rpath" produces
247 ;; invalid binaries when used before stripping.
248 (let ((out (assoc-ref outputs "out"))
249 (tmpdir (getcwd)))
250 (every (lambda (lib)
251 (let* ((in (open-pipe* OPEN_READ "patchelf"
252 "--print-rpath" lib))
253 (rpath (read-line in)))
254 (and (zero? (close-pipe in))
255 (let ((rpath* (regexp-substitute/global
256 #f (regexp-quote tmpdir) rpath
257 'pre out 'post)))
258 (or (equal? rpath rpath*)
259 (begin
260 (format #t "~a: changing RPATH from `~a' to `~a'~%"
261 lib rpath rpath*)
262 (zero?
263 (system* "patchelf" "--set-rpath"
264 rpath* lib))))))))
265 (append (find-files (string-append out "/bin")
266 ".*")
267 (find-files (string-append out "/lib")
268 "\\.so$")))))
269 %standard-phases))
270 #:tests? #f ; no test suite
271 #:modules ((guix build gnu-build-system)
272 (guix build utils)
273 (ice-9 popen)
274 (ice-9 regex)
275 (ice-9 rdelim)
276 (srfi srfi-1))))
277 (inputs `(("bigloo" ,bigloo)
278 ("which" ,which)
279 ("patchelf" ,patchelf)))
280 (home-page "http://hop.inria.fr/")
281 (synopsis "Multi-tier programming language for the Web 2.0")
282 (description
283 "HOP is a multi-tier programming language for the Web 2.0 and the
284 so-called diffuse Web. It is designed for programming interactive web
285 applications in many fields such as multimedia (web galleries, music players,
286 ...), ubiquitous and house automation (SmartPhones, personal appliance),
287 mashups, office (web agendas, mail clients, ...), etc.")
288 (license gpl2+)))
289
290 (define-public chicken
291 (package
292 (name "chicken")
293 (version "4.8.0.3")
294 (source (origin
295 (method url-fetch)
296 (uri (string-append "http://code.call-cc.org/releases/4.8.0/chicken-"
297 version ".tar.gz"))
298 (sha256
299 (base32
300 "1hwrnc2dhgbnz3mlpcb4qvg76kwsfzqylw24gxyy91jmygk1853a"))))
301 (build-system gnu-build-system)
302 (arguments
303 `(#:modules ((guix build gnu-build-system)
304 (guix build utils)
305 (srfi srfi-1))
306
307 ;; No `configure' script; run "make check" after "make install" as
308 ;; prescribed by README.
309 #:phases (alist-cons-after
310 'install 'check
311 (assoc-ref %standard-phases 'check)
312 (fold alist-delete %standard-phases
313 '(configure check)))
314
315 #:make-flags (let ((out (assoc-ref %outputs "out")))
316 (list "PLATFORM=linux"
317 (string-append "PREFIX=" out)
318 (string-append "VARDIR=" out "/var/lib")))
319
320 ;; Parallel builds are not supported, as noted in README.
321 #:parallel-build? #f))
322 (home-page "http://www.call-cc.org/")
323 (synopsis "R5RS Scheme implementation that compiles native code via C")
324 (description
325 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
326 produces portable and efficient C, supports almost all of the R5RS Scheme
327 language standard, and includes many enhancements and extensions.")
328 (license bsd-3)))
329
330 (define-public scheme48
331 (package
332 (name "scheme48")
333 (version "1.9")
334 (source (origin
335 (method url-fetch)
336 (uri (string-append "http://s48.org/" version
337 "/scheme48-" version ".tgz"))
338 (sha256
339 (base32
340 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
341 (patches (list (search-patch "scheme48-tests.patch")))))
342 (build-system gnu-build-system)
343 (home-page "http://s48.org/")
344 (synopsis "Scheme implementation using a bytecode interpreter")
345 (description
346 "Scheme 48 is an implementation of Scheme based on a byte-code
347 interpreter and is designed to be used as a testbed for experiments in
348 implementation techniques and as an expository tool.")
349
350 ;; Most files are BSD-3; see COPYING for the few exceptions.
351 (license bsd-3)))
352
353 (define-public racket
354 (package
355 (name "racket")
356 (version "5.3.4")
357 (source (origin
358 (method url-fetch)
359 (uri (list (string-append "http://download.racket-lang.org/installers/"
360 version "/racket/racket-" version
361 "-src-unix.tgz")
362 (string-append
363 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
364 version "/racket/racket-" version "-src-unix.tgz")))
365 (sha256
366 ;; XXX: Used to be 1xhnx3yd74zrvn6sfcqmk57kxj51cwvm660dwiaxr1qxnm5lq0v7.
367 (base32 "0yrdmpdvzf092869y6zjjjxl6j2kypgiv7qrfkv7lj8w01pbh7sd"))))
368 (build-system gnu-build-system)
369 (arguments
370 '(#:phases
371 (let* ((gui-libs
372 (lambda (inputs)
373 (define (lib input)
374 (string-append (assoc-ref inputs input) "/lib"))
375
376 (list (lib "glib")
377 (lib "cairo")
378 (lib "pango")
379 (lib "libjpeg")
380 (lib "gtk")
381 (lib "gdk-pixbuf")))))
382 (alist-cons-before
383 'configure 'pre-configure
384 (lambda* (#:key inputs #:allow-other-keys)
385 (chdir "src")
386
387 ;; The GUI libs are dynamically opened through the FFI, so they
388 ;; must be in the loader's search path.
389 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
390 (alist-cons-after
391 'unpack 'patch-/bin/sh
392 (lambda _
393 (substitute* "collects/racket/system.rkt"
394 (("/bin/sh") (which "sh"))))
395 (alist-cons-after
396 'install 'wrap-programs
397 (lambda* (#:key inputs outputs #:allow-other-keys)
398 (let ((out (assoc-ref outputs "out")))
399 (define (wrap prog)
400 (wrap-program prog
401 `("LD_LIBRARY_PATH" ":" prefix
402 ,(gui-libs inputs))))
403
404 (with-directory-excursion (string-append out "/bin")
405 (for-each wrap
406 (list "gracket" "drracket" "slideshow" "mred"))
407 #t)))
408 %standard-phases))))
409 #:tests? #f ; XXX: how to run them?
410 ))
411 (inputs `(("libffi" ,libffi)
412 ("glib" ,glib) ; for DrRacket
413 ("cairo" ,cairo)
414 ("pango" ,pango)
415 ("libjpeg" ,libjpeg-8)
416 ("gdk-pixbuf" ,gdk-pixbuf)
417 ("gtk" ,gtk+-2)))
418 (home-page "http://racket-lang.org")
419 (synopsis "Implementation of Scheme and related languages")
420 (description
421 "Racket is an implementation of the Scheme programming language (R5RS and
422 R6RS) and related languages, such as Typed Racket. It features a compiler and
423 a virtual machine with just-in-time native compilation, as well as a large set
424 of libraries.")
425 (license lgpl2.0+)
426
427 ;; Fails to build on MIPS with "address or size is not OS PAGE ALIGNED".
428 ;; See <http://hydra.gnu.org/build/121775>.
429 (supported-systems (delete "mips64el-linux" %supported-systems))))