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>
13 ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages scheme)
31 #:use-module (gnu packages)
32 #:use-module ((guix licenses)
33 #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
34 cc-by-sa4.0 non-copyleft))
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix utils)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages bdw-gc)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages libevent)
46 #:use-module (gnu packages libunistring)
47 #:use-module (gnu packages m4)
48 #:use-module (gnu packages multiprecision)
49 #:use-module (gnu packages ncurses)
50 #:use-module (gnu packages pcre)
51 #:use-module (gnu packages emacs)
52 #:use-module (gnu packages ghostscript)
53 #:use-module (gnu packages netpbm)
54 #:use-module (gnu packages texinfo)
55 #:use-module (gnu packages tex)
56 #:use-module (gnu packages base)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages avahi)
60 #:use-module (gnu packages libphidget)
61 #:use-module (gnu packages gcc)
62 #:use-module (gnu packages glib)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages libffi)
65 #:use-module (gnu packages fontutils)
66 #:use-module (gnu packages image)
67 #:use-module (gnu packages xorg)
68 #:use-module (gnu packages sqlite)
69 #:use-module (gnu packages tls)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages libedit)
72 #:use-module (srfi srfi-1)
73 #:use-module (ice-9 match))
75 (define (mit-scheme-source-directory system version)
76 (string-append "mit-scheme-"
77 (if (or (string-prefix? "x86_64" system)
78 (string-prefix? "i686" system))
83 (define-public mit-scheme
87 (source #f) ; see below
88 (outputs '("out" "doc"))
89 (build-system gnu-build-system)
91 `(#:modules ((guix build gnu-build-system)
95 (modify-phases %standard-phases
97 (lambda* (#:key inputs #:allow-other-keys)
99 (assoc-ref inputs "source"))
100 (chdir ,(mit-scheme-source-directory (%current-system)
102 ;; Delete these dangling symlinks since they break
104 (for-each delete-file
105 (find-files "src/compiler" "^make\\."))
108 (add-after 'unpack 'patch-/bin/sh
110 (setenv "CONFIG_SHELL" (which "sh"))
111 (substitute* '("../tests/ffi/autogen.sh"
112 "../tests/ffi/autobuild.sh"
113 "../tests/ffi/test-ffi.sh"
114 "../tests/runtime/test-process.scm"
115 "runtime/unxprm.scm")
116 (("/bin/sh") (which "sh"))
117 (("\\./autogen\\.sh")
118 (string-append (which "sh") " autogen.sh"))
120 (string-append (which "sh") " configure")))
122 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
123 ;; them in HOME, so it needs to be writeable.
124 (add-before 'build 'set-HOME
125 (lambda _ (setenv "HOME" "/tmp") #t))
127 (lambda* (#:key system outputs #:allow-other-keys)
128 (let ((out (assoc-ref outputs "out")))
129 (if (or (string-prefix? "x86_64" system)
130 (string-prefix? "i686" system))
131 (invoke "make" "compile-microcode")
132 (invoke "./etc/make-liarc.sh"
133 (string-append "--prefix=" out)))
135 (add-after 'configure 'configure-doc
136 (lambda* (#:key outputs inputs #:allow-other-keys)
137 (with-directory-excursion "../doc"
138 (let* ((out (assoc-ref outputs "out"))
139 (bash (assoc-ref inputs "bash"))
140 (bin/sh (string-append bash "/bin/sh")))
141 (invoke bin/sh "./configure"
142 (string-append "--prefix=" out)
143 (string-append "SHELL=" bin/sh))
145 (add-after 'build 'build-doc
147 (with-directory-excursion "../doc"
150 (add-after 'install 'install-doc
151 (lambda* (#:key outputs #:allow-other-keys)
152 (let* ((out (assoc-ref outputs "out"))
153 (doc (assoc-ref outputs "doc"))
154 (old-doc-dir (string-append out "/share/doc"))
155 (new-doc/mit-scheme-dir
156 (string-append doc "/share/doc/" ,name "-" ,version)))
157 (with-directory-excursion "../doc"
158 (for-each (lambda (target)
159 (invoke "make" target))
160 '("install-info-gz" "install-man"
161 "install-html" "install-pdf")))
162 (mkdir-p new-doc/mit-scheme-dir)
164 (string-append old-doc-dir "/" ,name)
165 new-doc/mit-scheme-dir)
166 (delete-file-recursively old-doc-dir)
169 `(;; Autoconf, Automake, and Libtool are necessary for the FFI tests.
170 ("autoconf" ,autoconf)
171 ("automake" ,automake)
173 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
181 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
182 ;; compile from the architecture-specific tarballs, which contain
183 ;; pre-built binaries. It leads to more efficient code than when
184 ;; building the tarball that contains generated C code instead of
188 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
189 version "/mit-scheme-"
190 (match (%current-system)
192 (string-append version "-x86-64"))
194 (string-append version "-i386"))
196 (string-append "c-" version)))
199 (match (%current-system)
202 "03m7cc035w3avs91j2pcz9f15ssgvgp3rm045d1vbydqrkzfyw8k"))
205 "05sjyz90xxfnmi87qv8x0yx0fcallnzl1dciygdafp317pn489is"))
210 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
211 ;; Also, the portable C version of MIT/GNU Scheme did not work in time for
212 ;; release in version 10.1.
213 (supported-systems '("x86_64-linux" "i686-linux"))
215 (home-page "https://www.gnu.org/software/mit-scheme/")
216 (synopsis "A Scheme implementation with integrated editor and debugger")
218 "GNU/MIT Scheme is an implementation of the Scheme programming
219 language. It provides an interpreter, a compiler and a debugger. It also
220 features an integrated Emacs-like editor and a large runtime library.")
222 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
224 (define-public bigloo
225 ;; Upstream modifies source tarballs in place, making significant changes
226 ;; long after the initial publication: <https://bugs.gnu.org/33525>. For
227 ;; transparency, we give this "second 4.3b" release a different version
229 (let ((upstream-version "4.3e"))
235 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
236 upstream-version ".tar.gz"))
239 "12k1kxyn3yilba0508xh8wkrw6279gnghzqi0bs2ayf5d2wkqdj3"))
240 ;; Remove bundled libraries.
241 (modules '((guix build utils)))
244 (for-each delete-file-recursively
245 '("gc" "gmp" "libuv"))
247 (build-system gnu-build-system)
249 `(#:test-target "test"
251 (modify-phases %standard-phases
253 (lambda* (#:key inputs outputs #:allow-other-keys)
255 (substitute* "configure"
257 (string-append "shell=" (which "bash") "\n"))
259 (substitute* "autoconf/runtest.in"
261 (substitute* "autoconf/osversion"
262 (("^version.*$") "version=\"\"\n"))
263 (substitute* "comptime/Makefile"
264 (("\\$\\(LDCOMPLIBS\\)")
265 "$(LDCOMPLIBS) $(LDFLAGS)"))
267 ;; The `configure' script doesn't understand options
268 ;; of those of Autoconf.
269 (let ((out (assoc-ref outputs "out")))
270 (invoke "./configure"
271 (string-append "--prefix=" out)
272 ; use system libraries
274 "--customunistring=no"
276 (string-append"--mv=" (which "mv"))
277 (string-append "--rm=" (which "rm"))
279 (string-append "--ldflags=-Wl,-rpath="
280 (assoc-ref outputs "out")
281 "/lib/bigloo/" ,upstream-version)
282 (string-append "--lispdir=" out
283 "/share/emacs/site-lisp")
285 "--sharedcompiler=yes"
286 "--disable-patch"))))
287 (add-after 'install 'install-emacs-modes
288 (lambda* (#:key outputs #:allow-other-keys)
289 (let* ((out (assoc-ref outputs "out"))
290 (dir (string-append out "/share/emacs/site-lisp")))
291 (invoke "make" "-C" "bmacs" "all" "install"
292 (string-append "EMACSBRAND=emacs25")
293 (string-append "EMACSDIR=" dir))))))))
295 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
297 ("libunistring" ,libunistring)
302 ;; Optional APIs for which Bigloo has bindings.
304 ("libphidget" ,libphidget)
307 `(("pkg-config" ,pkg-config)))
309 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
310 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
311 (synopsis "Efficient Scheme compiler")
313 "Bigloo is a Scheme implementation devoted to one goal: enabling Scheme
314 based programming style where C(++) is usually required. Bigloo attempts to
315 make Scheme practical by offering features usually presented by traditional
316 programming languages but not offered by Scheme and functional programming.
317 Bigloo compiles Scheme modules. It delivers small and fast stand alone binary
318 executables. Bigloo enables full connections between Scheme and C programs
319 and between Scheme and Java programs.")
325 (version "3.2.0-pre1")
328 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
332 "0jf418d0s9imv98s6qrpjxr1mdaxr37knh5qyfl5y4a9cc41mlg5"))))
333 (build-system gnu-build-system)
335 `(#:test-target "test"
336 #:make-flags '("BIGLOO=bigloo")
339 (modify-phases %standard-phases
341 (lambda* (#:key inputs outputs #:allow-other-keys)
342 (let ((out (assoc-ref outputs "out")))
343 (substitute* '("tools/Makefile"
344 "test/hopjs/TEST.in")
345 (("/bin/rm") (which "rm")))
346 (invoke "./configure"
347 (string-append "--prefix=" out)
349 (string-append "--blflags="
350 ;; user flags completely override useful
351 ;; default flags, so repeat them here.
352 "-copt \\$(CPICFLAGS) "
353 "-L \\$(BUILDLIBDIR) "
354 "-ldopt -Wl,-rpath," out "/lib"))))))))
355 (inputs `(("avahi" ,avahi)
358 ("libunistring" ,libunistring)
363 (home-page "http://hop.inria.fr/")
364 (synopsis "Multi-tier programming language for the Web 2.0")
366 "HOP is a multi-tier programming language for the Web 2.0 and the
367 so-called diffuse Web. It is designed for programming interactive web
368 applications in many fields such as multimedia (web galleries, music players,
369 ...), ubiquitous and house automation (SmartPhones, personal appliance),
370 mashups, office (web agendas, mail clients, ...), etc.")
373 (define-public chicken
379 (uri (string-append "https://code.call-cc.org/releases/"
380 version "/chicken-" version ".tar.gz"))
383 "15b5yrzfa8aimzba79x7v6y282f898rxqxfxrr446sjx9jwlpfd8"))))
384 (build-system gnu-build-system)
386 `(#:modules ((guix build gnu-build-system)
390 ;; No `configure' script; run "make check" after "make install" as
391 ;; prescribed by README.
393 (modify-phases %standard-phases
396 (add-after 'install 'check
397 (assoc-ref %standard-phases 'check)))
399 #:make-flags (let ((out (assoc-ref %outputs "out")))
400 (list "PLATFORM=linux"
401 (string-append "PREFIX=" out)
402 (string-append "VARDIR=" out "/var/lib")))
404 ;; Parallel builds are not supported, as noted in README.
405 #:parallel-build? #f))
406 (home-page "http://www.call-cc.org/")
407 (synopsis "R5RS Scheme implementation that compiles native code via C")
409 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
410 produces portable and efficient C, supports almost all of the R5RS Scheme
411 language standard, and includes many enhancements and extensions.")
414 (define-public scheme48
420 (uri (string-append "http://s48.org/" version
421 "/scheme48-" version ".tgz"))
424 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
425 (patches (search-patches "scheme48-tests.patch"))))
426 (build-system gnu-build-system)
427 (home-page "http://s48.org/")
428 (synopsis "Scheme implementation using a bytecode interpreter")
430 "Scheme 48 is an implementation of Scheme based on a byte-code
431 interpreter and is designed to be used as a testbed for experiments in
432 implementation techniques and as an expository tool.")
434 ;; Most files are BSD-3; see COPYING for the few exceptions.
437 (define-public racket
443 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
444 version "/racket-" version "-src.tgz")
446 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
447 version "/racket-" version "-src.tgz")))
450 "1glv5amsp9xp480d4yr63hhm9kkyav06yl3a6p489nkr4cln0j9a"))
451 (patches (search-patches
452 "racket-store-checksum-override.patch"))))
453 (build-system gnu-build-system)
456 (modify-phases %standard-phases
457 (add-before 'configure 'pre-configure
458 (lambda* (#:key inputs #:allow-other-keys)
459 ;; Patch dynamically loaded libraries with their absolute paths.
460 (let* ((library-path (search-path-as-string->list
461 (getenv "LIBRARY_PATH")))
462 (find-so (lambda (soname)
465 (format #f "~a.so" soname))))
466 (patch-ffi-libs (lambda (file libs)
470 (((format #f "\"~a\"" lib))
471 (format #f "\"~a\"" (find-so lib)))))
473 (substitute* "collects/db/private/sqlite3/ffi.rkt"
474 (("ffi-lib sqlite-so")
475 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
476 (substitute* "collects/openssl/libssl.rkt"
477 (("ffi-lib libssl-so")
478 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
479 (substitute* "collects/openssl/libcrypto.rkt"
480 (("ffi-lib libcrypto-so")
481 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
482 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
483 (("ffi-lib libgmp-so")
484 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
485 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
486 (("ffi-lib libmpfr-so")
487 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
488 (substitute* "share/pkgs/readline-lib/readline/rktrl.rkt"
489 (("\\(getenv \"PLT_READLINE_LIB\"\\)")
490 (format #f "\"~a\"" (find-so "libedit"))))
492 (lambda (x) (apply patch-ffi-libs x))
493 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
494 ("libfontconfig" "libcairo"))
495 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
496 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
497 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
499 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
500 ("libpango-1.0" "libpangocairo-1.0"))
501 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
503 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
505 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
507 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
509 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
510 ("libgdk-3" "libgtk-3"))
511 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
513 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
514 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
515 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
517 ("share/pkgs/sgl/gl.rkt"
518 ("libGL" "libGLU")))))
521 (add-after 'unpack 'patch-/bin/sh
523 (substitute* "collects/racket/system.rkt"
524 (("/bin/sh") (which "sh")))
526 #:tests? #f ; XXX: how to run them?
530 ;; Hardcode dynamically loaded libraries for better functionality.
531 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
533 ("fontconfig" ,fontconfig)
537 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
546 ("unixodbc" ,unixodbc)
547 ("libedit" ,libedit)))
548 (home-page "http://racket-lang.org")
549 (synopsis "Implementation of Scheme and related languages")
551 "Racket is an implementation of the Scheme programming language (R5RS and
552 R6RS) and related languages, such as Typed Racket. It features a compiler and
553 a virtual machine with just-in-time native compilation, as well as a large set
557 (define-public gambit-c
565 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
566 (version-major+minor version) "/source/gambit-v"
567 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
570 (base32 "14x9xa0yh7187alzw2m937jnh4csj0dyywi3va8bhi7aaw4p5qai"))))
571 (build-system gnu-build-system)
574 ;; According to the ./configure script, this makes the build slower and
575 ;; use >= 1 GB memory, but makes Gambit much faster.
576 '("--enable-single-host")))
577 (home-page "http://dynamo.iro.umontreal.ca/wiki/index.php/Main_Page")
578 (synopsis "Efficient Scheme interpreter and compiler")
580 "Gambit consists of two main programs: gsi, the Gambit Scheme
581 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
582 the complete execution and debugging environment. The compiler is the
583 interpreter extended with the capability of generating executable files. The
584 compiler can produce standalone executables or compiled modules which can be
585 loaded at run time. Interpreted code and compiled code can be freely
588 (license (list lgpl2.1+ asl2.0))))
590 (define-public chibi-scheme
592 (name "chibi-scheme")
597 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
600 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
601 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
602 (build-system gnu-build-system)
604 `(#:phases (modify-phases %standard-phases
606 (add-before 'build 'set-cc
608 (setenv "CC" "gcc"))))
609 #:make-flags (let ((out (assoc-ref %outputs "out")))
610 (list (string-append "PREFIX=" out)
611 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
612 #:test-target "test"))
613 (home-page "https://github.com/ashinn/chibi-scheme")
614 (synopsis "Small embeddable Scheme implementation")
616 "Chibi-Scheme is a very small library with no external dependencies
617 intended for use as an extension and scripting language in C programs. In
618 addition to support for lightweight VM-based threads, each VM itself runs in
619 an isolated heap allowing multiple VMs to run simultaneously in different OS
623 (define-public scmutils
625 (define (system-suffix)
627 ((string-prefix? "x86_64" (or (%current-target-system)
637 (method url-fetch/tarbomb)
638 (modules '((guix build utils)))
640 ;; Remove binary code
641 (delete-file-recursively "scmutils/mit-scheme")
643 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
644 "/scmutils-tarballs/" name "-" version
645 "-x86-64-gnu-linux.tar.gz"))
647 (base32 "00ly5m0s4dy5kxravjaqlpii5zcnr6b9nqm0607lr7xcs52i4j8b"))))
648 (build-system gnu-build-system)
650 `(("mit-scheme" ,mit-scheme)
651 ("emacs" ,emacs-minimal)))
653 `(#:tests? #f ;; no tests-suite
654 #:modules ((guix build gnu-build-system)
656 (guix build emacs-utils))
657 #:imported-modules (,@%gnu-build-system-modules
658 (guix build emacs-utils))
660 (modify-phases %standard-phases
662 ;; No standard build procedure is used. We set the correct
663 ;; runtime path in the custom build system.
664 (lambda* (#:key outputs #:allow-other-keys)
665 (let ((out (assoc-ref outputs "out")))
666 ;; Required to find .bci files at runtime.
667 (with-directory-excursion "scmutils"
668 (rename-file "src" "scmutils"))
669 (substitute* "scmutils/scmutils/load.scm"
670 (("/usr/local/scmutils/")
671 (string-append out "/lib/mit-scheme-"
672 ,(system-suffix) "/")))
675 ;; Compile the code and build a band.
676 (lambda* (#:key outputs #:allow-other-keys)
677 (let* ((out (assoc-ref outputs "out"))
678 (make-img (string-append
679 "echo '(load \"load\") "
680 "(disk-save \"edwin-mechanics.com\")'"
682 (with-directory-excursion "scmutils/scmutils"
683 (and (zero? (system "mit-scheme < compile.scm"))
684 (zero? (system make-img))))
686 (add-before 'install 'fix-directory-names
687 ;; Correct directory names in the startup script.
688 (lambda* (#:key inputs outputs #:allow-other-keys)
689 (let* ((out (assoc-ref outputs "out"))
690 (scm-root (assoc-ref inputs "mit-scheme")))
691 (substitute* "bin/mechanics"
692 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
694 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
695 "LIB=\"${ROOT}/lib/mit-scheme-"
697 out "/lib/mit-scheme-" ,(system-suffix) "\""))
698 (("EDWIN_INFO_DIRECTORY=.*\n") "")
700 (string-append "SCHEME=\"${ROOT}/bin/scheme "
701 "--library ${LIB}\"\n"))
702 (("export EDWIN_INFO_DIRECTORY") ""))
704 (add-before 'install 'emacs-tags
705 ;; Generate Emacs's tags for easy reference to source
707 (lambda* (#:key inputs outputs #:allow-other-keys)
708 (with-directory-excursion "scmutils/scmutils"
709 (apply invoke "etags" (find-files "." "\\.scm")))
712 ;; Copy files to the store.
713 (lambda* (#:key outputs #:allow-other-keys)
714 (define* (copy-files-to-directory files dir
715 #:optional (delete? #f))
716 (for-each (lambda (f)
717 (copy-file f (string-append dir "/" f))
718 (when delete? (delete-file f)))
721 (let* ((out (assoc-ref outputs "out"))
722 (bin (string-append out "/bin"))
723 (doc (string-append out "/share/doc/"
725 (lib (string-append out "/lib/mit-scheme-"
728 (for-each mkdir-p (list lib doc bin))
729 (with-directory-excursion "scmutils/scmutils"
730 (copy-files-to-directory '("COPYING" "LICENSE")
732 (for-each delete-file (find-files "." "\\.bin"))
733 (copy-files-to-directory '("edwin-mechanics.com")
734 (string-append lib "/..") #t)
735 (copy-recursively "." lib))
736 (with-directory-excursion "bin"
737 (copy-files-to-directory (find-files ".") bin))
738 (with-directory-excursion "scmutils/manual"
739 (copy-files-to-directory (find-files ".") doc))
741 (add-after 'install 'emacs-helpers
742 ;; Add convenience Emacs commands to easily load the
743 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
744 ;; and to easily load code tags.
745 (lambda* (#:key inputs outputs #:allow-other-keys)
746 (let* ((out (assoc-ref outputs "out"))
747 (mit-root (assoc-ref inputs "mit-scheme"))
749 (string-append out "/share/emacs/site-lisp"
750 "/guix.d/" ,name "-" ,version))
751 (el-file (string-append emacs-lisp-dir
754 (string-append "/lib/mit-scheme-"
756 (mkdir-p emacs-lisp-dir)
757 (call-with-output-file el-file
761 (defun scmutils-load ()
764 (let ((mit-root \"~a\")
767 (concat mit-root \"/bin/scheme --library \"
768 mit-root \"~a:\" scmutils \"~a\"
769 \" --band edwin-mechanics.com\"
773 (defun scmutils-load-tags ()
775 (let ((scmutils \"~a\"))
776 (visit-tags-table (concat scmutils \"/TAGS\"))))
781 (string-append out lib-relative-path
783 (emacs-generate-autoloads ,name emacs-lisp-dir)
784 (emacs-byte-compile-directory emacs-lisp-dir)
787 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
788 (synopsis "Scmutils library for MIT Scheme")
789 (description "The Scmutils system is an integrated library of
790 procedures, embedded in the programming language Scheme, and intended to
791 support teaching and research in mathematical physics and electrical
796 (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
799 (version (string-append "20170703-1." (string-take commit 7)))
803 (url "https://github.com/sarabander/sicp")
807 "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
808 (file-name (string-append name "-" version "-checkout"))))
809 (build-system trivial-build-system)
810 (native-inputs `(("gzip" ,gzip)
812 ("texinfo" ,texinfo)))
814 `(#:modules ((guix build utils)
819 (use-modules (guix build utils)
822 (let ((gzip (assoc-ref %build-inputs "gzip"))
823 (source (assoc-ref %build-inputs "source"))
824 (texinfo (assoc-ref %build-inputs "texinfo"))
825 (html-dir (string-append %output "/share/doc/" ,name "/html"))
826 (info-dir (string-append %output "/share/info")))
827 (copy-recursively (string-append source "/html") html-dir)
828 (setenv "PATH" (string-append gzip "/bin"
831 (invoke "makeinfo" "--output"
832 (string-append info-dir "/sicp.info")
833 (string-append source "/sicp-pocket.texi"))
834 (for-each (cut invoke "gzip" "-9n" <>)
835 (find-files info-dir))
837 (home-page "https://sarabander.github.io/sicp")
838 (synopsis "Structure and Interpretation of Computer Programs")
839 (description "Structure and Interpretation of Computer Programs (SICP) is
840 a textbook aiming to teach the principles of computer programming.
842 Using Scheme, a dialect of the Lisp programming language, the book explains
843 core computer science concepts such as abstraction in programming,
844 metalinguistic abstraction, recursion, interpreters, and modular programming.")
845 (license cc-by-sa4.0))))
847 (define-public scheme48-rx
848 (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
852 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
857 (url "https://github.com/scheme/rx")
861 "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
862 (file-name (string-append name "-" version "-checkout"))))
863 (build-system trivial-build-system)
865 `(#:modules ((guix build utils))
868 (use-modules (guix build utils))
869 (let ((share (string-append %output
871 ,(package-version scheme48)
873 (chdir (assoc-ref %build-inputs "source"))
875 (copy-recursively "." share)
879 ("scheme48" ,scheme48)))
880 (home-page "https://github.com/scheme/rx/")
881 (synopsis "SRE String pattern-matching library for scheme48")
883 "String pattern-matching library for scheme48 based on the SRE
884 regular-expression notation.")
893 (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
897 "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
898 (build-system gnu-build-system)
900 `(#:tests? #f ; There is no check target.
902 (modify-phases %standard-phases
903 (add-after 'install 'remove-bin-share
904 (lambda* (#:key inputs outputs #:allow-other-keys)
905 (delete-file-recursively
906 (string-append (assoc-ref outputs "out") "/bin"))
909 (lambda* (#:key inputs outputs #:allow-other-keys)
910 (invoke "./configure"
911 (string-append "--prefix="
912 (assoc-ref outputs "out"))))))))
913 (native-inputs `(("unzip" ,unzip)
914 ("texinfo" ,texinfo)))
915 (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
916 (synopsis "Compatibility and utility library for Scheme")
917 (description "SLIB is a portable Scheme library providing compatibility and
918 utility functions for all standard Scheme implementations.")
919 (license (non-copyleft
920 "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
921 "Or see COPYING in the distribution."))))
930 "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
934 "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
935 (build-system gnu-build-system)
938 (modify-phases %standard-phases
940 (lambda* (#:key inputs outputs #:allow-other-keys)
941 (invoke "./configure"
942 (string-append "--prefix="
943 (assoc-ref outputs "out")))))
944 (add-before 'build 'pre-build
945 (lambda* (#:key inputs #:allow-other-keys)
946 (substitute* "Makefile"
947 (("ginstall-info") "install-info"))
950 (lambda* (#:key inputs outputs #:allow-other-keys)
951 (setenv "SCHEME_LIBRARY_PATH"
952 (string-append (assoc-ref inputs "slib")
954 (invoke "make" "scmlit" "CC=gcc")
955 (invoke "make" "all")))
956 (add-after 'install 'post-install
957 (lambda* (#:key inputs outputs #:allow-other-keys)
958 (let* ((out (assoc-ref outputs "out"))
959 (req (string-append out "/lib/scm/require.scm")))
961 (format (open req (logior O_WRONLY O_CREAT))
962 "(define (library-vicinity) ~s)\n"
963 (string-append (assoc-ref inputs "slib")
966 ;; We must generate the slibcat file.
967 (invoke (string-append out "/bin/scm")
968 "-br" "new-catalog")))))))
969 (inputs `(("slib" ,slib)))
970 (native-inputs `(("unzip" ,unzip)
971 ("texinfo" ,texinfo)))
972 (home-page "http://people.csail.mit.edu/jaffer/SCM")
973 (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
974 (description "GNU SCM is an implementation of Scheme. This
975 implementation includes Hobbit, a Scheme-to-C compiler, which can
976 generate C files whose binaries can be dynamically or statically
977 linked with a SCM executable.")
980 (define-public tinyscheme
986 (uri (string-append "mirror://sourceforge/" name "/" name "/"
987 name "-" version "/" name "-" version ".zip"))
990 "0yqma4jrjgj95f3hf30h542x97n8ah234n19yklbqq0phfsa08wf"))))
991 (build-system gnu-build-system)
996 (modify-phases %standard-phases
998 (lambda* (#:key source #:allow-other-keys)
999 (invoke "unzip" source)
1000 (chdir (string-append ,name "-" ,version))
1002 (add-after 'unpack 'set-scm-directory
1003 ;; Hard-code ‘our’ init.scm instead of looking in the current
1004 ;; working directory, so invoking ‘scheme’ just works.
1005 (lambda* (#:key outputs #:allow-other-keys)
1006 (let* ((out (assoc-ref outputs "out"))
1007 (scm (string-append out "/share/" ,name)))
1008 (substitute* "scheme.c"
1010 (string-append scm "/" all)))
1012 (delete 'configure) ; no configure script
1014 ;; There's no ‘install’ target. Install files manually.
1015 (lambda* (#:key outputs #:allow-other-keys)
1016 (let* ((out (assoc-ref outputs "out"))
1017 (bin (string-append out "/bin"))
1018 (doc (string-append out "/share/doc/"
1019 ,name "-" ,version))
1020 (include (string-append out "/include"))
1021 (lib (string-append out "/lib"))
1022 (scm (string-append out "/share/" ,name)))
1023 (install-file "scheme" bin)
1024 (install-file "Manual.txt" doc)
1025 (install-file "scheme.h" include)
1026 (install-file "libtinyscheme.so" lib)
1027 (install-file "init.scm" scm)
1029 #:tests? #f)) ; no tests
1030 (home-page "http://tinyscheme.sourceforge.net/")
1031 (synopsis "Light-weight interpreter for the Scheme programming language")
1033 "TinyScheme is a light-weight Scheme interpreter that implements as large a
1034 subset of R5RS as was possible without getting very large and complicated.
1036 It's meant to be used as an embedded scripting interpreter for other programs.
1037 As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or
1038 extensive toolkits, although it does sport a small (and optional) top-level
1041 As an embedded interpreter, it allows multiple interpreter states to coexist in
1042 the same program, without any interference between them. Foreign functions in C
1043 can be added and values can be defined in the Scheme environment. Being quite a
1044 small program, it is easy to comprehend, get to grips with, and use.")
1045 (license bsd-3))) ; there are no licence headers
1047 (define-public stalin
1048 (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
1049 ;; FIXME: The Stalin "source" contains C code generated by itself:
1050 ;; 'stalin-AMD64.c', etc.
1055 ;; Use Pearlmutter's upstream branch with AMD64 patches
1056 ;; applied. Saves us from including those 20M! patches
1057 ;; in Guix. For more info, see:
1058 ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
1061 (url "https://github.com/barak/stalin.git")
1063 (file-name (string-append name "-" version "-checkout"))
1066 "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
1067 (modules '((guix build utils)))
1069 ;; remove gc libs from build, we have them as input
1071 (delete-file "gc6.8.tar.gz")
1072 (delete-file-recursively "benchmarks")
1073 (substitute* "build"
1076 ((".*B include/libgc.a") "")
1079 (build-system gnu-build-system)
1081 `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
1083 (modify-phases %standard-phases
1085 (lambda* (#:key outputs #:allow-other-keys)
1086 (let* ((out (assoc-ref outputs "out"))
1087 (include-out (string-append out "/include")))
1089 (for-each (lambda (fname)
1090 (install-file fname include-out))
1091 (find-files "include"))
1092 (substitute* "makefile"
1093 (("\\./include") include-out))
1094 (substitute* "post-make"
1099 (lambda* (#:key outputs #:allow-other-keys)
1100 (let ((out (assoc-ref outputs "out")))
1101 (install-file "stalin.1"
1102 (string-append out "/share/man/man1"))
1103 (install-file "stalin"
1104 (string-append out "/bin"))
1107 `(("libx11" ,libx11)))
1109 `(("libgc" ,libgc)))
1110 (supported-systems '("x86_64-linux"))
1111 (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
1112 (synopsis "Brutally efficient Scheme compiler")
1114 "Stalin is an aggressively optimizing whole-program compiler
1115 for Scheme that does polyvariant interprocedural flow analysis,
1116 flow-directed interprocedural escape analysis, flow-directed
1117 lightweight CPS conversion, flow-directed lightweight closure
1118 conversion, flow-directed interprocedural lifetime analysis, automatic
1119 in-lining, unboxing, and flow-directed program-specific and
1120 program-point-specific low-level representation selection and code
1124 (define-public femtolisp
1125 (let ((commit "68c5b1225572ecf2c52baf62f928063e5a30511b")
1129 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
1133 (url "https://github.com/JeffBezanson/femtolisp.git")
1135 (file-name (string-append name "-" version "-checkout"))
1138 "04rnwllxnl86zw8c6pwxznn49bvkvh0f1lfliy085vjzvlq3rgja"))))
1139 ;; See "utils.h" for supported systems. Upstream bug:
1140 ;; https://github.com/JeffBezanson/femtolisp/issues/25
1142 (fold delete %supported-systems
1143 '("armhf-linux" "mips64el-linux" "aarch64-linux")))
1144 (build-system gnu-build-system)
1146 `(#:make-flags '("CC=gcc" "release")
1147 #:test-target "test"
1149 (modify-phases %standard-phases
1150 (delete 'configure) ; No configure script
1151 (replace 'install ; Makefile has no 'install phase
1152 (lambda* (#:key outputs #:allow-other-keys)
1153 (let* ((out (assoc-ref outputs "out"))
1154 (bin (string-append out "/bin")))
1155 (install-file "flisp" bin)
1157 ;; The flisp binary is now available, run bootstrap to
1158 ;; generate flisp.boot and afterwards runs make test.
1159 (add-after 'install 'bootstrap-gen-and-test
1160 (lambda* (#:key outputs #:allow-other-keys)
1161 (let* ((out (assoc-ref outputs "out"))
1162 (bin (string-append out "/bin")))
1164 (zero? (system* "./bootstrap.sh"))
1165 (install-file "flisp.boot" bin))))))))
1166 (synopsis "Scheme-like lisp implementation")
1168 "@code{femtolisp} is a scheme-like lisp implementation with a
1169 simple, elegant Scheme dialect. It is a lisp-1 with lexical scope.
1170 The core is 12 builtin special forms and 33 builtin functions.")
1171 (home-page "https://github.com/JeffBezanson/femtolisp")
1174 (define-public gauche
1178 (home-page "http://practical-scheme.net/gauche/index.html")
1183 "mirror://sourceforge/gauche/Gauche/Gauche-"
1187 "181nycikma0rwrb1h6mi3kys11f8628pq8g5r3fg5hiz5sabscrd"))
1188 (modules '((guix build utils)))
1190 ;; Remove libatomic-ops
1191 (delete-file-recursively "gc/libatomic_ops")
1193 (build-system gnu-build-system)
1195 `(("libatomic-ops" ,libatomic-ops)
1198 `(("texinfo" ,texinfo)
1199 ("openssl" ,openssl) ; needed for tests
1200 ("pkg-config" ,pkg-config))) ; needed to find external libatomic-ops
1203 (modify-phases %standard-phases
1204 (add-after 'unpack 'patch-/bin/sh
1205 ;; needed only for tests
1207 (substitute* '("configure"
1211 "lib/gauche/configure.scm"
1212 "lib/gauche/package/util.scm"
1213 "lib/gauche/process.scm")
1214 (("/bin/sh") (which "sh")))
1216 (add-after 'build 'build-doc
1217 (lambda* (#:key outputs #:allow-other-keys)
1218 (let* ((out (assoc-ref outputs "out")))
1219 (with-directory-excursion "doc"
1222 (invoke "make" target))
1223 '("info" "html" "htmls"))))
1225 (add-before 'check 'patch-normalize-test
1226 ;; neutralize sys-normalize-pathname test as it relies on
1227 ;; the home directory; (setenv "HOME" xx) isn't enough)
1229 (substitute* "test/system.scm"
1230 (("~/abc") "//abc"))
1232 (add-before 'check 'patch-network-tests
1233 ;; remove net checks
1235 (substitute* "ext/Makefile"
1236 (("binary net termios") "binary termios"))
1238 (add-after 'install 'install-docs
1239 (lambda* (#:key outputs #:allow-other-keys)
1240 (let* ((out (assoc-ref outputs "out")))
1241 (with-directory-excursion "doc"
1242 (invoke "make" "install")))
1244 (synopsis "Scheme scripting engine")
1245 (description "Gauche is a R7RS Scheme scripting engine aiming at being a
1246 handy tool that helps programmers and system administrators to write small to
1247 large scripts quickly. Quick startup, built-in system interface, native
1248 multilingual support are some of the goals. Gauche comes with a package
1249 manager/installer @code{gauche-package} which can download, compile, install
1250 and list gauche extension packages. There are currently 58 packages