gnu: Add librepcb.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
CommitLineData
e117772d 1;;; GNU Guix --- Functional package management for GNU
d4bd8762 2;;; Copyright © 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
07f4aef0 3;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
549f9512 4;;; Copyright © 2015, 2016 Federico Beffa <beffa@fbengineering.ch>
d0d94110 5;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
7c028db5 6;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
b9b447be 7;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
4a78fd46 8;;; Copyright © 2016, 2017 Nils Gillmann <ng0@n0.is>
07ef08a7 9;;; Copyright © 2017 John Darrington <jmd@gnu.org>
01d71f62 10;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
e39631a9 11;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
44fa8431 12;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
e117772d
LC
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
1ffa7090 29(define-module (gnu packages scheme)
59a43334 30 #:use-module (gnu packages)
bc73a843 31 #:use-module ((guix licenses)
07ef08a7
JD
32 #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
33 cc-by-sa4.0 non-copyleft))
e117772d
LC
34 #:use-module (guix packages)
35 #:use-module (guix download)
b9b447be 36 #:use-module (guix git-download)
07f4aef0 37 #:use-module (guix utils)
e117772d 38 #:use-module (guix build-system gnu)
b9b447be 39 #:use-module (guix build-system trivial)
5e3ea571 40 #:use-module (gnu packages bdw-gc)
549f9512 41 #:use-module (gnu packages compression)
5e3ea571
KK
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages libunistring)
1ffa7090
LC
44 #:use-module (gnu packages m4)
45 #:use-module (gnu packages multiprecision)
549f9512 46 #:use-module (gnu packages ncurses)
5e3ea571 47 #:use-module (gnu packages pcre)
d3206af6 48 #:use-module (gnu packages databases)
1ffa7090 49 #:use-module (gnu packages emacs)
549f9512
FB
50 #:use-module (gnu packages ghostscript)
51 #:use-module (gnu packages netpbm)
1ffa7090 52 #:use-module (gnu packages texinfo)
8f9ac901 53 #:use-module (gnu packages tex)
ce0614dd 54 #:use-module (gnu packages base)
b9b447be 55 #:use-module (gnu packages compression)
cf53ecf5
LC
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages avahi)
58 #:use-module (gnu packages libphidget)
ffc13e75 59 #:use-module (gnu packages gcc)
30645251 60 #:use-module (gnu packages glib)
9d3c4dae 61 #:use-module (gnu packages gtk)
30645251 62 #:use-module (gnu packages libffi)
d3206af6 63 #:use-module (gnu packages fontutils)
e55354b8 64 #:use-module (gnu packages image)
bc11c72c 65 #:use-module (gnu packages xorg)
782170c4
SB
66 #:use-module (gnu packages tls)
67 #:use-module (gnu packages gl)
e0b49c78 68 #:use-module (gnu packages libedit)
e83c7d1a 69 #:use-module (srfi srfi-1)
e117772d
LC
70 #:use-module (ice-9 match))
71
a0efb39a 72(define (mit-scheme-source-directory system version)
ecb26c10
AE
73 (string-append "mit-scheme-"
74 (if (or (string-prefix? "x86_64" system)
a0efb39a 75 (string-prefix? "i686" system))
ecb26c10
AE
76 ""
77 "c-")
78 version))
79
e117772d
LC
80(define-public mit-scheme
81 (package
82 (name "mit-scheme")
6c4a2884 83 (version "9.2")
e117772d 84 (source #f) ; see below
f163c290 85 (outputs '("out" "doc"))
e117772d
LC
86 (build-system gnu-build-system)
87 (arguments
88 `(#:tests? #f ; no "check" target
f163c290
FB
89 #:modules ((guix build gnu-build-system)
90 (guix build utils)
91 (srfi srfi-1))
e117772d 92 #:phases
af00e633
FB
93 (modify-phases %standard-phases
94 (replace 'unpack
95 (lambda* (#:key inputs #:allow-other-keys)
e39631a9
TGR
96 (invoke "tar" "xzvf"
97 (assoc-ref inputs "source"))
98 (chdir ,(mit-scheme-source-directory (%current-system)
99 version))
100 ;; Delete these dangling symlinks since they break
101 ;; `patch-shebangs'.
102 (for-each delete-file
103 (append '("src/lib/shim-config.scm")
104 (find-files "src/lib/lib" "\\.so$")
105 (find-files "src/lib" "^liarc-")
106 (find-files "src/compiler" "^make\\.")))
107 (chdir "src")
108 #t))
9b02a79b
PN
109 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
110 ;; them in HOME, so it needs to be writeable.
111 (add-before 'build 'set-HOME
112 (lambda _ (setenv "HOME" "/tmp") #t))
af00e633
FB
113 (replace 'build
114 (lambda* (#:key system outputs #:allow-other-keys)
115 (let ((out (assoc-ref outputs "out")))
116 (if (or (string-prefix? "x86_64" system)
117 (string-prefix? "i686" system))
e39631a9
TGR
118 (invoke "make" "compile-microcode")
119 (invoke "./etc/make-liarc.sh"
120 (string-append "--prefix=" out)))
121 #t)))
f163c290
FB
122 (add-after 'configure 'configure-doc
123 (lambda* (#:key outputs inputs #:allow-other-keys)
124 (with-directory-excursion "../doc"
125 (let* ((out (assoc-ref outputs "out"))
126 (bash (assoc-ref inputs "bash"))
127 (bin/sh (string-append bash "/bin/sh")))
e39631a9
TGR
128 (invoke bin/sh "./configure"
129 (string-append "--prefix=" out)
130 (string-append "SHELL=" bin/sh))
f163c290
FB
131 (substitute* '("Makefile" "make-common")
132 (("/lib/mit-scheme/doc")
133 (string-append "/share/doc/" ,name "-" ,version)))
134 #t))))
135 (add-after 'build 'build-doc
136 (lambda* _
137 (with-directory-excursion "../doc"
e39631a9
TGR
138 (invoke "make"))
139 #t))
f163c290
FB
140 (add-after 'install 'install-doc
141 (lambda* (#:key outputs #:allow-other-keys)
142 (let* ((out (assoc-ref outputs "out"))
143 (doc (assoc-ref outputs "doc"))
144 (old-doc-dir (string-append out "/share/doc"))
145 (new-doc/mit-scheme-dir
146 (string-append doc "/share/doc/" ,name "-" ,version)))
147 (with-directory-excursion "../doc"
148 (for-each (lambda (target)
e39631a9 149 (invoke "make" target))
f163c290
FB
150 '("install-config" "install-info-gz" "install-man"
151 "install-html" "install-pdf")))
152 (mkdir-p new-doc/mit-scheme-dir)
153 (copy-recursively
154 (string-append old-doc-dir "/" ,name "-" ,version)
155 new-doc/mit-scheme-dir)
156 (delete-file-recursively old-doc-dir)
157 #t))))))
158 (native-inputs
9b02a79b 159 `(("texlive" ,(texlive-union (list texlive-tex-texinfo)))
f163c290
FB
160 ("texinfo" ,texinfo)
161 ("m4" ,m4)))
e117772d 162 (inputs
f163c290 163 `(("libx11" ,libx11)
e117772d
LC
164
165 ("source"
dd6b9a37
LC
166
167 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
168 ;; compile from the architecture-specific tarballs, which contain
169 ;; pre-built binaries. It leads to more efficient code than when
170 ;; building the tarball that contains generated C code instead of
171 ;; those binaries.
172 ,(origin
173 (method url-fetch)
174 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
175 version "/mit-scheme-"
dd6b9a37 176 (match (%current-system)
ecb26c10
AE
177 ("x86_64-linux"
178 (string-append version "-x86-64"))
179 ("i686-linux"
180 (string-append version "-i386"))
181 (_
182 (string-append "c-" version)))
dd6b9a37
LC
183 ".tar.gz"))
184 (sha256
185 (match (%current-system)
186 ("x86_64-linux"
187 (base32
6c4a2884 188 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
dd6b9a37
LC
189 ("i686-linux"
190 (base32
6c4a2884 191 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
dd6b9a37
LC
192 (_
193 (base32
6c4a2884 194 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
75af27f7
LC
195
196 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
7c028db5 197 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
75af27f7 198
6fd52309 199 (home-page "https://www.gnu.org/software/mit-scheme/")
a2b63d58 200 (synopsis "A Scheme implementation with integrated editor and debugger")
e117772d 201 (description
79c311b8 202 "GNU/MIT Scheme is an implementation of the Scheme programming
a22dc0c4
LC
203language. It provides an interpreter, a compiler and a debugger. It also
204features an integrated Emacs-like editor and a large runtime library.")
63e8bb12
LC
205 (license gpl2+)
206 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
e117772d
LC
207
208(define-public bigloo
1fe1bb96
LC
209 ;; Upstream modifies source tarballs in place, making significant changes
210 ;; long after the initial publication: <https://bugs.gnu.org/33525>. For
211 ;; transparency, we give this "second 4.3b" release a different version
212 ;; number.
213 (let ((upstream-version "4.3b"))
214 (package
215 (name "bigloo")
216 (version "4.3b2")
217 (source (origin
218 (method url-fetch)
219 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
220 upstream-version ".tar.gz"))
221 (sha256
222 (base32
223 "02s0wrz5b1p0yqk9x6kax1vwzil7g9cyxfvl3vmy7fzznsza9gs4"))
224 ;; Remove bundled libraries.
225 (modules '((guix build utils)))
226 (snippet
227 '(begin
228 (for-each delete-file-recursively
229 '("gc" "gmp" "libuv"))
230 #t))))
231 (build-system gnu-build-system)
232 (arguments
233 `(#:test-target "test"
234 #:phases
235 (modify-phases %standard-phases
236 (replace 'configure
237 (lambda* (#:key inputs outputs #:allow-other-keys)
e117772d 238
1fe1bb96
LC
239 (substitute* "configure"
240 (("^shell=.*$")
241 (string-append "shell=" (which "bash") "\n"))
242 (("`date`") "0"))
243 (substitute* "autoconf/runtest.in"
244 ((", @DATE@") ""))
245 (substitute* "autoconf/osversion"
246 (("^version.*$") "version=\"\"\n"))
247 (substitute* "comptime/Makefile"
248 (("\\$\\(LDCOMPLIBS\\)")
249 "$(LDCOMPLIBS) $(LDFLAGS)"))
e117772d 250
1fe1bb96
LC
251 ;; The `configure' script doesn't understand options
252 ;; of those of Autoconf.
253 (let ((out (assoc-ref outputs "out")))
254 (invoke "./configure"
255 (string-append "--prefix=" out)
256 ; use system libraries
257 "--customgc=no"
258 "--customunistring=no"
259 "--customlibuv=no"
260 (string-append"--mv=" (which "mv"))
261 (string-append "--rm=" (which "rm"))
262 "--cflags=-fPIC"
263 (string-append "--ldflags=-Wl,-rpath="
264 (assoc-ref outputs "out")
265 "/lib/bigloo/" ,upstream-version)
266 (string-append "--lispdir=" out
267 "/share/emacs/site-lisp")
268 "--sharedbde=yes"
269 "--sharedcompiler=yes"
270 "--disable-patch"))))
271 (add-after 'install 'install-emacs-modes
272 (lambda* (#:key outputs #:allow-other-keys)
273 (let* ((out (assoc-ref outputs "out"))
274 (dir (string-append out "/share/emacs/site-lisp")))
275 (invoke "make" "-C" "bmacs" "all" "install"
276 (string-append "EMACSBRAND=emacs25")
277 (string-append "EMACSDIR=" dir))))))))
278 (inputs
279 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
280 ("libgc" ,libgc)
281 ("libunistring" ,libunistring)
282 ("libuv" ,libuv)
283 ("openssl" ,openssl)
284 ("sqlite" ,sqlite)
cf53ecf5 285
1fe1bb96
LC
286 ;; Optional APIs for which Bigloo has bindings.
287 ("avahi" ,avahi)
288 ("libphidget" ,libphidget)
289 ("pcre" ,pcre)))
290 (native-inputs
291 `(("pkg-config" ,pkg-config)))
292 (propagated-inputs
293 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
294 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
295 (synopsis "Efficient Scheme compiler")
296 (description
297 "Bigloo is a Scheme implementation devoted to one goal: enabling Scheme
298based programming style where C(++) is usually required. Bigloo attempts to
299make Scheme practical by offering features usually presented by traditional
300programming languages but not offered by Scheme and functional programming.
301Bigloo compiles Scheme modules. It delivers small and fast stand alone binary
302executables. Bigloo enables full connections between Scheme and C programs
303and between Scheme and Java programs.")
304 (license gpl2+))))
e6e82f62
LC
305
306(define-public hop
307 (package
308 (name "hop")
082725b5 309 (version "3.1.0-pre2")
e6e82f62
LC
310 (source (origin
311 (method url-fetch)
312 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
313 version ".tar.gz"))
314 (sha256
315 (base32
d4bd8762 316 "0bvq79vxcpgwydwi923cxb5w9isx2x8r3d0xndbdhacmmsw1m811"))))
e6e82f62
LC
317 (build-system gnu-build-system)
318 (arguments
082725b5
KK
319 `(#:test-target "test"
320 #:make-flags '("BIGLOO=bigloo")
321 #:parallel-build? #f
322 #:phases
04014de6
EF
323 (modify-phases %standard-phases
324 (replace 'configure
082725b5 325 (lambda* (#:key inputs outputs #:allow-other-keys)
04014de6 326 (let ((out (assoc-ref outputs "out")))
24674e61
TGR
327 (invoke "./configure"
328 (string-append "--prefix=" out)
329 (string-append "--blflags="
330 ;; user flags completely override useful
331 ;; default flags, so repeat them here.
332 "-copt \\$(CPICFLAGS) "
333 "-L \\$(BUILDLIBDIR) "
334 "-ldopt -Wl,-rpath," out "/lib"))))))))
a394c60a
AE
335 (inputs `(("avahi" ,avahi)
336 ("bigloo" ,bigloo)
082725b5
KK
337 ("libgc" ,libgc)
338 ("libunistring" ,libunistring)
339 ("libuv" ,libuv)
340 ("pcre" ,pcre)
341 ("sqlite" ,sqlite)
8a629613 342 ("which" ,which)))
e6e82f62 343 (home-page "http://hop.inria.fr/")
9e771e3b 344 (synopsis "Multi-tier programming language for the Web 2.0")
e6e82f62
LC
345 (description
346 "HOP is a multi-tier programming language for the Web 2.0 and the
347so-called diffuse Web. It is designed for programming interactive web
348applications in many fields such as multimedia (web galleries, music players,
349...), ubiquitous and house automation (SmartPhones, personal appliance),
350mashups, office (web agendas, mail clients, ...), etc.")
351 (license gpl2+)))
8cc9e7f9
LC
352
353(define-public chicken
354 (package
355 (name "chicken")
79bffa3e 356 (version "4.13.0")
8cc9e7f9 357 (source (origin
b9b6db45 358 (method url-fetch)
359e9c42 359 (uri (string-append "https://code.call-cc.org/releases/"
b9b6db45 360 version "/chicken-" version ".tar.gz"))
b9b6db45
KK
361 (sha256
362 (base32
79bffa3e 363 "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd"))))
8cc9e7f9
LC
364 (build-system gnu-build-system)
365 (arguments
366 `(#:modules ((guix build gnu-build-system)
367 (guix build utils)
368 (srfi srfi-1))
44fa8431 369
8cc9e7f9
LC
370 ;; No `configure' script; run "make check" after "make install" as
371 ;; prescribed by README.
acb38070
RW
372 #:phases
373 (modify-phases %standard-phases
374 (delete 'configure)
375 (delete 'check)
376 (add-after 'install 'check
b9b6db45 377 (assoc-ref %standard-phases 'check)))
8cc9e7f9
LC
378
379 #:make-flags (let ((out (assoc-ref %outputs "out")))
380 (list "PLATFORM=linux"
381 (string-append "PREFIX=" out)
382 (string-append "VARDIR=" out "/var/lib")))
383
384 ;; Parallel builds are not supported, as noted in README.
385 #:parallel-build? #f))
386 (home-page "http://www.call-cc.org/")
387 (synopsis "R5RS Scheme implementation that compiles native code via C")
388 (description
389 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
390produces portable and efficient C, supports almost all of the R5RS Scheme
2c4b49ed 391language standard, and includes many enhancements and extensions.")
8cc9e7f9 392 (license bsd-3)))
f7ce90e7
LC
393
394(define-public scheme48
395 (package
396 (name "scheme48")
5c4d98ab 397 (version "1.9.2")
f7ce90e7
LC
398 (source (origin
399 (method url-fetch)
400 (uri (string-append "http://s48.org/" version
401 "/scheme48-" version ".tgz"))
402 (sha256
403 (base32
5c4d98ab 404 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
fc1adab1 405 (patches (search-patches "scheme48-tests.patch"))))
f7ce90e7 406 (build-system gnu-build-system)
f7ce90e7
LC
407 (home-page "http://s48.org/")
408 (synopsis "Scheme implementation using a bytecode interpreter")
409 (description
410 "Scheme 48 is an implementation of Scheme based on a byte-code
411interpreter and is designed to be used as a testbed for experiments in
412implementation techniques and as an expository tool.")
413
414 ;; Most files are BSD-3; see COPYING for the few exceptions.
415 (license bsd-3)))
30645251
LC
416
417(define-public racket
418 (package
419 (name "racket")
e0b49c78 420 (version "7.0")
30645251 421 (source (origin
e0b49c78
KH
422 (method url-fetch)
423 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
424 version "/racket-" version "-src.tgz")
425 (string-append
426 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
427 version "/racket-" version "-src.tgz")))
428 (sha256
429 (base32
430 "1glv5amsp9xp480d4yr63hhm9kkyav06yl3a6p489nkr4cln0j9a"))
431 (patches (search-patches
432 "racket-store-checksum-override.patch"))))
30645251
LC
433 (build-system gnu-build-system)
434 (arguments
435 '(#:phases
dc1d3cde
KK
436 (modify-phases %standard-phases
437 (add-before 'configure 'pre-configure
438 (lambda* (#:key inputs #:allow-other-keys)
439 ;; Patch dynamically loaded libraries with their absolute paths.
440 (let* ((library-path (search-path-as-string->list
441 (getenv "LIBRARY_PATH")))
442 (find-so (lambda (soname)
443 (search-path
444 library-path
445 (format #f "~a.so" soname))))
446 (patch-ffi-libs (lambda (file libs)
447 (for-each
448 (lambda (lib)
449 (substitute* file
450 (((format #f "\"~a\"" lib))
451 (format #f "\"~a\"" (find-so lib)))))
452 libs))))
453 (substitute* "collects/db/private/sqlite3/ffi.rkt"
454 (("ffi-lib sqlite-so")
455 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
456 (substitute* "collects/openssl/libssl.rkt"
457 (("ffi-lib libssl-so")
458 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
459 (substitute* "collects/openssl/libcrypto.rkt"
460 (("ffi-lib libcrypto-so")
461 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
462 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
463 (("ffi-lib libgmp-so")
464 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
465 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
466 (("ffi-lib libmpfr-so")
467 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
26700cae
SB
468 (substitute* "share/pkgs/readline-lib/readline/rktrl.rkt"
469 (("\\(getenv \"PLT_READLINE_LIB\"\\)")
470 (format #f "\"~a\"" (find-so "libedit"))))
dc1d3cde
KK
471 (for-each
472 (lambda (x) (apply patch-ffi-libs x))
473 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
474 ("libfontconfig" "libcairo"))
475 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
476 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
477 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
478 ("libjpeg"))
479 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
480 ("libpango-1.0" "libpangocairo-1.0"))
481 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
482 ("libpng"))
483 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
484 ("libodbc"))
485 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
486 ("libX11"))
487 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
488 ("libgio-2.0"))
489 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
490 ("libgdk-3" "libgtk-3"))
491 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
492 ("libunique-1.0"))
493 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
494 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
495 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
496 ("libGL"))
497 ("share/pkgs/sgl/gl.rkt"
26700cae 498 ("libGL" "libGLU")))))
dc1d3cde
KK
499 (chdir "src")
500 #t))
501 (add-after 'unpack 'patch-/bin/sh
502 (lambda _
503 (substitute* "collects/racket/system.rkt"
504 (("/bin/sh") (which "sh")))
505 #t)))
e0b49c78 506 #:tests? #f ; XXX: how to run them?
30645251 507 ))
782170c4
SB
508 (inputs
509 `(("libffi" ,libffi)
510 ;; Hardcode dynamically loaded libraries for better functionality.
511 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
512 ("cairo" ,cairo)
513 ("fontconfig" ,fontconfig)
514 ("glib" ,glib)
515 ("glu" ,glu)
516 ("gmp" ,gmp)
e0b49c78 517 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
782170c4
SB
518 ("libjpeg" ,libjpeg)
519 ("libpng" ,libpng)
520 ("libx11" ,libx11)
521 ("mesa" ,mesa)
522 ("mpfr" ,mpfr)
523 ("openssl" ,openssl)
524 ("pango" ,pango)
525 ("sqlite" ,sqlite)
e0b49c78
KH
526 ("unixodbc" ,unixodbc)
527 ("libedit" ,libedit)))
30645251
LC
528 (home-page "http://racket-lang.org")
529 (synopsis "Implementation of Scheme and related languages")
530 (description
531 "Racket is an implementation of the Scheme programming language (R5RS and
532R6RS) and related languages, such as Typed Racket. It features a compiler and
533a virtual machine with just-in-time native compilation, as well as a large set
534of libraries.")
39d0ce93 535 (license lgpl2.0+)))
07f4aef0
TUBK
536
537(define-public gambit-c
538 (package
539 (name "gambit-c")
4be83af4 540 (version "4.9.0")
07f4aef0
TUBK
541 (source
542 (origin
543 (method url-fetch)
544 (uri (string-append
545 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
9ba88890 546 (version-major+minor version) "/source/gambit-v"
07f4aef0
TUBK
547 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
548 ".tgz"))
549 (sha256
4be83af4 550 (base32 "19862w9ij0g5xrkskl4g89xbs17gp9cc6cfcdca6dlfkb3lk6xhp"))))
07f4aef0
TUBK
551 (build-system gnu-build-system)
552 (arguments
553 '(#:configure-flags
554 ;; According to the ./configure script, this makes the build slower and
555 ;; use >= 1 GB memory, but makes Gambit much faster.
4be83af4 556 '("--enable-single-host")))
4e9832dd 557 (home-page "http://gambitscheme.org")
07f4aef0
TUBK
558 (synopsis "Efficient Scheme interpreter and compiler")
559 (description
560 "Gambit consists of two main programs: gsi, the Gambit Scheme
561interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
562the complete execution and debugging environment. The compiler is the
563interpreter extended with the capability of generating executable files. The
564compiler can produce standalone executables or compiled modules which can be
565loaded at run time. Interpreted code and compiled code can be freely
566mixed.")
567 ;; Dual license.
568 (license (list lgpl2.1+ asl2.0))))
3e92f4f9
TUBK
569
570(define-public chibi-scheme
571 (package
572 (name "chibi-scheme")
51960939 573 (version "0.7.3")
3e92f4f9
TUBK
574 (source
575 (origin
576 (method url-fetch)
51960939
TUBK
577 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
578 version ".tar.gz"))
3e92f4f9 579 (sha256
51960939
TUBK
580 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
581 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
3e92f4f9
TUBK
582 (build-system gnu-build-system)
583 (arguments
4a187c55
LC
584 `(#:phases (modify-phases %standard-phases
585 (delete 'configure)
586 (add-before 'build 'set-cc
587 (lambda _
588 (setenv "CC" "gcc"))))
3e92f4f9
TUBK
589 #:make-flags (let ((out (assoc-ref %outputs "out")))
590 (list (string-append "PREFIX=" out)
591 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
592 #:test-target "test"))
50995554 593 (home-page "https://github.com/ashinn/chibi-scheme")
3e92f4f9
TUBK
594 (synopsis "Small embeddable Scheme implementation")
595 (description
596 "Chibi-Scheme is a very small library with no external dependencies
597intended for use as an extension and scripting language in C programs. In
598addition to support for lightweight VM-based threads, each VM itself runs in
599an isolated heap allowing multiple VMs to run simultaneously in different OS
600threads.")
601 (license bsd-3)))
c093f9f6 602
c093f9f6
FB
603(define-public scmutils
604 (let ()
605 (define (system-suffix)
606 (cond
607 ((string-prefix? "x86_64" (or (%current-target-system)
608 (%current-system)))
609 "x86-64")
610 (else "i386")))
611
612 (package
613 (name "scmutils")
595b1751 614 (version "20160827")
c093f9f6
FB
615 (source
616 (origin
95001d4b 617 (method url-fetch/tarbomb)
c093f9f6 618 (modules '((guix build utils)))
6cbee49d
MW
619 (snippet '(begin
620 ;; Remove binary code
621 (delete-file-recursively "scmutils/mit-scheme")
622 #t))
c093f9f6
FB
623 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
624 "/scmutils-tarballs/" name "-" version
625 "-x86-64-gnu-linux.tar.gz"))
626 (sha256
595b1751 627 (base32 "00ly5m0s4dy5kxravjaqlpii5zcnr6b9nqm0607lr7xcs52i4j8b"))))
c093f9f6
FB
628 (build-system gnu-build-system)
629 (inputs
630 `(("mit-scheme" ,mit-scheme)
b8fc3622 631 ("emacs" ,emacs-minimal)))
c093f9f6
FB
632 (arguments
633 `(#:tests? #f ;; no tests-suite
634 #:modules ((guix build gnu-build-system)
635 (guix build utils)
636 (guix build emacs-utils))
637 #:imported-modules (,@%gnu-build-system-modules
638 (guix build emacs-utils))
639 #:phases
640 (modify-phases %standard-phases
641 (replace 'configure
595b1751
KK
642 ;; No standard build procedure is used. We set the correct
643 ;; runtime path in the custom build system.
644 (lambda* (#:key outputs #:allow-other-keys)
645 (let ((out (assoc-ref outputs "out")))
646 ;; Required to find .bci files at runtime.
647 (with-directory-excursion "scmutils"
648 (rename-file "src" "scmutils"))
649 (substitute* "scmutils/scmutils/load.scm"
650 (("/usr/local/scmutils/")
651 (string-append out "/lib/mit-scheme-"
652 ,(system-suffix) "/")))
653 #t)))
c093f9f6 654 (replace 'build
595b1751
KK
655 ;; Compile the code and build a band.
656 (lambda* (#:key outputs #:allow-other-keys)
657 (let* ((out (assoc-ref outputs "out"))
658 (make-img (string-append
659 "echo '(load \"load\") "
660 "(disk-save \"edwin-mechanics.com\")'"
661 "| mit-scheme")))
662 (with-directory-excursion "scmutils/scmutils"
663 (and (zero? (system "mit-scheme < compile.scm"))
b69819d8
TGR
664 (zero? (system make-img))))
665 #t)))
c093f9f6 666 (add-before 'install 'fix-directory-names
595b1751
KK
667 ;; Correct directory names in the startup script.
668 (lambda* (#:key inputs outputs #:allow-other-keys)
669 (let* ((out (assoc-ref outputs "out"))
670 (scm-root (assoc-ref inputs "mit-scheme")))
671 (substitute* "bin/mechanics"
672 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
673 (string-append
674 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
675 "LIB=\"${ROOT}/lib/mit-scheme-"
676 ,(system-suffix) ":"
677 out "/lib/mit-scheme-" ,(system-suffix) "\""))
678 (("EDWIN_INFO_DIRECTORY=.*\n") "")
679 (("SCHEME=.*\n")
680 (string-append "SCHEME=\"${ROOT}/bin/scheme "
681 "--library ${LIB}\"\n"))
682 (("export EDWIN_INFO_DIRECTORY") ""))
683 #t)))
c093f9f6 684 (add-before 'install 'emacs-tags
595b1751
KK
685 ;; Generate Emacs's tags for easy reference to source
686 ;; code.
687 (lambda* (#:key inputs outputs #:allow-other-keys)
688 (with-directory-excursion "scmutils/scmutils"
b69819d8
TGR
689 (apply invoke "etags" (find-files "." "\\.scm")))
690 #t))
c093f9f6 691 (replace 'install
595b1751
KK
692 ;; Copy files to the store.
693 (lambda* (#:key outputs #:allow-other-keys)
694 (define* (copy-files-to-directory files dir
695 #:optional (delete? #f))
696 (for-each (lambda (f)
697 (copy-file f (string-append dir "/" f))
698 (when delete? (delete-file f)))
699 files))
c093f9f6 700
595b1751
KK
701 (let* ((out (assoc-ref outputs "out"))
702 (bin (string-append out "/bin"))
703 (doc (string-append out "/share/doc/"
704 ,name "-" ,version))
705 (lib (string-append out "/lib/mit-scheme-"
706 ,(system-suffix)
707 "/scmutils")))
708 (for-each mkdir-p (list lib doc bin))
709 (with-directory-excursion "scmutils/scmutils"
710 (copy-files-to-directory '("COPYING" "LICENSE")
711 doc #t)
712 (for-each delete-file (find-files "." "\\.bin"))
713 (copy-files-to-directory '("edwin-mechanics.com")
714 (string-append lib "/..") #t)
715 (copy-recursively "." lib))
716 (with-directory-excursion "bin"
717 (copy-files-to-directory (find-files ".") bin))
718 (with-directory-excursion "scmutils/manual"
719 (copy-files-to-directory (find-files ".") doc))
720 #t)))
c093f9f6 721 (add-after 'install 'emacs-helpers
595b1751
KK
722 ;; Add convenience Emacs commands to easily load the
723 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
724 ;; and to easily load code tags.
725 (lambda* (#:key inputs outputs #:allow-other-keys)
726 (let* ((out (assoc-ref outputs "out"))
727 (mit-root (assoc-ref inputs "mit-scheme"))
728 (emacs-lisp-dir
729 (string-append out "/share/emacs/site-lisp"
730 "/guix.d/" ,name "-" ,version))
731 (el-file (string-append emacs-lisp-dir
732 "/scmutils.el"))
733 (lib-relative-path
734 (string-append "/lib/mit-scheme-"
735 ,(system-suffix))))
736 (mkdir-p emacs-lisp-dir)
737 (call-with-output-file el-file
738 (lambda (p)
739 (format p
740 ";;;###autoload
c093f9f6
FB
741(defun scmutils-load ()
742 (interactive)
743 (require 'xscheme)
744 (let ((mit-root \"~a\")
745 (scmutils \"~a\"))
746 (run-scheme
747 (concat mit-root \"/bin/scheme --library \"
748 mit-root \"~a:\" scmutils \"~a\"
749 \" --band edwin-mechanics.com\"
750 \" --emacs\"))))
751
752;;;###autoload
753(defun scmutils-load-tags ()
754 (interactive)
755 (let ((scmutils \"~a\"))
756 (visit-tags-table (concat scmutils \"/TAGS\"))))
757"
758 mit-root out
759 lib-relative-path
760 lib-relative-path
761 (string-append out lib-relative-path
762 "/scmutils"))))
aad4a48a
FB
763 (emacs-generate-autoloads ,name emacs-lisp-dir)
764 (emacs-byte-compile-directory emacs-lisp-dir)
c093f9f6
FB
765 #t))))))
766 (home-page
767 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
768 (synopsis "Scmutils library for MIT Scheme")
769 (description "The Scmutils system is an integrated library of
770procedures, embedded in the programming language Scheme, and intended to
771support teaching and research in mathematical physics and electrical
772engineering.")
773 (license gpl2+))))
b9b447be
JN
774
775(define-public sicp
2705a97e 776 (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
b9b447be
JN
777 (package
778 (name "sicp")
2705a97e 779 (version (string-append "20170703-1." (string-take commit 7)))
b9b447be
JN
780 (source (origin
781 (method git-fetch)
782 (uri (git-reference
783 (url "https://github.com/sarabander/sicp")
784 (commit commit)))
785 (sha256
786 (base32
2705a97e 787 "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
b9b447be
JN
788 (file-name (string-append name "-" version "-checkout"))))
789 (build-system trivial-build-system)
790 (native-inputs `(("gzip" ,gzip)
791 ("source" ,source)
792 ("texinfo" ,texinfo)))
793 (arguments
794 `(#:modules ((guix build utils)
795 (srfi srfi-1)
796 (srfi srfi-26))
797 #:builder
798 (begin
799 (use-modules (guix build utils)
800 (srfi srfi-1)
801 (srfi srfi-26))
802 (let ((gzip (assoc-ref %build-inputs "gzip"))
803 (source (assoc-ref %build-inputs "source"))
804 (texinfo (assoc-ref %build-inputs "texinfo"))
01d71f62 805 (html-dir (string-append %output "/share/doc/" ,name "/html"))
b9b447be 806 (info-dir (string-append %output "/share/info")))
01d71f62 807 (copy-recursively (string-append source "/html") html-dir)
b9b447be
JN
808 (setenv "PATH" (string-append gzip "/bin"
809 ":" texinfo "/bin"))
810 (mkdir-p info-dir)
09b8c04e
MW
811 (invoke "makeinfo" "--output"
812 (string-append info-dir "/sicp.info")
813 (string-append source "/sicp-pocket.texi"))
814 (for-each (cut invoke "gzip" "-9n" <>)
815 (find-files info-dir))
816 #t))))
0e0015f2 817 (home-page "https://sarabander.github.io/sicp")
b9b447be
JN
818 (synopsis "Structure and Interpretation of Computer Programs")
819 (description "Structure and Interpretation of Computer Programs (SICP) is
820a textbook aiming to teach the principles of computer programming.
821
822Using Scheme, a dialect of the Lisp programming language, the book explains
823core computer science concepts such as abstraction in programming,
824metalinguistic abstraction, recursion, interpreters, and modular programming.")
825 (license cc-by-sa4.0))))
8a0c2552 826
827(define-public scheme48-rx
7108ad5b
TGR
828 (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
829 (revision "2"))
8a0c2552 830 (package
831 (name "scheme48-rx")
832 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
833 (source
834 (origin
835 (method git-fetch)
836 (uri (git-reference
837 (url "https://github.com/scheme/rx")
838 (commit commit)))
839 (sha256
840 (base32
7108ad5b 841 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
8a0c2552 842 (file-name (string-append name "-" version "-checkout"))))
843 (build-system trivial-build-system)
844 (arguments
845 `(#:modules ((guix build utils))
846 #:builder
847 (begin
848 (use-modules (guix build utils))
849 (let ((share (string-append %output
850 "/share/scheme48-"
851 ,(package-version scheme48)
852 "/rx")))
853 (chdir (assoc-ref %build-inputs "source"))
854 (mkdir-p share)
e3cfef22
MW
855 (copy-recursively "." share)
856 #t))))
8a0c2552 857 (native-inputs
858 `(("source" ,source)
859 ("scheme48" ,scheme48)))
860 (home-page "https://github.com/scheme/rx/")
861 (synopsis "SRE String pattern-matching library for scheme48")
862 (description
863 "String pattern-matching library for scheme48 based on the SRE
864regular-expression notation.")
865 (license bsd-3))))
07ef08a7
JD
866
867(define-public slib
868 (package
869 (name "slib")
870 (version "3b5")
871 (source (origin
872 (method url-fetch)
873 (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
874 version ".zip"))
875 (sha256
876 (base32
877 "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
878 (build-system gnu-build-system)
879 (arguments
880 `(#:tests? #f ; There is no check target.
881 #:phases
882 (modify-phases %standard-phases
883 (add-after 'install 'remove-bin-share
884 (lambda* (#:key inputs outputs #:allow-other-keys)
885 (delete-file-recursively
2e14ca19
TGR
886 (string-append (assoc-ref outputs "out") "/bin"))
887 #t))
07ef08a7
JD
888 (replace 'configure
889 (lambda* (#:key inputs outputs #:allow-other-keys)
2e14ca19
TGR
890 (invoke "./configure"
891 (string-append "--prefix="
892 (assoc-ref outputs "out"))))))))
07ef08a7
JD
893 (native-inputs `(("unzip" ,unzip)
894 ("texinfo" ,texinfo)))
30fd958e 895 (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
07ef08a7
JD
896 (synopsis "Compatibility and utility library for Scheme")
897 (description "SLIB is a portable Scheme library providing compatibility and
898utility functions for all standard Scheme implementations.")
899 (license (non-copyleft
900 "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
901 "Or see COPYING in the distribution."))))
902
8c48d0eb
JD
903(define-public scm
904 (package
905 (name "scm")
906 (version "5f2")
907 (source (origin
908 (method url-fetch)
909 (uri (string-append
910 "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
911 version ".zip"))
912 (sha256
913 (base32
914 "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
915 (build-system gnu-build-system)
916 (arguments
917 `(#:phases
918 (modify-phases %standard-phases
919 (replace 'configure
920 (lambda* (#:key inputs outputs #:allow-other-keys)
b44b14cd
TGR
921 (invoke "./configure"
922 (string-append "--prefix="
923 (assoc-ref outputs "out")))))
8c48d0eb
JD
924 (add-before 'build 'pre-build
925 (lambda* (#:key inputs #:allow-other-keys)
926 (substitute* "Makefile"
b44b14cd
TGR
927 (("ginstall-info") "install-info"))
928 #t))
8c48d0eb
JD
929 (replace 'build
930 (lambda* (#:key inputs outputs #:allow-other-keys)
931 (setenv "SCHEME_LIBRARY_PATH"
932 (string-append (assoc-ref inputs "slib")
933 "/lib/slib/"))
b44b14cd
TGR
934 (invoke "make" "scmlit" "CC=gcc")
935 (invoke "make" "all")))
8c48d0eb
JD
936 (add-after 'install 'post-install
937 (lambda* (#:key inputs outputs #:allow-other-keys)
b44b14cd
TGR
938 (let* ((out (assoc-ref outputs "out"))
939 (req (string-append out "/lib/scm/require.scm")))
940 (delete-file req)
941 (format (open req (logior O_WRONLY O_CREAT))
942 "(define (library-vicinity) ~s)\n"
943 (string-append (assoc-ref inputs "slib")
944 "/lib/slib/"))
945
946 ;; We must generate the slibcat file.
947 (invoke (string-append out "/bin/scm")
948 "-br" "new-catalog")))))))
8c48d0eb
JD
949 (inputs `(("slib" ,slib)))
950 (native-inputs `(("unzip" ,unzip)
951 ("texinfo" ,texinfo)))
952 (home-page "http://people.csail.mit.edu/jaffer/SCM")
953 (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
954 (description "GNU SCM is an implementation of Scheme. This
955implementation includes Hobbit, a Scheme-to-C compiler, which can
956generate C files whose binaries can be dynamically or statically
957linked with a SCM executable.")
958 (license lgpl3+)))
e2f9847b
TGR
959
960(define-public tinyscheme
961 (package
962 (name "tinyscheme")
963 (version "1.41")
964 (source (origin
965 (method url-fetch)
966 (uri (string-append "mirror://sourceforge/" name "/" name "/"
967 name "-" version "/" name "-" version ".zip"))
968 (sha256
969 (base32
970 "0yqma4jrjgj95f3hf30h542x97n8ah234n19yklbqq0phfsa08wf"))))
971 (build-system gnu-build-system)
972 (native-inputs
973 `(("unzip" ,unzip)))
974 (arguments
975 `(#:phases
976 (modify-phases %standard-phases
977 (replace 'unpack
978 (lambda* (#:key source #:allow-other-keys)
979 (invoke "unzip" source)
980 (chdir (string-append ,name "-" ,version))
981 #t))
982 (add-after 'unpack 'set-scm-directory
983 ;; Hard-code ‘our’ init.scm instead of looking in the current
984 ;; working directory, so invoking ‘scheme’ just works.
985 (lambda* (#:key outputs #:allow-other-keys)
986 (let* ((out (assoc-ref outputs "out"))
987 (scm (string-append out "/share/" ,name)))
988 (substitute* "scheme.c"
989 (("init.scm" all)
990 (string-append scm "/" all)))
991 #t)))
992 (delete 'configure) ; no configure script
993 (replace 'install
994 ;; There's no ‘install’ target. Install files manually.
995 (lambda* (#:key outputs #:allow-other-keys)
996 (let* ((out (assoc-ref outputs "out"))
997 (bin (string-append out "/bin"))
998 (doc (string-append out "/share/doc/"
999 ,name "-" ,version))
1000 (include (string-append out "/include"))
1001 (lib (string-append out "/lib"))
1002 (scm (string-append out "/share/" ,name)))
1003 (install-file "scheme" bin)
1004 (install-file "Manual.txt" doc)
1005 (install-file "scheme.h" include)
1006 (install-file "libtinyscheme.so" lib)
1007 (install-file "init.scm" scm)
1008 #t))))
1009 #:tests? #f)) ; no tests
1010 (home-page "http://tinyscheme.sourceforge.net/")
1011 (synopsis "Light-weight interpreter for the Scheme programming language")
1012 (description
1013 "TinyScheme is a light-weight Scheme interpreter that implements as large a
1014subset of R5RS as was possible without getting very large and complicated.
1015
1016It's meant to be used as an embedded scripting interpreter for other programs.
1017As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or
1018extensive toolkits, although it does sport a small (and optional) top-level
1019loop.
1020
1021As an embedded interpreter, it allows multiple interpreter states to coexist in
1022the same program, without any interference between them. Foreign functions in C
1023can be added and values can be defined in the Scheme environment. Being quite a
1024small program, it is easy to comprehend, get to grips with, and use.")
1025 (license bsd-3))) ; there are no licence headers
44fa8431
AM
1026
1027(define-public stalin
1028 (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
1029 ;; FIXME: The Stalin "source" contains C code generated by itself:
1030 ;; 'stalin-AMD64.c', etc.
1031 (package
1032 (name "stalin")
1033 (version "0.11")
1034 (source (origin
1035 ;; Use Pearlmutter's upstream branch with AMD64 patches
1036 ;; applied. Saves us from including those 20M! patches
1037 ;; in Guix. For more info, see:
1038 ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
1039 (method git-fetch)
1040 (uri (git-reference
1041 (url "https://github.com/barak/stalin.git")
1042 (commit commit)))
1043 (file-name (string-append name "-" version "-checkout"))
1044 (sha256
1045 (base32
1046 "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
1047 (modules '((guix build utils)))
1048 (snippet
1049 ;; remove gc libs from build, we have them as input
1050 '(begin
1051 (delete-file "gc6.8.tar.gz")
1052 (delete-file-recursively "benchmarks")
1053 (substitute* "build"
1054 ((".*gc6.8.*") "")
1055 ((" cd \\.\\.") "")
1056 ((".*B include/libgc.a") "")
1057 ((".*make.*") ""))
1058 #t))))
1059 (build-system gnu-build-system)
1060 (arguments
1061 `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
1062 #:phases
1063 (modify-phases %standard-phases
1064 (replace 'configure
1065 (lambda* (#:key outputs #:allow-other-keys)
1066 (let* ((out (assoc-ref outputs "out"))
1067 (include-out (string-append out "/include")))
1068 (invoke "./build")
1069 (for-each (lambda (fname)
1070 (install-file fname include-out))
1071 (find-files "include"))
1072 (substitute* "makefile"
1073 (("\\./include") include-out))
1074 (substitute* "post-make"
1075 (("`pwd`") out))
1076 #t)))
1077 (delete 'check)
1078 (replace 'install
1079 (lambda* (#:key outputs #:allow-other-keys)
1080 (let ((out (assoc-ref outputs "out")))
1081 (install-file "stalin.1"
1082 (string-append out "/share/man/man1"))
1083 (install-file "stalin"
1084 (string-append out "/bin"))
1085 #t))))))
1086 (inputs
1087 `(("libx11" ,libx11)))
1088 (propagated-inputs
1089 `(("libgc" ,libgc)))
1090 (supported-systems '("x86_64-linux"))
1091 (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
1092 (synopsis "Brutally efficient Scheme compiler")
1093 (description
1094 "Stalin is an aggressively optimizing whole-program compiler
1095for Scheme that does polyvariant interprocedural flow analysis,
1096flow-directed interprocedural escape analysis, flow-directed
1097lightweight CPS conversion, flow-directed lightweight closure
1098conversion, flow-directed interprocedural lifetime analysis, automatic
1099in-lining, unboxing, and flow-directed program-specific and
1100program-point-specific low-level representation selection and code
1101generation.")
1102 (license gpl2+))))
e83c7d1a
PN
1103
1104(define-public femtolisp
1105 (let ((commit "68c5b1225572ecf2c52baf62f928063e5a30511b")
1106 (revision "1"))
1107 (package
1108 (name "femtolisp")
1109 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
1110 (source (origin
1111 (method git-fetch)
1112 (uri (git-reference
1113 (url "https://github.com/JeffBezanson/femtolisp.git")
1114 (commit commit)))
1115 (file-name (string-append name "-" version "-checkout"))
1116 (sha256
1117 (base32
1118 "04rnwllxnl86zw8c6pwxznn49bvkvh0f1lfliy085vjzvlq3rgja"))))
1119 ;; See "utils.h" for supported systems. Upstream bug:
1120 ;; https://github.com/JeffBezanson/femtolisp/issues/25
1121 (supported-systems
1122 (fold delete %supported-systems
1123 '("armhf-linux" "mips64el-linux" "aarch64-linux")))
1124 (build-system gnu-build-system)
1125 (arguments
1126 `(#:make-flags '("CC=gcc" "release")
1127 #:test-target "test"
1128 #:phases
1129 (modify-phases %standard-phases
1130 (delete 'configure) ; No configure script
1131 (replace 'install ; Makefile has no 'install phase
1132 (lambda* (#:key outputs #:allow-other-keys)
1133 (let* ((out (assoc-ref outputs "out"))
1134 (bin (string-append out "/bin")))
1135 (install-file "flisp" bin)
1136 #t)))
1137 ;; The flisp binary is now available, run bootstrap to
1138 ;; generate flisp.boot and afterwards runs make test.
1139 (add-after 'install 'bootstrap-gen-and-test
1140 (lambda* (#:key outputs #:allow-other-keys)
1141 (let* ((out (assoc-ref outputs "out"))
1142 (bin (string-append out "/bin")))
1143 (and
1144 (zero? (system* "./bootstrap.sh"))
1145 (install-file "flisp.boot" bin))))))))
1146 (synopsis "Scheme-like lisp implementation")
1147 (description
1148 "@code{femtolisp} is a scheme-like lisp implementation with a
1149simple, elegant Scheme dialect. It is a lisp-1 with lexical scope.
1150The core is 12 builtin special forms and 33 builtin functions.")
1151 (home-page "https://github.com/JeffBezanson/femtolisp")
1152 (license bsd-3))))