1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
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))
50 (define-public mit-scheme
54 (source #f) ; see below
55 (build-system gnu-build-system)
57 `(#:tests? #f ; no "check" target
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)
67 ;; Delete these dangling symlinks since they break
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\\.")))
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))))))
87 `(;; TODO: Build doc when TeX Live is available.
88 ;; ("automake" ,automake)
89 ;; ("texlive-core" ,texlive-core)
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
102 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
103 version "/mit-scheme-"
104 (match (%current-system)
106 (string-append version "-x86-64"))
108 (string-append version "-i386"))
110 (string-append "c-" version)))
113 (match (%current-system)
116 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
119 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
122 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
124 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
125 (supported-systems (delete "mips64el-linux" %supported-systems))
127 (home-page "http://www.gnu.org/software/mit-scheme/")
128 (synopsis "A Scheme implementation with integrated editor and debugger")
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.")
135 (define-public bigloo
141 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
145 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
146 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
147 (build-system gnu-build-system)
149 `(#:test-target "test"
150 #:phases (alist-replace
152 (lambda* (#:key outputs #:allow-other-keys)
154 (substitute* "configure"
156 (string-append "shell=" (which "bash") "\n")))
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)))
169 ;; Those variables are used by libgc's `configure'.
170 (setenv "SHELL" (which "sh"))
171 (setenv "CONFIG_SHELL" (which "sh"))
173 ;; ... but they turned out to be overridden later, so work
175 (substitute* (find-files "gc" "^configure-gc")
177 (string-append "sh=" (which "sh"))))
179 ;; The `configure' script doesn't understand options
180 ;; of those of Autoconf.
181 (let ((out (assoc-ref outputs "out")))
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"))))))
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)))))
202 ;; Optional APIs for which Bigloo has bindings.
204 ("libphidget" ,libphidget)))
206 `(("pkg-config" ,pkg-config)))
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")
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.")
228 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
232 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
233 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
234 (build-system gnu-build-system)
239 (lambda* (#:key inputs outputs #:allow-other-keys)
240 (let ((out (assoc-ref outputs "out")))
242 (system* "./configure"
243 (string-append "--prefix=" out)))))
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"))
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
260 (or (equal? rpath rpath*)
262 (format #t "~a: changing RPATH from `~a' to `~a'~%"
265 (system* "patchelf" "--set-rpath"
267 (append (find-files (string-append out "/bin")
269 (find-files (string-append out "/lib")
272 #:tests? #f ; no test suite
273 #:modules ((guix build gnu-build-system)
279 (inputs `(("bigloo" ,bigloo)
281 ("patchelf" ,patchelf)))
282 (home-page "http://hop.inria.fr/")
283 (synopsis "Multi-tier programming language for the Web 2.0")
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.")
292 (define-public chicken
298 (uri (string-append "http://code.call-cc.org/releases/4.9.0/chicken-"
302 "0598mar1qswfd8hva9nqs88zjn02lzkqd8fzdd21dz1nki1prpq4"))))
303 (build-system gnu-build-system)
305 `(#:modules ((guix build gnu-build-system)
309 ;; No `configure' script; run "make check" after "make install" as
310 ;; prescribed by README.
311 #:phases (alist-cons-after
313 (assoc-ref %standard-phases 'check)
314 (fold alist-delete %standard-phases
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")))
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")
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.")
332 (define-public scheme48
338 (uri (string-append "http://s48.org/" version
339 "/scheme48-" version ".tgz"))
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")
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.")
352 ;; Most files are BSD-3; see COPYING for the few exceptions.
355 (define-public racket
361 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
362 version "/racket-" version "-src.tgz")
364 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
365 version "/racket/racket-" version "-src-unix.tgz")))
368 "0xfsfdqkngz0xw2lqmc7bsznwx25cw91l9fjhp7abrr05m96j0h9"))))
369 (build-system gnu-build-system)
375 (string-append (assoc-ref inputs input) "/lib"))
384 (lib "sqlite"))))) ;to build the doc
386 'configure 'pre-configure
387 (lambda* (#:key inputs #:allow-other-keys)
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) ":")))
394 'unpack 'patch-/bin/sh
396 (substitute* "collects/racket/system.rkt"
397 (("/bin/sh") (which "sh"))))
399 'install 'wrap-programs
400 (lambda* (#:key inputs outputs #:allow-other-keys)
401 (let ((out (assoc-ref outputs "out")))
404 `("LD_LIBRARY_PATH" ":" prefix
405 ,(gui-libs inputs))))
407 (with-directory-excursion (string-append out "/bin")
409 (list "gracket" "drracket" "slideshow" "mred"))
412 #:tests? #f ; XXX: how to run them?
414 (inputs `(("libffi" ,libffi)
415 ("glib" ,glib) ; for DrRacket
418 ("libjpeg" ,libjpeg-8)
419 ("fontconfig" ,fontconfig)
420 ("gdk-pixbuf" ,gdk-pixbuf)
422 ("sqlite" ,sqlite))) ;needed to build the doc
423 (home-page "http://racket-lang.org")
424 (synopsis "Implementation of Scheme and related languages")
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