distro: Add MIT/GNU Scheme and Bigloo.
[jackhill/guix/guix.git] / distro / packages / scheme.scm
CommitLineData
e117772d
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 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 (distro packages scheme)
20 #:use-module (distro)
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 (distro packages m4)
26 #:use-module (distro packages multiprecision)
27 #:use-module (distro packages emacs)
28 #:use-module (distro packages texinfo)
29 #:use-module (ice-9 match))
30
31(define-public mit-scheme
32 (package
33 (name "mit-scheme")
34 (version "9.1.1")
35 (source #f) ; see below
36 (build-system gnu-build-system)
37 (arguments
38 `(#:tests? #f ; no "check" target
39 #:phases
40 (alist-replace
41 'unpack
42 (lambda* (#:key inputs #:allow-other-keys)
43 (and (zero? (system* "tar" "xzvf"
44 (assoc-ref inputs "source")))
45 (chdir ,(string-append name "-" version))
46 (begin
47 ;; Delete these dangling symlinks since they break
48 ;; `patch-shebangs'.
49 (for-each delete-file
50 (append (find-files "src/lib/lib" "\\.so$")
51 (find-files "src/lib" "^ffi-test")))
52 (chdir "src")
53 #t)))
54 (alist-replace
55 'build
56 (lambda* (#:key system outputs #:allow-other-keys)
57 (let ((out (assoc-ref outputs "out")))
58 (if (or (string-prefix? "x86_64" system)
59 (string-prefix? "i686" system))
60 (zero? (system* "make" "compile-microcode"))
61 (zero? (system* "./etc/make-liarc.sh"
62 (string-append "--prefix=" out))))))
63 %standard-phases))))
64 (inputs
65 `(;; TODO: Build doc when TeX Live is available.
66 ;; ("automake" ,automake)
67 ;; ("texlive-core" ,texlive-core)
68 ("texinfo" ,texinfo)
69 ("m4" ,m4)
70
71 ("source"
72 ,(lambda (system)
73 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
74 ;; compile from the architecture-specific tarballs, which contain
75 ;; pre-built binaries. It leads to more efficient code than when
76 ;; building the tarball that contains generated C code instead of
77 ;; those binaries.
78 (origin
79 (method url-fetch)
80 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
81 version "/mit-scheme-"
82 version "-"
83 (match system
84 ("x86_64-linux" "x86-64")
85 ("i686-linux" "i386")
86 (_ "c"))
87 ".tar.gz"))
88 (sha256
89 (match system
90 ("x86_64-linux"
91 (base32
92 "1wcxm9hyfc53myvlcn93fyqrnnn4scwkknl9hkbp1cphc6mp291x"))
93 ("i686-linux"
94 (base32
95 "0vi760fy550d9db538m0vzbq1mpdncvw9g8bk4lswk0kcdira55z"))
96 (_
97 (base32
98 "0pclakzwxbqgy6wqwvs6ml62wgby8ba8xzmwzdwhx1v8wv05yw1j")))))))))
99 (home-page "http://www.gnu.org/software/mit-scheme/")
100 (synopsis "MIT/GNU Scheme, a native code Scheme compiler")
101 (description
102 "MIT/GNU Scheme is an implementation of the Scheme programming
103language, providing an interpreter, compiler, source-code debugger,
104integrated Emacs-like editor, and a large runtime library. MIT/GNU
105Scheme is best suited to programming large applications with a rapid
106development cycle.")
107 (license gpl2+)))
108
109(define-public bigloo
110 (package
111 (name "bigloo")
112 (version "3.9a")
113 (source (origin
114 (method url-fetch)
115 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
116 version ".tar.gz"))
117 (sha256
118 (base32
119 "0v1q0gcbn38ackdzsnvpkdgaj6ydkfdya31l2hag21aig087px1y"))))
120 (build-system gnu-build-system)
121 (arguments
122 '(#:patches (list (assoc-ref %build-inputs "patch/shebangs"))
123 #:test-target "test"
124 #:phases (alist-replace
125 'configure
126 (lambda* (#:key outputs #:allow-other-keys)
127
128 (substitute* "configure"
129 (("^shell=.*$")
130 (string-append "shell=" (which "bash") "\n")))
131
132 ;; Those variables are used by libgc's `configure'.
133 (setenv "SHELL" (which "bash"))
134 (setenv "CONFIG_SHELL" (which "bash"))
135
136 ;; The `configure' script doesn't understand options
137 ;; of those of Autoconf.
138 (let ((out (assoc-ref outputs "out")))
139 (zero?
140 (system* "./configure"
141 (string-append "--prefix=" out)
142 (string-append"--mv=" (which "mv"))
143 (string-append "--rm=" (which "rm"))))))
144 (alist-cons-after
145 'patch 'patch-absolute-file-names
146 (lambda _
147 (substitute* (cons "configure"
148 (find-files "gc" "^install-gc"))
149 (("/bin/rm") (which "rm"))
150 (("/bin/mv") (which "mv"))))
151 %standard-phases))))
152 (inputs
153 `(("gmp" ,gmp)
154 ("emacs" ,emacs)
155 ("patch/shebangs" ,(search-patch "bigloo-gc-shebangs.patch"))))
156 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
157 (synopsis "Bigloo, an efficient Scheme compiler")
158 (description
159 "Bigloo is a Scheme implementation devoted to one goal: enabling
160Scheme based programming style where C(++) is usually
161required. Bigloo attempts to make Scheme practical by offering
162features usually presented by traditional programming languages
163but not offered by Scheme and functional programming. Bigloo
164compiles Scheme modules. It delivers small and fast stand alone
165binary executables. Bigloo enables full connections between
166Scheme and C programs, between Scheme and Java programs, and
167between Scheme and C# programs.")
168 (license gpl2+)))