Commit | Line | Data |
---|---|---|
e117772d | 1 | ;;; GNU Guix --- Functional package management for GNU |
d3206af6 | 2 | ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> |
07f4aef0 | 3 | ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> |
c093f9f6 | 4 | ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> |
e117772d LC |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
1ffa7090 | 21 | (define-module (gnu packages scheme) |
59a43334 | 22 | #:use-module (gnu packages) |
e117772d LC |
23 | #:use-module (guix licenses) |
24 | #:use-module (guix packages) | |
25 | #:use-module (guix download) | |
07f4aef0 | 26 | #:use-module (guix utils) |
e117772d | 27 | #:use-module (guix build-system gnu) |
1ffa7090 LC |
28 | #:use-module (gnu packages m4) |
29 | #:use-module (gnu packages multiprecision) | |
d3206af6 | 30 | #:use-module (gnu packages databases) |
1ffa7090 LC |
31 | #:use-module (gnu packages emacs) |
32 | #:use-module (gnu packages texinfo) | |
ce0614dd | 33 | #:use-module (gnu packages base) |
cf53ecf5 LC |
34 | #:use-module (gnu packages pkg-config) |
35 | #:use-module (gnu packages avahi) | |
36 | #:use-module (gnu packages libphidget) | |
30645251 | 37 | #:use-module (gnu packages glib) |
9d3c4dae | 38 | #:use-module (gnu packages gtk) |
30645251 | 39 | #:use-module (gnu packages libffi) |
d3206af6 | 40 | #:use-module (gnu packages fontutils) |
e55354b8 | 41 | #:use-module (gnu packages image) |
bc11c72c | 42 | #:use-module (gnu packages xorg) |
e117772d LC |
43 | #:use-module (ice-9 match)) |
44 | ||
a0efb39a | 45 | (define (mit-scheme-source-directory system version) |
ecb26c10 AE |
46 | (string-append "mit-scheme-" |
47 | (if (or (string-prefix? "x86_64" system) | |
a0efb39a | 48 | (string-prefix? "i686" system)) |
ecb26c10 AE |
49 | "" |
50 | "c-") | |
51 | version)) | |
52 | ||
e117772d LC |
53 | (define-public mit-scheme |
54 | (package | |
55 | (name "mit-scheme") | |
6c4a2884 | 56 | (version "9.2") |
e117772d LC |
57 | (source #f) ; see below |
58 | (build-system gnu-build-system) | |
59 | (arguments | |
60 | `(#:tests? #f ; no "check" target | |
61 | #:phases | |
62 | (alist-replace | |
63 | 'unpack | |
64 | (lambda* (#:key inputs #:allow-other-keys) | |
65 | (and (zero? (system* "tar" "xzvf" | |
66 | (assoc-ref inputs "source"))) | |
a0efb39a LC |
67 | (chdir ,(mit-scheme-source-directory (%current-system) |
68 | version)) | |
e117772d LC |
69 | (begin |
70 | ;; Delete these dangling symlinks since they break | |
71 | ;; `patch-shebangs'. | |
72 | (for-each delete-file | |
68dddcad AE |
73 | (append '("src/lib/shim-config.scm") |
74 | (find-files "src/lib/lib" "\\.so$") | |
75 | (find-files "src/lib" "^liarc-") | |
76 | (find-files "src/compiler" "^make\\."))) | |
e117772d LC |
77 | (chdir "src") |
78 | #t))) | |
79 | (alist-replace | |
80 | 'build | |
81 | (lambda* (#:key system outputs #:allow-other-keys) | |
82 | (let ((out (assoc-ref outputs "out"))) | |
83 | (if (or (string-prefix? "x86_64" system) | |
84 | (string-prefix? "i686" system)) | |
85 | (zero? (system* "make" "compile-microcode")) | |
86 | (zero? (system* "./etc/make-liarc.sh" | |
87 | (string-append "--prefix=" out)))))) | |
88 | %standard-phases)))) | |
89 | (inputs | |
90 | `(;; TODO: Build doc when TeX Live is available. | |
91 | ;; ("automake" ,automake) | |
92 | ;; ("texlive-core" ,texlive-core) | |
93 | ("texinfo" ,texinfo) | |
94 | ("m4" ,m4) | |
bc11c72c | 95 | ("libx11" ,libx11) |
e117772d LC |
96 | |
97 | ("source" | |
dd6b9a37 LC |
98 | |
99 | ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to | |
100 | ;; compile from the architecture-specific tarballs, which contain | |
101 | ;; pre-built binaries. It leads to more efficient code than when | |
102 | ;; building the tarball that contains generated C code instead of | |
103 | ;; those binaries. | |
104 | ,(origin | |
105 | (method url-fetch) | |
106 | (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/" | |
107 | version "/mit-scheme-" | |
dd6b9a37 | 108 | (match (%current-system) |
ecb26c10 AE |
109 | ("x86_64-linux" |
110 | (string-append version "-x86-64")) | |
111 | ("i686-linux" | |
112 | (string-append version "-i386")) | |
113 | (_ | |
114 | (string-append "c-" version))) | |
dd6b9a37 LC |
115 | ".tar.gz")) |
116 | (sha256 | |
117 | (match (%current-system) | |
118 | ("x86_64-linux" | |
119 | (base32 | |
6c4a2884 | 120 | "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274")) |
dd6b9a37 LC |
121 | ("i686-linux" |
122 | (base32 | |
6c4a2884 | 123 | "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6")) |
dd6b9a37 LC |
124 | (_ |
125 | (base32 | |
6c4a2884 | 126 | "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg")))))))) |
75af27f7 LC |
127 | |
128 | ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>. | |
7491edaf | 129 | (supported-systems (delete "mips64el-linux" %supported-systems)) |
75af27f7 | 130 | |
e117772d | 131 | (home-page "http://www.gnu.org/software/mit-scheme/") |
a2b63d58 | 132 | (synopsis "A Scheme implementation with integrated editor and debugger") |
e117772d | 133 | (description |
79c311b8 | 134 | "GNU/MIT Scheme is an implementation of the Scheme programming |
a22dc0c4 LC |
135 | language. It provides an interpreter, a compiler and a debugger. It also |
136 | features an integrated Emacs-like editor and a large runtime library.") | |
e117772d LC |
137 | (license gpl2+))) |
138 | ||
139 | (define-public bigloo | |
140 | (package | |
141 | (name "bigloo") | |
7fe492e8 | 142 | (version "4.1a") |
e117772d LC |
143 | (source (origin |
144 | (method url-fetch) | |
145 | (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo" | |
146 | version ".tar.gz")) | |
147 | (sha256 | |
148 | (base32 | |
7fe492e8 | 149 | "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c")) |
01eafd38 | 150 | (patches (list (search-patch "bigloo-gc-shebangs.patch"))))) |
e117772d LC |
151 | (build-system gnu-build-system) |
152 | (arguments | |
01eafd38 | 153 | `(#:test-target "test" |
e117772d LC |
154 | #:phases (alist-replace |
155 | 'configure | |
156 | (lambda* (#:key outputs #:allow-other-keys) | |
157 | ||
158 | (substitute* "configure" | |
159 | (("^shell=.*$") | |
160 | (string-append "shell=" (which "bash") "\n"))) | |
161 | ||
6e1c4093 LC |
162 | ;; Since libgc's pthread redirects are used, we end up |
163 | ;; using libgc symbols, so we must link against it. | |
164 | ;; Reported on 2013-06-25. | |
165 | (substitute* "api/pthread/src/Makefile" | |
166 | (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value) | |
167 | (string-append "EXTRALIBS = " | |
168 | (string-trim-right value) | |
169 | " -l$(GCLIB)_fth-$(RELEASE)" | |
170 | " -Wl,-rpath=" (assoc-ref outputs "out") | |
171 | "/lib/bigloo/" ,version))) | |
172 | ||
e117772d | 173 | ;; Those variables are used by libgc's `configure'. |
e858326a LC |
174 | (setenv "SHELL" (which "sh")) |
175 | (setenv "CONFIG_SHELL" (which "sh")) | |
176 | ||
177 | ;; ... but they turned out to be overridden later, so work | |
178 | ;; around that. | |
179 | (substitute* (find-files "gc" "^configure-gc") | |
180 | (("sh=/bin/sh") | |
181 | (string-append "sh=" (which "sh")))) | |
e117772d LC |
182 | |
183 | ;; The `configure' script doesn't understand options | |
184 | ;; of those of Autoconf. | |
185 | (let ((out (assoc-ref outputs "out"))) | |
186 | (zero? | |
187 | (system* "./configure" | |
188 | (string-append "--prefix=" out) | |
7fe492e8 LC |
189 | ;; FIXME: Currently fails, see |
190 | ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>. | |
191 | ;; "--customgc=no" ; use our libgc | |
e117772d | 192 | (string-append"--mv=" (which "mv")) |
f0ad3c76 LC |
193 | (string-append "--rm=" (which "rm")) |
194 | (string-append "--ldflags=-Wl,-rpath=" | |
195 | (assoc-ref outputs "out") | |
196 | "/lib/bigloo/" ,version))))) | |
e117772d | 197 | (alist-cons-after |
e858326a LC |
198 | 'install 'install-emacs-modes |
199 | (lambda* (#:key outputs #:allow-other-keys) | |
200 | (let* ((out (assoc-ref outputs "out")) | |
201 | (dir (string-append out "/share/emacs/site-lisp"))) | |
202 | (zero? (system* "make" "-C" "bmacs" "all" "install" | |
203 | (string-append "EMACSBRAND=emacs24") | |
204 | (string-append "EMACSDIR=" dir))))) | |
205 | %standard-phases)))) | |
e117772d | 206 | (inputs |
69383a47 | 207 | `(("emacs" ,emacs) ;UDE needs the X version of Emacs |
cf53ecf5 LC |
208 | |
209 | ;; Optional APIs for which Bigloo has bindings. | |
210 | ("avahi" ,avahi) | |
211 | ("libphidget" ,libphidget))) | |
212 | (native-inputs | |
213 | `(("pkg-config" ,pkg-config))) | |
10879c4e LC |
214 | (propagated-inputs |
215 | `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h | |
e117772d | 216 | (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/") |
35b9e423 | 217 | (synopsis "Efficient Scheme compiler") |
e117772d LC |
218 | (description |
219 | "Bigloo is a Scheme implementation devoted to one goal: enabling | |
220 | Scheme based programming style where C(++) is usually | |
221 | required. Bigloo attempts to make Scheme practical by offering | |
222 | features usually presented by traditional programming languages | |
223 | but not offered by Scheme and functional programming. Bigloo | |
224 | compiles Scheme modules. It delivers small and fast stand alone | |
225 | binary executables. Bigloo enables full connections between | |
14e72a18 | 226 | Scheme and C programs and between Scheme and Java programs.") |
e117772d | 227 | (license gpl2+))) |
e6e82f62 LC |
228 | |
229 | (define-public hop | |
230 | (package | |
231 | (name "hop") | |
232 | (version "2.4.0") | |
233 | (source (origin | |
234 | (method url-fetch) | |
235 | (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-" | |
236 | version ".tar.gz")) | |
237 | (sha256 | |
238 | (base32 | |
01eafd38 | 239 | "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3")) |
76071c70 EB |
240 | (patches (list (search-patch "hop-bigloo-4.0b.patch") |
241 | (search-patch "hop-linker-flags.patch"))))) | |
e6e82f62 LC |
242 | (build-system gnu-build-system) |
243 | (arguments | |
8a629613 | 244 | `(#:phases |
d8707db0 LC |
245 | (alist-replace |
246 | 'configure | |
76071c70 | 247 | (lambda* (#:key outputs #:allow-other-keys) |
d8707db0 LC |
248 | (let ((out (assoc-ref outputs "out"))) |
249 | (zero? | |
250 | (system* "./configure" | |
76071c70 EB |
251 | (string-append "--prefix=" out) |
252 | (string-append "--blflags=" | |
253 | ;; user flags completely override useful | |
254 | ;; default flags, so repeat them here. | |
255 | "-copt \\$(CPICFLAGS) -L\\$(BUILDLIBDIR) " | |
256 | "-ldopt -Wl,-rpath," out "/lib"))))) | |
257 | %standard-phases) | |
258 | #:tests? #f)) ; no test suite | |
a394c60a AE |
259 | (inputs `(("avahi" ,avahi) |
260 | ("bigloo" ,bigloo) | |
8a629613 | 261 | ("which" ,which))) |
e6e82f62 | 262 | (home-page "http://hop.inria.fr/") |
9e771e3b | 263 | (synopsis "Multi-tier programming language for the Web 2.0") |
e6e82f62 LC |
264 | (description |
265 | "HOP is a multi-tier programming language for the Web 2.0 and the | |
266 | so-called diffuse Web. It is designed for programming interactive web | |
267 | applications in many fields such as multimedia (web galleries, music players, | |
268 | ...), ubiquitous and house automation (SmartPhones, personal appliance), | |
269 | mashups, office (web agendas, mail clients, ...), etc.") | |
270 | (license gpl2+))) | |
8cc9e7f9 LC |
271 | |
272 | (define-public chicken | |
273 | (package | |
274 | (name "chicken") | |
c43065a8 | 275 | (version "4.9.0.1") |
8cc9e7f9 LC |
276 | (source (origin |
277 | (method url-fetch) | |
c43065a8 | 278 | (uri (string-append "http://code.call-cc.org/releases/4.9.0/chicken-" |
8cc9e7f9 LC |
279 | version ".tar.gz")) |
280 | (sha256 | |
281 | (base32 | |
c43065a8 | 282 | "0598mar1qswfd8hva9nqs88zjn02lzkqd8fzdd21dz1nki1prpq4")))) |
8cc9e7f9 LC |
283 | (build-system gnu-build-system) |
284 | (arguments | |
285 | `(#:modules ((guix build gnu-build-system) | |
286 | (guix build utils) | |
287 | (srfi srfi-1)) | |
288 | ||
289 | ;; No `configure' script; run "make check" after "make install" as | |
290 | ;; prescribed by README. | |
291 | #:phases (alist-cons-after | |
292 | 'install 'check | |
293 | (assoc-ref %standard-phases 'check) | |
294 | (fold alist-delete %standard-phases | |
295 | '(configure check))) | |
296 | ||
297 | #:make-flags (let ((out (assoc-ref %outputs "out"))) | |
298 | (list "PLATFORM=linux" | |
299 | (string-append "PREFIX=" out) | |
300 | (string-append "VARDIR=" out "/var/lib"))) | |
301 | ||
302 | ;; Parallel builds are not supported, as noted in README. | |
303 | #:parallel-build? #f)) | |
304 | (home-page "http://www.call-cc.org/") | |
305 | (synopsis "R5RS Scheme implementation that compiles native code via C") | |
306 | (description | |
307 | "CHICKEN is a compiler for the Scheme programming language. CHICKEN | |
308 | produces portable and efficient C, supports almost all of the R5RS Scheme | |
2c4b49ed | 309 | language standard, and includes many enhancements and extensions.") |
8cc9e7f9 | 310 | (license bsd-3))) |
f7ce90e7 LC |
311 | |
312 | (define-public scheme48 | |
313 | (package | |
314 | (name "scheme48") | |
315 | (version "1.9") | |
316 | (source (origin | |
317 | (method url-fetch) | |
318 | (uri (string-append "http://s48.org/" version | |
319 | "/scheme48-" version ".tgz")) | |
320 | (sha256 | |
321 | (base32 | |
01eafd38 LC |
322 | "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw")) |
323 | (patches (list (search-patch "scheme48-tests.patch"))))) | |
f7ce90e7 | 324 | (build-system gnu-build-system) |
f7ce90e7 LC |
325 | (home-page "http://s48.org/") |
326 | (synopsis "Scheme implementation using a bytecode interpreter") | |
327 | (description | |
328 | "Scheme 48 is an implementation of Scheme based on a byte-code | |
329 | interpreter and is designed to be used as a testbed for experiments in | |
330 | implementation techniques and as an expository tool.") | |
331 | ||
332 | ;; Most files are BSD-3; see COPYING for the few exceptions. | |
333 | (license bsd-3))) | |
30645251 LC |
334 | |
335 | (define-public racket | |
336 | (package | |
337 | (name "racket") | |
64a71920 | 338 | (version "6.2.1") |
30645251 LC |
339 | (source (origin |
340 | (method url-fetch) | |
d3206af6 LC |
341 | (uri (list (string-append "http://mirror.racket-lang.org/installers/" |
342 | version "/racket-" version "-src.tgz") | |
30645251 LC |
343 | (string-append |
344 | "http://mirror.informatik.uni-tuebingen.de/mirror/racket/" | |
345 | version "/racket/racket-" version "-src-unix.tgz"))) | |
346 | (sha256 | |
d3206af6 | 347 | (base32 |
64a71920 | 348 | "0555j63k7fs10iv0icmivlxpzgp6s7gwcbfddmbwxlf2rk80qhq0")))) |
30645251 LC |
349 | (build-system gnu-build-system) |
350 | (arguments | |
351 | '(#:phases | |
352 | (let* ((gui-libs | |
353 | (lambda (inputs) | |
9d3c4dae LC |
354 | (define (lib input) |
355 | (string-append (assoc-ref inputs input) "/lib")) | |
356 | ||
357 | (list (lib "glib") | |
358 | (lib "cairo") | |
359 | (lib "pango") | |
360 | (lib "libjpeg") | |
361 | (lib "gtk") | |
d3206af6 LC |
362 | (lib "gdk-pixbuf") |
363 | (lib "fontconfig") | |
364 | (lib "sqlite"))))) ;to build the doc | |
30645251 LC |
365 | (alist-cons-before |
366 | 'configure 'pre-configure | |
367 | (lambda* (#:key inputs #:allow-other-keys) | |
368 | (chdir "src") | |
369 | ||
370 | ;; The GUI libs are dynamically opened through the FFI, so they | |
371 | ;; must be in the loader's search path. | |
372 | (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":"))) | |
373 | (alist-cons-after | |
374 | 'unpack 'patch-/bin/sh | |
375 | (lambda _ | |
376 | (substitute* "collects/racket/system.rkt" | |
377 | (("/bin/sh") (which "sh")))) | |
378 | (alist-cons-after | |
379 | 'install 'wrap-programs | |
380 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
381 | (let ((out (assoc-ref outputs "out"))) | |
382 | (define (wrap prog) | |
383 | (wrap-program prog | |
384 | `("LD_LIBRARY_PATH" ":" prefix | |
385 | ,(gui-libs inputs)))) | |
386 | ||
387 | (with-directory-excursion (string-append out "/bin") | |
388 | (for-each wrap | |
389 | (list "gracket" "drracket" "slideshow" "mred")) | |
390 | #t))) | |
391 | %standard-phases)))) | |
392 | #:tests? #f ; XXX: how to run them? | |
393 | )) | |
394 | (inputs `(("libffi" ,libffi) | |
395 | ("glib" ,glib) ; for DrRacket | |
396 | ("cairo" ,cairo) | |
397 | ("pango" ,pango) | |
9d3c4dae | 398 | ("libjpeg" ,libjpeg-8) |
d3206af6 | 399 | ("fontconfig" ,fontconfig) |
9d3c4dae | 400 | ("gdk-pixbuf" ,gdk-pixbuf) |
d3206af6 LC |
401 | ("gtk" ,gtk+-2) |
402 | ("sqlite" ,sqlite))) ;needed to build the doc | |
30645251 LC |
403 | (home-page "http://racket-lang.org") |
404 | (synopsis "Implementation of Scheme and related languages") | |
405 | (description | |
406 | "Racket is an implementation of the Scheme programming language (R5RS and | |
407 | R6RS) and related languages, such as Typed Racket. It features a compiler and | |
408 | a virtual machine with just-in-time native compilation, as well as a large set | |
409 | of libraries.") | |
39d0ce93 | 410 | (license lgpl2.0+))) |
07f4aef0 TUBK |
411 | |
412 | (define-public gambit-c | |
413 | (package | |
414 | (name "gambit-c") | |
415 | (version "4.7.4") | |
416 | (source | |
417 | (origin | |
418 | (method url-fetch) | |
419 | (uri (string-append | |
420 | "http://www.iro.umontreal.ca/~gambit/download/gambit/v" | |
421 | (version-major+minor version) "/source/gambc-v" | |
422 | (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version) | |
423 | ".tgz")) | |
424 | (sha256 | |
425 | (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs")))) | |
426 | (build-system gnu-build-system) | |
427 | (arguments | |
428 | '(#:configure-flags | |
429 | ;; According to the ./configure script, this makes the build slower and | |
430 | ;; use >= 1 GB memory, but makes Gambit much faster. | |
431 | '("--enable-single-host") | |
432 | #:phases | |
433 | (alist-cons-before | |
434 | 'check 'fix-tests | |
435 | (lambda _ | |
436 | (substitute* '("tests/makefile") | |
437 | ;; '-:' is how run-time options are set. 'tl' sets some terminal | |
438 | ;; option, which makes it fail in our build environment. It | |
439 | ;; recommends using 'd-' as a solution, which sets the REPL | |
440 | ;; interaction channel to stdin/stdout. | |
441 | (("gsi -:tl") "gsi -:d-,tl"))) | |
442 | %standard-phases))) | |
443 | (home-page "http://www.iro.umontreal.ca/~gambit/") | |
444 | (synopsis "Efficient Scheme interpreter and compiler") | |
445 | (description | |
446 | "Gambit consists of two main programs: gsi, the Gambit Scheme | |
447 | interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains | |
448 | the complete execution and debugging environment. The compiler is the | |
449 | interpreter extended with the capability of generating executable files. The | |
450 | compiler can produce standalone executables or compiled modules which can be | |
451 | loaded at run time. Interpreted code and compiled code can be freely | |
452 | mixed.") | |
453 | ;; Dual license. | |
454 | (license (list lgpl2.1+ asl2.0)))) | |
3e92f4f9 TUBK |
455 | |
456 | (define-public chibi-scheme | |
457 | (package | |
458 | (name "chibi-scheme") | |
51960939 | 459 | (version "0.7.3") |
3e92f4f9 TUBK |
460 | (source |
461 | (origin | |
462 | (method url-fetch) | |
51960939 TUBK |
463 | (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/" |
464 | version ".tar.gz")) | |
3e92f4f9 | 465 | (sha256 |
51960939 TUBK |
466 | (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742")) |
467 | (file-name (string-append "chibi-scheme-" version ".tar.gz")))) | |
3e92f4f9 TUBK |
468 | (build-system gnu-build-system) |
469 | (arguments | |
470 | `(#:phases | |
471 | (alist-delete | |
472 | 'configure | |
473 | (alist-cons-before | |
474 | 'build 'set-cc | |
475 | (lambda _ | |
476 | (setenv "CC" "gcc")) | |
477 | %standard-phases)) | |
478 | #:make-flags (let ((out (assoc-ref %outputs "out"))) | |
479 | (list (string-append "PREFIX=" out) | |
480 | (string-append "LDFLAGS=-Wl,-rpath=" out "/lib"))) | |
481 | #:test-target "test")) | |
482 | (home-page "https://code.google.com/p/chibi-scheme/") | |
483 | (synopsis "Small embeddable Scheme implementation") | |
484 | (description | |
485 | "Chibi-Scheme is a very small library with no external dependencies | |
486 | intended for use as an extension and scripting language in C programs. In | |
487 | addition to support for lightweight VM-based threads, each VM itself runs in | |
488 | an isolated heap allowing multiple VMs to run simultaneously in different OS | |
489 | threads.") | |
490 | (license bsd-3))) | |
c093f9f6 FB |
491 | |
492 | ;; FIXME: This function is temporarily in the engineering module and not | |
493 | ;; exported. It will be moved to an utility module for general use. Once | |
494 | ;; this is done, we should remove this definition. | |
495 | (define broken-tarball-fetch | |
496 | (@@ (gnu packages engineering) broken-tarball-fetch)) | |
497 | ||
498 | (define-public scmutils | |
499 | (let () | |
500 | (define (system-suffix) | |
501 | (cond | |
502 | ((string-prefix? "x86_64" (or (%current-target-system) | |
503 | (%current-system))) | |
504 | "x86-64") | |
505 | (else "i386"))) | |
506 | ||
507 | (package | |
508 | (name "scmutils") | |
509 | (version "20140302") | |
510 | (source | |
511 | (origin | |
512 | (method broken-tarball-fetch) | |
513 | (modules '((guix build utils))) | |
514 | (snippet | |
515 | ;; Remove binary code | |
516 | '(delete-file-recursively "scmutils/mit-scheme")) | |
517 | (file-name (string-append name "-" version ".tar.gz")) | |
518 | (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946" | |
519 | "/scmutils-tarballs/" name "-" version | |
520 | "-x86-64-gnu-linux.tar.gz")) | |
521 | (sha256 | |
522 | (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg")))) | |
523 | (build-system gnu-build-system) | |
524 | (inputs | |
525 | `(("mit-scheme" ,mit-scheme) | |
526 | ("emacs" ,emacs-no-x))) | |
527 | (arguments | |
528 | `(#:tests? #f ;; no tests-suite | |
529 | #:modules ((guix build gnu-build-system) | |
530 | (guix build utils) | |
531 | (guix build emacs-utils)) | |
532 | #:imported-modules (,@%gnu-build-system-modules | |
533 | (guix build emacs-utils)) | |
534 | #:phases | |
535 | (modify-phases %standard-phases | |
536 | (replace 'configure | |
537 | ;; No standard build procedure is used. We set the correct | |
538 | ;; runtime path in the custom build system. | |
539 | (lambda* (#:key outputs #:allow-other-keys) | |
540 | (let ((out (assoc-ref outputs "out"))) | |
541 | ;; Required to find .bci files at runtime. | |
542 | (with-directory-excursion "scmutils" | |
543 | (rename-file "src" "scmutils")) | |
544 | (substitute* "scmutils/scmutils/load.scm" | |
545 | (("/usr/local/scmutils/") | |
546 | (string-append out "/lib/mit-scheme-" | |
547 | ,(system-suffix) "/"))) | |
548 | #t))) | |
549 | (replace 'build | |
550 | ;; Compile the code and build a band. | |
551 | (lambda* (#:key outputs #:allow-other-keys) | |
552 | (let* ((out (assoc-ref outputs "out")) | |
553 | (make-img (string-append | |
554 | "echo '(load \"load\") " | |
555 | "(disk-save \"edwin-mechanics.com\")'" | |
556 | "| mit-scheme"))) | |
557 | (with-directory-excursion "scmutils/scmutils" | |
558 | (and (zero? (system "mit-scheme < compile.scm")) | |
559 | (zero? (system make-img))))))) | |
560 | (add-before 'install 'fix-directory-names | |
561 | ;; Correct directory names in the startup script. | |
562 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
563 | (let* ((out (assoc-ref outputs "out")) | |
564 | (scm-root (assoc-ref inputs "mit-scheme"))) | |
565 | (substitute* "bin/mechanics" | |
566 | (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"") | |
567 | (string-append | |
568 | "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n" | |
569 | "LIB=\"${ROOT}/lib/mit-scheme-" | |
570 | ,(system-suffix) ":" | |
571 | out "/lib/mit-scheme-" ,(system-suffix) "\"")) | |
572 | (("EDWIN_INFO_DIRECTORY=.*\n") "") | |
573 | (("SCHEME=.*\n") | |
574 | (string-append "SCHEME=\"${ROOT}/bin/scheme " | |
575 | "--library ${LIB}\"\n")) | |
576 | (("export EDWIN_INFO_DIRECTORY") "")) | |
577 | #t))) | |
578 | (add-before 'install 'emacs-tags | |
579 | ;; Generate Emacs's tags for easy reference to source | |
580 | ;; code. | |
581 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
582 | (with-directory-excursion "scmutils/scmutils" | |
583 | (zero? (apply system* "etags" | |
584 | (find-files "." "\\.scm")))))) | |
585 | (replace 'install | |
586 | ;; Copy files to the store. | |
587 | (lambda* (#:key outputs #:allow-other-keys) | |
588 | (define* (copy-files-to-directory files dir | |
589 | #:optional (delete? #f)) | |
590 | (for-each (lambda (f) | |
591 | (copy-file f (string-append dir "/" f)) | |
592 | (when delete? (delete-file f))) | |
593 | files)) | |
594 | ||
595 | (let* ((out (assoc-ref outputs "out")) | |
596 | (bin (string-append out "/bin")) | |
597 | (doc (string-append out "/share/doc/" | |
598 | ,name "-" ,version)) | |
599 | (lib (string-append out "/lib/mit-scheme-" | |
600 | ,(system-suffix) | |
601 | "/scmutils"))) | |
602 | (for-each mkdir-p (list lib doc bin)) | |
603 | (with-directory-excursion "scmutils/scmutils" | |
604 | (copy-files-to-directory '("COPYING" "LICENSE") | |
605 | doc #t) | |
606 | (for-each delete-file (find-files "." "\\.bin")) | |
607 | (copy-files-to-directory '("edwin-mechanics.com") | |
608 | (string-append lib "/..") #t) | |
609 | (copy-recursively "." lib)) | |
610 | (with-directory-excursion "bin" | |
611 | (copy-files-to-directory (find-files ".") bin)) | |
612 | (with-directory-excursion "scmutils/manual" | |
613 | (copy-files-to-directory (find-files ".") doc)) | |
614 | #t))) | |
615 | (add-after 'install 'emacs-helpers | |
616 | ;; Add convenience Emacs commands to easily load the | |
617 | ;; Scmutils band in an MIT-Scheme buffer inside of Emacs | |
618 | ;; and to easily load code tags. | |
619 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
620 | (let* ((out (assoc-ref outputs "out")) | |
621 | (mit-root (assoc-ref inputs "mit-scheme")) | |
622 | (emacs-lisp-dir | |
623 | (string-append out "/share/emacs/site-lisp" | |
624 | "/guix.d/" ,name "-" ,version)) | |
625 | (el-file (string-append emacs-lisp-dir | |
626 | "/scmutils.el")) | |
627 | (lib-relative-path | |
628 | (string-append "/lib/mit-scheme-" | |
629 | ,(system-suffix)))) | |
630 | (mkdir-p emacs-lisp-dir) | |
631 | (call-with-output-file el-file | |
632 | (lambda (p) | |
633 | (format p | |
634 | ";;;###autoload | |
635 | (defun scmutils-load () | |
636 | (interactive) | |
637 | (require 'xscheme) | |
638 | (let ((mit-root \"~a\") | |
639 | (scmutils \"~a\")) | |
640 | (run-scheme | |
641 | (concat mit-root \"/bin/scheme --library \" | |
642 | mit-root \"~a:\" scmutils \"~a\" | |
643 | \" --band edwin-mechanics.com\" | |
644 | \" --emacs\")))) | |
645 | ||
646 | ;;;###autoload | |
647 | (defun scmutils-load-tags () | |
648 | (interactive) | |
649 | (let ((scmutils \"~a\")) | |
650 | (visit-tags-table (concat scmutils \"/TAGS\")))) | |
651 | " | |
652 | mit-root out | |
653 | lib-relative-path | |
654 | lib-relative-path | |
655 | (string-append out lib-relative-path | |
656 | "/scmutils")))) | |
aad4a48a FB |
657 | (emacs-generate-autoloads ,name emacs-lisp-dir) |
658 | (emacs-byte-compile-directory emacs-lisp-dir) | |
c093f9f6 FB |
659 | #t)))))) |
660 | (home-page | |
661 | "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm") | |
662 | (synopsis "Scmutils library for MIT Scheme") | |
663 | (description "The Scmutils system is an integrated library of | |
664 | procedures, embedded in the programming language Scheme, and intended to | |
665 | support teaching and research in mathematical physics and electrical | |
666 | engineering.") | |
667 | (license gpl2+)))) |