1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
4 ;;; Copyright © 2015, 2016 Federico Beffa <beffa@fbengineering.ch>
5 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016, 2017 Nils Gillmann <ng0@n0.is>
9 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
10 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
11 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
29 (define-module (gnu packages scheme)
30 #:use-module (gnu packages)
31 #:use-module ((guix licenses)
32 #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
33 cc-by-sa4.0 non-copyleft))
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix utils)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system trivial)
40 #:use-module (gnu packages bdw-gc)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages libunistring)
44 #:use-module (gnu packages m4)
45 #:use-module (gnu packages multiprecision)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages databases)
49 #:use-module (gnu packages emacs)
50 #:use-module (gnu packages ghostscript)
51 #:use-module (gnu packages netpbm)
52 #:use-module (gnu packages texinfo)
53 #:use-module (gnu packages tex)
54 #:use-module (gnu packages base)
55 #:use-module (gnu packages compression)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages avahi)
58 #:use-module (gnu packages libphidget)
59 #:use-module (gnu packages gcc)
60 #:use-module (gnu packages glib)
61 #:use-module (gnu packages gtk)
62 #:use-module (gnu packages libffi)
63 #:use-module (gnu packages fontutils)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages xorg)
66 #:use-module (gnu packages tls)
67 #:use-module (gnu packages gl)
68 #:use-module (gnu packages libedit)
69 #:use-module (ice-9 match))
71 (define (mit-scheme-source-directory system version)
72 (string-append "mit-scheme-"
73 (if (or (string-prefix? "x86_64" system)
74 (string-prefix? "i686" system))
79 (define-public mit-scheme
83 (source #f) ; see below
84 (outputs '("out" "doc"))
85 (build-system gnu-build-system)
87 `(#:tests? #f ; no "check" target
88 #:modules ((guix build gnu-build-system)
92 (modify-phases %standard-phases
94 (lambda* (#:key inputs #:allow-other-keys)
96 (assoc-ref inputs "source"))
97 (chdir ,(mit-scheme-source-directory (%current-system)
99 ;; Delete these dangling symlinks since they break
101 (for-each delete-file
102 (append '("src/lib/shim-config.scm")
103 (find-files "src/lib/lib" "\\.so$")
104 (find-files "src/lib" "^liarc-")
105 (find-files "src/compiler" "^make\\.")))
108 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
109 ;; them in HOME, so it needs to be writeable.
110 (add-before 'build 'set-HOME
111 (lambda _ (setenv "HOME" "/tmp") #t))
113 (lambda* (#:key system outputs #:allow-other-keys)
114 (let ((out (assoc-ref outputs "out")))
115 (if (or (string-prefix? "x86_64" system)
116 (string-prefix? "i686" system))
117 (invoke "make" "compile-microcode")
118 (invoke "./etc/make-liarc.sh"
119 (string-append "--prefix=" out)))
121 (add-after 'configure 'configure-doc
122 (lambda* (#:key outputs inputs #:allow-other-keys)
123 (with-directory-excursion "../doc"
124 (let* ((out (assoc-ref outputs "out"))
125 (bash (assoc-ref inputs "bash"))
126 (bin/sh (string-append bash "/bin/sh")))
127 (invoke bin/sh "./configure"
128 (string-append "--prefix=" out)
129 (string-append "SHELL=" bin/sh))
130 (substitute* '("Makefile" "make-common")
131 (("/lib/mit-scheme/doc")
132 (string-append "/share/doc/" ,name "-" ,version)))
134 (add-after 'build 'build-doc
136 (with-directory-excursion "../doc"
139 (add-after 'install 'install-doc
140 (lambda* (#:key outputs #:allow-other-keys)
141 (let* ((out (assoc-ref outputs "out"))
142 (doc (assoc-ref outputs "doc"))
143 (old-doc-dir (string-append out "/share/doc"))
144 (new-doc/mit-scheme-dir
145 (string-append doc "/share/doc/" ,name "-" ,version)))
146 (with-directory-excursion "../doc"
147 (for-each (lambda (target)
148 (invoke "make" target))
149 '("install-config" "install-info-gz" "install-man"
150 "install-html" "install-pdf")))
151 (mkdir-p new-doc/mit-scheme-dir)
153 (string-append old-doc-dir "/" ,name "-" ,version)
154 new-doc/mit-scheme-dir)
155 (delete-file-recursively old-doc-dir)
158 `(("texlive" ,(texlive-union (list texlive-tex-texinfo)))
166 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
167 ;; compile from the architecture-specific tarballs, which contain
168 ;; pre-built binaries. It leads to more efficient code than when
169 ;; building the tarball that contains generated C code instead of
173 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
174 version "/mit-scheme-"
175 (match (%current-system)
177 (string-append version "-x86-64"))
179 (string-append version "-i386"))
181 (string-append "c-" version)))
184 (match (%current-system)
187 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
190 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
193 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
195 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
196 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
198 (home-page "https://www.gnu.org/software/mit-scheme/")
199 (synopsis "A Scheme implementation with integrated editor and debugger")
201 "GNU/MIT Scheme is an implementation of the Scheme programming
202 language. It provides an interpreter, a compiler and a debugger. It also
203 features an integrated Emacs-like editor and a large runtime library.")
205 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
207 (define-public bigloo
213 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
217 "1x7xdgsls277zlf6gcaxs2cj62xj6yvb0qxh0ddmxfamvxba0cf4"))
218 ;; Remove bundled libraries.
219 (modules '((guix build utils)))
222 (for-each delete-file-recursively
223 '("gc" "gmp" "libuv"))
225 (build-system gnu-build-system)
227 `(#:test-target "test"
229 (modify-phases %standard-phases
231 (lambda* (#:key inputs outputs #:allow-other-keys)
233 (substitute* "configure"
235 (string-append "shell=" (which "bash") "\n"))
237 (substitute* "autoconf/runtest.in"
239 (substitute* "autoconf/osversion"
240 (("^version.*$") "version=\"\"\n"))
241 (substitute* "comptime/Makefile"
242 (("\\$\\(LDCOMPLIBS\\)")
243 "$(LDCOMPLIBS) $(LDFLAGS)"))
245 ;; The `configure' script doesn't understand options
246 ;; of those of Autoconf.
247 (let ((out (assoc-ref outputs "out")))
248 (invoke "./configure"
249 (string-append "--prefix=" out)
250 ; use system libraries
252 "--customunistring=no"
254 (string-append"--mv=" (which "mv"))
255 (string-append "--rm=" (which "rm"))
257 (string-append "--ldflags=-Wl,-rpath="
258 (assoc-ref outputs "out")
259 "/lib/bigloo/" ,version)
260 (string-append "--lispdir=" out
261 "/share/emacs/site-lisp")
263 "--sharedcompiler=yes"
264 "--disable-patch"))))
265 (add-after 'install 'install-emacs-modes
266 (lambda* (#:key outputs #:allow-other-keys)
267 (let* ((out (assoc-ref outputs "out"))
268 (dir (string-append out "/share/emacs/site-lisp")))
269 (invoke "make" "-C" "bmacs" "all" "install"
270 (string-append "EMACSBRAND=emacs25")
271 (string-append "EMACSDIR=" dir))))))))
273 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
275 ("libunistring" ,libunistring)
280 ;; Optional APIs for which Bigloo has bindings.
282 ("libphidget" ,libphidget)
285 `(("pkg-config" ,pkg-config)))
287 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
288 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
289 (synopsis "Efficient Scheme compiler")
291 "Bigloo is a Scheme implementation devoted to one goal: enabling
292 Scheme based programming style where C(++) is usually
293 required. Bigloo attempts to make Scheme practical by offering
294 features usually presented by traditional programming languages
295 but not offered by Scheme and functional programming. Bigloo
296 compiles Scheme modules. It delivers small and fast stand alone
297 binary executables. Bigloo enables full connections between
298 Scheme and C programs and between Scheme and Java programs.")
304 (version "3.1.0-pre2")
307 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
311 "0bvq79vxcpgwydwi923cxb5w9isx2x8r3d0xndbdhacmmsw1m811"))))
312 (build-system gnu-build-system)
314 `(#:test-target "test"
315 #:make-flags '("BIGLOO=bigloo")
318 (modify-phases %standard-phases
320 (lambda* (#:key inputs outputs #:allow-other-keys)
321 (let ((out (assoc-ref outputs "out")))
322 (invoke "./configure"
323 (string-append "--prefix=" out)
324 (string-append "--blflags="
325 ;; user flags completely override useful
326 ;; default flags, so repeat them here.
327 "-copt \\$(CPICFLAGS) "
328 "-L \\$(BUILDLIBDIR) "
329 "-ldopt -Wl,-rpath," out "/lib"))))))))
330 (inputs `(("avahi" ,avahi)
333 ("libunistring" ,libunistring)
338 (home-page "http://hop.inria.fr/")
339 (synopsis "Multi-tier programming language for the Web 2.0")
341 "HOP is a multi-tier programming language for the Web 2.0 and the
342 so-called diffuse Web. It is designed for programming interactive web
343 applications in many fields such as multimedia (web galleries, music players,
344 ...), ubiquitous and house automation (SmartPhones, personal appliance),
345 mashups, office (web agendas, mail clients, ...), etc.")
348 (define-public chicken
354 (uri (string-append "https://code.call-cc.org/releases/"
355 version "/chicken-" version ".tar.gz"))
358 "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd"))))
359 (build-system gnu-build-system)
361 `(#:modules ((guix build gnu-build-system)
365 ;; No `configure' script; run "make check" after "make install" as
366 ;; prescribed by README.
368 (modify-phases %standard-phases
371 (add-after 'install 'check
372 (assoc-ref %standard-phases 'check)))
374 #:make-flags (let ((out (assoc-ref %outputs "out")))
375 (list "PLATFORM=linux"
376 (string-append "PREFIX=" out)
377 (string-append "VARDIR=" out "/var/lib")))
379 ;; Parallel builds are not supported, as noted in README.
380 #:parallel-build? #f))
381 (home-page "http://www.call-cc.org/")
382 (synopsis "R5RS Scheme implementation that compiles native code via C")
384 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
385 produces portable and efficient C, supports almost all of the R5RS Scheme
386 language standard, and includes many enhancements and extensions.")
389 (define-public scheme48
395 (uri (string-append "http://s48.org/" version
396 "/scheme48-" version ".tgz"))
399 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
400 (patches (search-patches "scheme48-tests.patch"))))
401 (build-system gnu-build-system)
402 (home-page "http://s48.org/")
403 (synopsis "Scheme implementation using a bytecode interpreter")
405 "Scheme 48 is an implementation of Scheme based on a byte-code
406 interpreter and is designed to be used as a testbed for experiments in
407 implementation techniques and as an expository tool.")
409 ;; Most files are BSD-3; see COPYING for the few exceptions.
412 (define-public racket
418 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
419 version "/racket-" version "-src.tgz")
421 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
422 version "/racket-" version "-src.tgz")))
425 "1glv5amsp9xp480d4yr63hhm9kkyav06yl3a6p489nkr4cln0j9a"))
426 (patches (search-patches
427 "racket-store-checksum-override.patch"))))
428 (build-system gnu-build-system)
431 (modify-phases %standard-phases
432 (add-before 'configure 'pre-configure
433 (lambda* (#:key inputs #:allow-other-keys)
434 ;; Patch dynamically loaded libraries with their absolute paths.
435 (let* ((library-path (search-path-as-string->list
436 (getenv "LIBRARY_PATH")))
437 (find-so (lambda (soname)
440 (format #f "~a.so" soname))))
441 (patch-ffi-libs (lambda (file libs)
445 (((format #f "\"~a\"" lib))
446 (format #f "\"~a\"" (find-so lib)))))
448 (substitute* "collects/db/private/sqlite3/ffi.rkt"
449 (("ffi-lib sqlite-so")
450 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
451 (substitute* "collects/openssl/libssl.rkt"
452 (("ffi-lib libssl-so")
453 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
454 (substitute* "collects/openssl/libcrypto.rkt"
455 (("ffi-lib libcrypto-so")
456 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
457 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
458 (("ffi-lib libgmp-so")
459 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
460 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
461 (("ffi-lib libmpfr-so")
462 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
463 (substitute* "share/pkgs/readline-lib/readline/rktrl.rkt"
464 (("\\(getenv \"PLT_READLINE_LIB\"\\)")
465 (format #f "\"~a\"" (find-so "libedit"))))
467 (lambda (x) (apply patch-ffi-libs x))
468 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
469 ("libfontconfig" "libcairo"))
470 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
471 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
472 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
474 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
475 ("libpango-1.0" "libpangocairo-1.0"))
476 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
478 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
480 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
482 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
484 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
485 ("libgdk-3" "libgtk-3"))
486 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
488 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
489 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
490 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
492 ("share/pkgs/sgl/gl.rkt"
493 ("libGL" "libGLU")))))
496 (add-after 'unpack 'patch-/bin/sh
498 (substitute* "collects/racket/system.rkt"
499 (("/bin/sh") (which "sh")))
501 #:tests? #f ; XXX: how to run them?
505 ;; Hardcode dynamically loaded libraries for better functionality.
506 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
508 ("fontconfig" ,fontconfig)
512 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
521 ("unixodbc" ,unixodbc)
522 ("libedit" ,libedit)))
523 (home-page "http://racket-lang.org")
524 (synopsis "Implementation of Scheme and related languages")
526 "Racket is an implementation of the Scheme programming language (R5RS and
527 R6RS) and related languages, such as Typed Racket. It features a compiler and
528 a virtual machine with just-in-time native compilation, as well as a large set
532 (define-public gambit-c
540 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
541 (version-major+minor version) "/source/gambit-v"
542 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
545 (base32 "19862w9ij0g5xrkskl4g89xbs17gp9cc6cfcdca6dlfkb3lk6xhp"))))
546 (build-system gnu-build-system)
549 ;; According to the ./configure script, this makes the build slower and
550 ;; use >= 1 GB memory, but makes Gambit much faster.
551 '("--enable-single-host")))
552 (home-page "http://gambitscheme.org")
553 (synopsis "Efficient Scheme interpreter and compiler")
555 "Gambit consists of two main programs: gsi, the Gambit Scheme
556 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
557 the complete execution and debugging environment. The compiler is the
558 interpreter extended with the capability of generating executable files. The
559 compiler can produce standalone executables or compiled modules which can be
560 loaded at run time. Interpreted code and compiled code can be freely
563 (license (list lgpl2.1+ asl2.0))))
565 (define-public chibi-scheme
567 (name "chibi-scheme")
572 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
575 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
576 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
577 (build-system gnu-build-system)
579 `(#:phases (modify-phases %standard-phases
581 (add-before 'build 'set-cc
583 (setenv "CC" "gcc"))))
584 #:make-flags (let ((out (assoc-ref %outputs "out")))
585 (list (string-append "PREFIX=" out)
586 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
587 #:test-target "test"))
588 (home-page "https://github.com/ashinn/chibi-scheme")
589 (synopsis "Small embeddable Scheme implementation")
591 "Chibi-Scheme is a very small library with no external dependencies
592 intended for use as an extension and scripting language in C programs. In
593 addition to support for lightweight VM-based threads, each VM itself runs in
594 an isolated heap allowing multiple VMs to run simultaneously in different OS
598 (define-public scmutils
600 (define (system-suffix)
602 ((string-prefix? "x86_64" (or (%current-target-system)
612 (method url-fetch/tarbomb)
613 (modules '((guix build utils)))
615 ;; Remove binary code
616 (delete-file-recursively "scmutils/mit-scheme")
618 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
619 "/scmutils-tarballs/" name "-" version
620 "-x86-64-gnu-linux.tar.gz"))
622 (base32 "00ly5m0s4dy5kxravjaqlpii5zcnr6b9nqm0607lr7xcs52i4j8b"))))
623 (build-system gnu-build-system)
625 `(("mit-scheme" ,mit-scheme)
626 ("emacs" ,emacs-minimal)))
628 `(#:tests? #f ;; no tests-suite
629 #:modules ((guix build gnu-build-system)
631 (guix build emacs-utils))
632 #:imported-modules (,@%gnu-build-system-modules
633 (guix build emacs-utils))
635 (modify-phases %standard-phases
637 ;; No standard build procedure is used. We set the correct
638 ;; runtime path in the custom build system.
639 (lambda* (#:key outputs #:allow-other-keys)
640 (let ((out (assoc-ref outputs "out")))
641 ;; Required to find .bci files at runtime.
642 (with-directory-excursion "scmutils"
643 (rename-file "src" "scmutils"))
644 (substitute* "scmutils/scmutils/load.scm"
645 (("/usr/local/scmutils/")
646 (string-append out "/lib/mit-scheme-"
647 ,(system-suffix) "/")))
650 ;; Compile the code and build a band.
651 (lambda* (#:key outputs #:allow-other-keys)
652 (let* ((out (assoc-ref outputs "out"))
653 (make-img (string-append
654 "echo '(load \"load\") "
655 "(disk-save \"edwin-mechanics.com\")'"
657 (with-directory-excursion "scmutils/scmutils"
658 (and (zero? (system "mit-scheme < compile.scm"))
659 (zero? (system make-img))))
661 (add-before 'install 'fix-directory-names
662 ;; Correct directory names in the startup script.
663 (lambda* (#:key inputs outputs #:allow-other-keys)
664 (let* ((out (assoc-ref outputs "out"))
665 (scm-root (assoc-ref inputs "mit-scheme")))
666 (substitute* "bin/mechanics"
667 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
669 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
670 "LIB=\"${ROOT}/lib/mit-scheme-"
672 out "/lib/mit-scheme-" ,(system-suffix) "\""))
673 (("EDWIN_INFO_DIRECTORY=.*\n") "")
675 (string-append "SCHEME=\"${ROOT}/bin/scheme "
676 "--library ${LIB}\"\n"))
677 (("export EDWIN_INFO_DIRECTORY") ""))
679 (add-before 'install 'emacs-tags
680 ;; Generate Emacs's tags for easy reference to source
682 (lambda* (#:key inputs outputs #:allow-other-keys)
683 (with-directory-excursion "scmutils/scmutils"
684 (apply invoke "etags" (find-files "." "\\.scm")))
687 ;; Copy files to the store.
688 (lambda* (#:key outputs #:allow-other-keys)
689 (define* (copy-files-to-directory files dir
690 #:optional (delete? #f))
691 (for-each (lambda (f)
692 (copy-file f (string-append dir "/" f))
693 (when delete? (delete-file f)))
696 (let* ((out (assoc-ref outputs "out"))
697 (bin (string-append out "/bin"))
698 (doc (string-append out "/share/doc/"
700 (lib (string-append out "/lib/mit-scheme-"
703 (for-each mkdir-p (list lib doc bin))
704 (with-directory-excursion "scmutils/scmutils"
705 (copy-files-to-directory '("COPYING" "LICENSE")
707 (for-each delete-file (find-files "." "\\.bin"))
708 (copy-files-to-directory '("edwin-mechanics.com")
709 (string-append lib "/..") #t)
710 (copy-recursively "." lib))
711 (with-directory-excursion "bin"
712 (copy-files-to-directory (find-files ".") bin))
713 (with-directory-excursion "scmutils/manual"
714 (copy-files-to-directory (find-files ".") doc))
716 (add-after 'install 'emacs-helpers
717 ;; Add convenience Emacs commands to easily load the
718 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
719 ;; and to easily load code tags.
720 (lambda* (#:key inputs outputs #:allow-other-keys)
721 (let* ((out (assoc-ref outputs "out"))
722 (mit-root (assoc-ref inputs "mit-scheme"))
724 (string-append out "/share/emacs/site-lisp"
725 "/guix.d/" ,name "-" ,version))
726 (el-file (string-append emacs-lisp-dir
729 (string-append "/lib/mit-scheme-"
731 (mkdir-p emacs-lisp-dir)
732 (call-with-output-file el-file
736 (defun scmutils-load ()
739 (let ((mit-root \"~a\")
742 (concat mit-root \"/bin/scheme --library \"
743 mit-root \"~a:\" scmutils \"~a\"
744 \" --band edwin-mechanics.com\"
748 (defun scmutils-load-tags ()
750 (let ((scmutils \"~a\"))
751 (visit-tags-table (concat scmutils \"/TAGS\"))))
756 (string-append out lib-relative-path
758 (emacs-generate-autoloads ,name emacs-lisp-dir)
759 (emacs-byte-compile-directory emacs-lisp-dir)
762 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
763 (synopsis "Scmutils library for MIT Scheme")
764 (description "The Scmutils system is an integrated library of
765 procedures, embedded in the programming language Scheme, and intended to
766 support teaching and research in mathematical physics and electrical
771 (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
774 (version (string-append "20170703-1." (string-take commit 7)))
778 (url "https://github.com/sarabander/sicp")
782 "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
783 (file-name (string-append name "-" version "-checkout"))))
784 (build-system trivial-build-system)
785 (native-inputs `(("gzip" ,gzip)
787 ("texinfo" ,texinfo)))
789 `(#:modules ((guix build utils)
794 (use-modules (guix build utils)
797 (let ((gzip (assoc-ref %build-inputs "gzip"))
798 (source (assoc-ref %build-inputs "source"))
799 (texinfo (assoc-ref %build-inputs "texinfo"))
800 (html-dir (string-append %output "/share/doc/" ,name "/html"))
801 (info-dir (string-append %output "/share/info")))
802 (copy-recursively (string-append source "/html") html-dir)
803 (setenv "PATH" (string-append gzip "/bin"
806 (invoke "makeinfo" "--output"
807 (string-append info-dir "/sicp.info")
808 (string-append source "/sicp-pocket.texi"))
809 (for-each (cut invoke "gzip" "-9n" <>)
810 (find-files info-dir))
812 (home-page "https://sarabander.github.io/sicp")
813 (synopsis "Structure and Interpretation of Computer Programs")
814 (description "Structure and Interpretation of Computer Programs (SICP) is
815 a textbook aiming to teach the principles of computer programming.
817 Using Scheme, a dialect of the Lisp programming language, the book explains
818 core computer science concepts such as abstraction in programming,
819 metalinguistic abstraction, recursion, interpreters, and modular programming.")
820 (license cc-by-sa4.0))))
822 (define-public scheme48-rx
823 (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
827 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
832 (url "https://github.com/scheme/rx")
836 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
837 (file-name (string-append name "-" version "-checkout"))))
838 (build-system trivial-build-system)
840 `(#:modules ((guix build utils))
843 (use-modules (guix build utils))
844 (let ((share (string-append %output
846 ,(package-version scheme48)
848 (chdir (assoc-ref %build-inputs "source"))
850 (copy-recursively "." share)
854 ("scheme48" ,scheme48)))
855 (home-page "https://github.com/scheme/rx/")
856 (synopsis "SRE String pattern-matching library for scheme48")
858 "String pattern-matching library for scheme48 based on the SRE
859 regular-expression notation.")
868 (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
872 "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
873 (build-system gnu-build-system)
875 `(#:tests? #f ; There is no check target.
877 (modify-phases %standard-phases
878 (add-after 'install 'remove-bin-share
879 (lambda* (#:key inputs outputs #:allow-other-keys)
880 (delete-file-recursively
881 (string-append (assoc-ref outputs "out") "/bin"))
884 (lambda* (#:key inputs outputs #:allow-other-keys)
885 (invoke "./configure"
886 (string-append "--prefix="
887 (assoc-ref outputs "out"))))))))
888 (native-inputs `(("unzip" ,unzip)
889 ("texinfo" ,texinfo)))
890 (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
891 (synopsis "Compatibility and utility library for Scheme")
892 (description "SLIB is a portable Scheme library providing compatibility and
893 utility functions for all standard Scheme implementations.")
894 (license (non-copyleft
895 "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
896 "Or see COPYING in the distribution."))))
905 "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
909 "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
910 (build-system gnu-build-system)
913 (modify-phases %standard-phases
915 (lambda* (#:key inputs outputs #:allow-other-keys)
916 (invoke "./configure"
917 (string-append "--prefix="
918 (assoc-ref outputs "out")))))
919 (add-before 'build 'pre-build
920 (lambda* (#:key inputs #:allow-other-keys)
921 (substitute* "Makefile"
922 (("ginstall-info") "install-info"))
925 (lambda* (#:key inputs outputs #:allow-other-keys)
926 (setenv "SCHEME_LIBRARY_PATH"
927 (string-append (assoc-ref inputs "slib")
929 (invoke "make" "scmlit" "CC=gcc")
930 (invoke "make" "all")))
931 (add-after 'install 'post-install
932 (lambda* (#:key inputs outputs #:allow-other-keys)
933 (let* ((out (assoc-ref outputs "out"))
934 (req (string-append out "/lib/scm/require.scm")))
936 (format (open req (logior O_WRONLY O_CREAT))
937 "(define (library-vicinity) ~s)\n"
938 (string-append (assoc-ref inputs "slib")
941 ;; We must generate the slibcat file.
942 (invoke (string-append out "/bin/scm")
943 "-br" "new-catalog")))))))
944 (inputs `(("slib" ,slib)))
945 (native-inputs `(("unzip" ,unzip)
946 ("texinfo" ,texinfo)))
947 (home-page "http://people.csail.mit.edu/jaffer/SCM")
948 (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
949 (description "GNU SCM is an implementation of Scheme. This
950 implementation includes Hobbit, a Scheme-to-C compiler, which can
951 generate C files whose binaries can be dynamically or statically
952 linked with a SCM executable.")
955 (define-public tinyscheme
961 (uri (string-append "mirror://sourceforge/" name "/" name "/"
962 name "-" version "/" name "-" version ".zip"))
965 "0yqma4jrjgj95f3hf30h542x97n8ah234n19yklbqq0phfsa08wf"))))
966 (build-system gnu-build-system)
971 (modify-phases %standard-phases
973 (lambda* (#:key source #:allow-other-keys)
974 (invoke "unzip" source)
975 (chdir (string-append ,name "-" ,version))
977 (add-after 'unpack 'set-scm-directory
978 ;; Hard-code ‘our’ init.scm instead of looking in the current
979 ;; working directory, so invoking ‘scheme’ just works.
980 (lambda* (#:key outputs #:allow-other-keys)
981 (let* ((out (assoc-ref outputs "out"))
982 (scm (string-append out "/share/" ,name)))
983 (substitute* "scheme.c"
985 (string-append scm "/" all)))
987 (delete 'configure) ; no configure script
989 ;; There's no ‘install’ target. Install files manually.
990 (lambda* (#:key outputs #:allow-other-keys)
991 (let* ((out (assoc-ref outputs "out"))
992 (bin (string-append out "/bin"))
993 (doc (string-append out "/share/doc/"
995 (include (string-append out "/include"))
996 (lib (string-append out "/lib"))
997 (scm (string-append out "/share/" ,name)))
998 (install-file "scheme" bin)
999 (install-file "Manual.txt" doc)
1000 (install-file "scheme.h" include)
1001 (install-file "libtinyscheme.so" lib)
1002 (install-file "init.scm" scm)
1004 #:tests? #f)) ; no tests
1005 (home-page "http://tinyscheme.sourceforge.net/")
1006 (synopsis "Light-weight interpreter for the Scheme programming language")
1008 "TinyScheme is a light-weight Scheme interpreter that implements as large a
1009 subset of R5RS as was possible without getting very large and complicated.
1011 It's meant to be used as an embedded scripting interpreter for other programs.
1012 As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or
1013 extensive toolkits, although it does sport a small (and optional) top-level
1016 As an embedded interpreter, it allows multiple interpreter states to coexist in
1017 the same program, without any interference between them. Foreign functions in C
1018 can be added and values can be defined in the Scheme environment. Being quite a
1019 small program, it is easy to comprehend, get to grips with, and use.")
1020 (license bsd-3))) ; there are no licence headers
1022 (define-public stalin
1023 (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
1024 ;; FIXME: The Stalin "source" contains C code generated by itself:
1025 ;; 'stalin-AMD64.c', etc.
1030 ;; Use Pearlmutter's upstream branch with AMD64 patches
1031 ;; applied. Saves us from including those 20M! patches
1032 ;; in Guix. For more info, see:
1033 ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
1036 (url "https://github.com/barak/stalin.git")
1038 (file-name (string-append name "-" version "-checkout"))
1041 "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
1042 (modules '((guix build utils)))
1044 ;; remove gc libs from build, we have them as input
1046 (delete-file "gc6.8.tar.gz")
1047 (delete-file-recursively "benchmarks")
1048 (substitute* "build"
1051 ((".*B include/libgc.a") "")
1054 (build-system gnu-build-system)
1056 `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
1058 (modify-phases %standard-phases
1060 (lambda* (#:key outputs #:allow-other-keys)
1061 (let* ((out (assoc-ref outputs "out"))
1062 (include-out (string-append out "/include")))
1064 (for-each (lambda (fname)
1065 (install-file fname include-out))
1066 (find-files "include"))
1067 (substitute* "makefile"
1068 (("\\./include") include-out))
1069 (substitute* "post-make"
1074 (lambda* (#:key outputs #:allow-other-keys)
1075 (let ((out (assoc-ref outputs "out")))
1076 (install-file "stalin.1"
1077 (string-append out "/share/man/man1"))
1078 (install-file "stalin"
1079 (string-append out "/bin"))
1082 `(("libx11" ,libx11)))
1084 `(("libgc" ,libgc)))
1085 (supported-systems '("x86_64-linux"))
1086 (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
1087 (synopsis "Brutally efficient Scheme compiler")
1089 "Stalin is an aggressively optimizing whole-program compiler
1090 for Scheme that does polyvariant interprocedural flow analysis,
1091 flow-directed interprocedural escape analysis, flow-directed
1092 lightweight CPS conversion, flow-directed lightweight closure
1093 conversion, flow-directed interprocedural lifetime analysis, automatic
1094 in-lining, unboxing, and flow-directed program-specific and
1095 program-point-specific low-level representation selection and code