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