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