1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 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 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages scheme)
26 #:use-module (gnu packages)
27 #:use-module ((guix licenses)
28 #:select (gpl2+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix utils)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system trivial)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages m4)
38 #:use-module (gnu packages multiprecision)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages emacs)
42 #:use-module (gnu packages ghostscript)
43 #:use-module (gnu packages netpbm)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages tex)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages avahi)
50 #:use-module (gnu packages libphidget)
51 #:use-module (gnu packages gcc)
52 #:use-module (gnu packages glib)
53 #:use-module (gnu packages gtk)
54 #:use-module (gnu packages libffi)
55 #:use-module (gnu packages fontutils)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages xorg)
58 #:use-module (gnu packages tls)
59 #:use-module (gnu packages gl)
60 #:use-module (ice-9 match))
62 (define (mit-scheme-source-directory system version)
63 (string-append "mit-scheme-"
64 (if (or (string-prefix? "x86_64" system)
65 (string-prefix? "i686" system))
70 (define-public mit-scheme
74 (source #f) ; see below
75 (outputs '("out" "doc"))
76 (build-system gnu-build-system)
78 `(#:tests? #f ; no "check" target
79 #:modules ((guix build gnu-build-system)
83 (modify-phases %standard-phases
85 (lambda* (#:key inputs #:allow-other-keys)
86 (and (zero? (system* "tar" "xzvf"
87 (assoc-ref inputs "source")))
88 (chdir ,(mit-scheme-source-directory (%current-system)
91 ;; Delete these dangling symlinks since they break
94 (append '("src/lib/shim-config.scm")
95 (find-files "src/lib/lib" "\\.so$")
96 (find-files "src/lib" "^liarc-")
97 (find-files "src/compiler" "^make\\.")))
101 (lambda* (#:key system outputs #:allow-other-keys)
102 (let ((out (assoc-ref outputs "out")))
103 (if (or (string-prefix? "x86_64" system)
104 (string-prefix? "i686" system))
105 (zero? (system* "make" "compile-microcode"))
106 (zero? (system* "./etc/make-liarc.sh"
107 (string-append "--prefix=" out)))))))
108 (add-after 'configure 'configure-doc
109 (lambda* (#:key outputs inputs #:allow-other-keys)
110 (with-directory-excursion "../doc"
111 (let* ((out (assoc-ref outputs "out"))
112 (bash (assoc-ref inputs "bash"))
113 (bin/sh (string-append bash "/bin/sh")))
114 (system* bin/sh "./configure"
115 (string-append "--prefix=" out)
116 (string-append "SHELL=" bin/sh))
117 (substitute* '("Makefile" "make-common")
118 (("/lib/mit-scheme/doc")
119 (string-append "/share/doc/" ,name "-" ,version)))
121 (add-after 'build 'build-doc
123 (with-directory-excursion "../doc"
124 (zero? (system* "make")))))
125 (add-after 'install 'install-doc
126 (lambda* (#:key outputs #:allow-other-keys)
127 (let* ((out (assoc-ref outputs "out"))
128 (doc (assoc-ref outputs "doc"))
129 (old-doc-dir (string-append out "/share/doc"))
130 (new-doc/mit-scheme-dir
131 (string-append doc "/share/doc/" ,name "-" ,version)))
132 (with-directory-excursion "../doc"
133 (for-each (lambda (target)
134 (system* "make" target))
135 '("install-config" "install-info-gz" "install-man"
136 "install-html" "install-pdf")))
137 (mkdir-p new-doc/mit-scheme-dir)
139 (string-append old-doc-dir "/" ,name "-" ,version)
140 new-doc/mit-scheme-dir)
141 (delete-file-recursively old-doc-dir)
144 `(("texlive" ,texlive)
152 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
153 ;; compile from the architecture-specific tarballs, which contain
154 ;; pre-built binaries. It leads to more efficient code than when
155 ;; building the tarball that contains generated C code instead of
159 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
160 version "/mit-scheme-"
161 (match (%current-system)
163 (string-append version "-x86-64"))
165 (string-append version "-i386"))
167 (string-append "c-" version)))
170 (match (%current-system)
173 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
176 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
179 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
181 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
182 (supported-systems (delete "mips64el-linux" %supported-systems))
184 (home-page "http://www.gnu.org/software/mit-scheme/")
185 (synopsis "A Scheme implementation with integrated editor and debugger")
187 "GNU/MIT Scheme is an implementation of the Scheme programming
188 language. It provides an interpreter, a compiler and a debugger. It also
189 features an integrated Emacs-like editor and a large runtime library.")
191 (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
193 (define-public bigloo
199 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
203 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
204 (patches (search-patches "bigloo-gc-shebangs.patch"))))
205 (build-system gnu-build-system)
207 `(#:test-target "test"
208 #:phases (alist-replace
210 (lambda* (#:key outputs #:allow-other-keys)
212 (substitute* "configure"
214 (string-append "shell=" (which "bash") "\n")))
216 ;; Since libgc's pthread redirects are used, we end up
217 ;; using libgc symbols, so we must link against it.
218 ;; Reported on 2013-06-25.
219 (substitute* "api/pthread/src/Makefile"
220 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
221 (string-append "EXTRALIBS = "
222 (string-trim-right value)
223 " -l$(GCLIB)_fth-$(RELEASE)"
224 " -Wl,-rpath=" (assoc-ref outputs "out")
225 "/lib/bigloo/" ,version)))
227 ;; Those variables are used by libgc's `configure'.
228 (setenv "SHELL" (which "sh"))
229 (setenv "CONFIG_SHELL" (which "sh"))
231 ;; ... but they turned out to be overridden later, so work
233 (substitute* (find-files "gc" "^configure-gc")
235 (string-append "sh=" (which "sh"))))
237 ;; The `configure' script doesn't understand options
238 ;; of those of Autoconf.
239 (let ((out (assoc-ref outputs "out")))
241 (system* "./configure"
242 (string-append "--prefix=" out)
243 ;; FIXME: Currently fails, see
244 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
245 ;; "--customgc=no" ; use our libgc
246 (string-append"--mv=" (which "mv"))
247 (string-append "--rm=" (which "rm"))
248 (string-append "--ldflags=-Wl,-rpath="
249 (assoc-ref outputs "out")
250 "/lib/bigloo/" ,version)))))
252 'install 'install-emacs-modes
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((out (assoc-ref outputs "out"))
255 (dir (string-append out "/share/emacs/site-lisp")))
256 (zero? (system* "make" "-C" "bmacs" "all" "install"
257 (string-append "EMACSBRAND=emacs24")
258 (string-append "EMACSDIR=" dir)))))
261 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
263 ;; Optional APIs for which Bigloo has bindings.
265 ("libphidget" ,libphidget)))
267 `(("pkg-config" ,pkg-config)))
269 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
270 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
271 (synopsis "Efficient Scheme compiler")
273 "Bigloo is a Scheme implementation devoted to one goal: enabling
274 Scheme based programming style where C(++) is usually
275 required. Bigloo attempts to make Scheme practical by offering
276 features usually presented by traditional programming languages
277 but not offered by Scheme and functional programming. Bigloo
278 compiles Scheme modules. It delivers small and fast stand alone
279 binary executables. Bigloo enables full connections between
280 Scheme and C programs and between Scheme and Java programs.")
289 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
293 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
294 (patches (search-patches "hop-bigloo-4.0b.patch"
295 "hop-linker-flags.patch"))))
296 (build-system gnu-build-system)
301 (lambda* (#:key outputs #:allow-other-keys)
302 (let ((out (assoc-ref outputs "out")))
304 (system* "./configure"
305 (string-append "--prefix=" out)
306 (string-append "--blflags="
307 ;; user flags completely override useful
308 ;; default flags, so repeat them here.
309 "-copt \\$(CPICFLAGS) -L\\$(BUILDLIBDIR) "
310 "-ldopt -Wl,-rpath," out "/lib")))))
312 #:tests? #f)) ; no test suite
313 (inputs `(("avahi" ,avahi)
316 (home-page "http://hop.inria.fr/")
317 (synopsis "Multi-tier programming language for the Web 2.0")
319 "HOP is a multi-tier programming language for the Web 2.0 and the
320 so-called diffuse Web. It is designed for programming interactive web
321 applications in many fields such as multimedia (web galleries, music players,
322 ...), ubiquitous and house automation (SmartPhones, personal appliance),
323 mashups, office (web agendas, mail clients, ...), etc.")
326 (define-public chicken
332 (uri (string-append "http://code.call-cc.org/releases/"
333 version "/chicken-" version ".tar.gz"))
336 "12ddyiikqknpr8h6llsxbg2fz75xnayvcnsvr1cwv8xnjn7jpp73"))))
337 (build-system gnu-build-system)
339 `(#:modules ((guix build gnu-build-system)
343 ;; No `configure' script; run "make check" after "make install" as
344 ;; prescribed by README.
346 (modify-phases %standard-phases
349 (add-after 'install 'check
350 (assoc-ref %standard-phases 'check))
351 (add-after 'unpack 'disable-broken-tests
353 ;; The port tests fail with this error:
354 ;; Error: (line 294) invalid escape-sequence '\x o'
355 (substitute* "tests/runtests.sh"
356 (("\\$interpret -s port-tests\\.scm") ""))
359 #:make-flags (let ((out (assoc-ref %outputs "out")))
360 (list "PLATFORM=linux"
361 (string-append "PREFIX=" out)
362 (string-append "VARDIR=" out "/var/lib")))
364 ;; Parallel builds are not supported, as noted in README.
365 #:parallel-build? #f))
366 ;; One of the tests ("testing direct invocation can detect calls of too
367 ;; many arguments...") times out when building with a more recent GCC.
368 ;; The problem was reported here:
369 ;; https://lists.gnu.org/archive/html/chicken-hackers/2015-04/msg00059.html
372 (home-page "http://www.call-cc.org/")
373 (synopsis "R5RS Scheme implementation that compiles native code via C")
375 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
376 produces portable and efficient C, supports almost all of the R5RS Scheme
377 language standard, and includes many enhancements and extensions.")
380 (define-public scheme48
386 (uri (string-append "http://s48.org/" version
387 "/scheme48-" version ".tgz"))
390 "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
391 (patches (search-patches "scheme48-tests.patch"))))
392 (build-system gnu-build-system)
393 (home-page "http://s48.org/")
394 (synopsis "Scheme implementation using a bytecode interpreter")
396 "Scheme 48 is an implementation of Scheme based on a byte-code
397 interpreter and is designed to be used as a testbed for experiments in
398 implementation techniques and as an expository tool.")
400 ;; Most files are BSD-3; see COPYING for the few exceptions.
403 (define-public racket
409 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
410 version "/racket-" version "-src.tgz")
412 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
413 version "/racket/racket-" version "-src-unix.tgz")))
416 "1kzdi1n6h6hmz8zd9k8r5a5yp2ryi4w3c2fjm1k6cqicn18cwaxz"))))
417 (build-system gnu-build-system)
421 'configure 'pre-configure
422 (lambda* (#:key inputs #:allow-other-keys)
423 ;; Patch dynamically loaded libraries with their absolute paths.
424 (let* ((library-path (search-path-as-string->list
425 (getenv "LIBRARY_PATH")))
426 (find-so (lambda (soname)
429 (format #f "~a.so" soname))))
430 (patch-ffi-libs (lambda (file libs)
434 (((format #f "\"~a\"" lib))
435 (format #f "\"~a\"" (find-so lib)))))
437 (substitute* "collects/db/private/sqlite3/ffi.rkt"
438 (("ffi-lib sqlite-so")
439 (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
440 (substitute* "collects/openssl/libssl.rkt"
441 (("ffi-lib libssl-so")
442 (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
443 (substitute* "collects/openssl/libcrypto.rkt"
444 (("ffi-lib libcrypto-so")
445 (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
446 (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
447 (("ffi-lib libgmp-so")
448 (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
449 (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
450 (("ffi-lib libmpfr-so")
451 (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
453 (lambda (x) (apply patch-ffi-libs x))
454 '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
455 ("libfontconfig" "libcairo"))
456 ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
457 ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
458 ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
460 ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
461 ("libpango-1.0" "libpangocairo-1.0"))
462 ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
464 ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
466 ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
468 ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
470 ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
471 ("libgdk-3" "libgtk-3"))
472 ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
474 ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
475 ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
476 ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
478 ("share/pkgs/sgl/gl.rkt"
479 ("libGL" "libGLU")))))
482 'unpack 'patch-/bin/sh
484 (substitute* "collects/racket/system.rkt"
485 (("/bin/sh") (which "sh"))))
487 #:tests? #f ; XXX: how to run them?
491 ;; Hardcode dynamically loaded libraries for better functionality.
492 ;; sqlite and libraries for `racket/draw' are needed to build the doc.
494 ("fontconfig" ,fontconfig)
498 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
507 ("unixodbc" ,unixodbc)))
508 (home-page "http://racket-lang.org")
509 (synopsis "Implementation of Scheme and related languages")
511 "Racket is an implementation of the Scheme programming language (R5RS and
512 R6RS) and related languages, such as Typed Racket. It features a compiler and
513 a virtual machine with just-in-time native compilation, as well as a large set
517 (define-public gambit-c
525 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
526 (version-major+minor version) "/source/gambc-v"
527 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
530 (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs"))))
531 (build-system gnu-build-system)
534 ;; According to the ./configure script, this makes the build slower and
535 ;; use >= 1 GB memory, but makes Gambit much faster.
536 '("--enable-single-host")
541 (substitute* '("tests/makefile")
542 ;; '-:' is how run-time options are set. 'tl' sets some terminal
543 ;; option, which makes it fail in our build environment. It
544 ;; recommends using 'd-' as a solution, which sets the REPL
545 ;; interaction channel to stdin/stdout.
546 (("gsi -:tl") "gsi -:d-,tl")))
548 (home-page "http://www.iro.umontreal.ca/~gambit/")
549 (synopsis "Efficient Scheme interpreter and compiler")
551 "Gambit consists of two main programs: gsi, the Gambit Scheme
552 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
553 the complete execution and debugging environment. The compiler is the
554 interpreter extended with the capability of generating executable files. The
555 compiler can produce standalone executables or compiled modules which can be
556 loaded at run time. Interpreted code and compiled code can be freely
559 (license (list lgpl2.1+ asl2.0))))
561 (define-public chibi-scheme
563 (name "chibi-scheme")
568 (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
571 (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
572 (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
573 (build-system gnu-build-system)
575 `(#:phases (modify-phases %standard-phases
577 (add-before 'build 'set-cc
579 (setenv "CC" "gcc"))))
580 #:make-flags (let ((out (assoc-ref %outputs "out")))
581 (list (string-append "PREFIX=" out)
582 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
583 #:test-target "test"))
584 (home-page "https://code.google.com/p/chibi-scheme/")
585 (synopsis "Small embeddable Scheme implementation")
587 "Chibi-Scheme is a very small library with no external dependencies
588 intended for use as an extension and scripting language in C programs. In
589 addition to support for lightweight VM-based threads, each VM itself runs in
590 an isolated heap allowing multiple VMs to run simultaneously in different OS
594 (define-public scmutils
596 (define (system-suffix)
598 ((string-prefix? "x86_64" (or (%current-target-system)
608 (method url-fetch/tarbomb)
609 (modules '((guix build utils)))
611 ;; Remove binary code
612 '(delete-file-recursively "scmutils/mit-scheme"))
613 (file-name (string-append name "-" version ".tar.gz"))
614 (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
615 "/scmutils-tarballs/" name "-" version
616 "-x86-64-gnu-linux.tar.gz"))
618 (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
619 (build-system gnu-build-system)
621 `(("mit-scheme" ,mit-scheme)
622 ("emacs" ,emacs-minimal)))
624 `(#:tests? #f ;; no tests-suite
625 #:modules ((guix build gnu-build-system)
627 (guix build emacs-utils))
628 #:imported-modules (,@%gnu-build-system-modules
629 (guix build emacs-utils))
631 (modify-phases %standard-phases
633 ;; No standard build procedure is used. We set the correct
634 ;; runtime path in the custom build system.
635 (lambda* (#:key outputs #:allow-other-keys)
636 (let ((out (assoc-ref outputs "out")))
637 ;; Required to find .bci files at runtime.
638 (with-directory-excursion "scmutils"
639 (rename-file "src" "scmutils"))
640 (substitute* "scmutils/scmutils/load.scm"
641 (("/usr/local/scmutils/")
642 (string-append out "/lib/mit-scheme-"
643 ,(system-suffix) "/")))
646 ;; Compile the code and build a band.
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let* ((out (assoc-ref outputs "out"))
649 (make-img (string-append
650 "echo '(load \"load\") "
651 "(disk-save \"edwin-mechanics.com\")'"
653 (with-directory-excursion "scmutils/scmutils"
654 (and (zero? (system "mit-scheme < compile.scm"))
655 (zero? (system make-img)))))))
656 (add-before 'install 'fix-directory-names
657 ;; Correct directory names in the startup script.
658 (lambda* (#:key inputs outputs #:allow-other-keys)
659 (let* ((out (assoc-ref outputs "out"))
660 (scm-root (assoc-ref inputs "mit-scheme")))
661 (substitute* "bin/mechanics"
662 (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
664 "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
665 "LIB=\"${ROOT}/lib/mit-scheme-"
667 out "/lib/mit-scheme-" ,(system-suffix) "\""))
668 (("EDWIN_INFO_DIRECTORY=.*\n") "")
670 (string-append "SCHEME=\"${ROOT}/bin/scheme "
671 "--library ${LIB}\"\n"))
672 (("export EDWIN_INFO_DIRECTORY") ""))
674 (add-before 'install 'emacs-tags
675 ;; Generate Emacs's tags for easy reference to source
677 (lambda* (#:key inputs outputs #:allow-other-keys)
678 (with-directory-excursion "scmutils/scmutils"
679 (zero? (apply system* "etags"
680 (find-files "." "\\.scm"))))))
682 ;; Copy files to the store.
683 (lambda* (#:key outputs #:allow-other-keys)
684 (define* (copy-files-to-directory files dir
685 #:optional (delete? #f))
686 (for-each (lambda (f)
687 (copy-file f (string-append dir "/" f))
688 (when delete? (delete-file f)))
691 (let* ((out (assoc-ref outputs "out"))
692 (bin (string-append out "/bin"))
693 (doc (string-append out "/share/doc/"
695 (lib (string-append out "/lib/mit-scheme-"
698 (for-each mkdir-p (list lib doc bin))
699 (with-directory-excursion "scmutils/scmutils"
700 (copy-files-to-directory '("COPYING" "LICENSE")
702 (for-each delete-file (find-files "." "\\.bin"))
703 (copy-files-to-directory '("edwin-mechanics.com")
704 (string-append lib "/..") #t)
705 (copy-recursively "." lib))
706 (with-directory-excursion "bin"
707 (copy-files-to-directory (find-files ".") bin))
708 (with-directory-excursion "scmutils/manual"
709 (copy-files-to-directory (find-files ".") doc))
711 (add-after 'install 'emacs-helpers
712 ;; Add convenience Emacs commands to easily load the
713 ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
714 ;; and to easily load code tags.
715 (lambda* (#:key inputs outputs #:allow-other-keys)
716 (let* ((out (assoc-ref outputs "out"))
717 (mit-root (assoc-ref inputs "mit-scheme"))
719 (string-append out "/share/emacs/site-lisp"
720 "/guix.d/" ,name "-" ,version))
721 (el-file (string-append emacs-lisp-dir
724 (string-append "/lib/mit-scheme-"
726 (mkdir-p emacs-lisp-dir)
727 (call-with-output-file el-file
731 (defun scmutils-load ()
734 (let ((mit-root \"~a\")
737 (concat mit-root \"/bin/scheme --library \"
738 mit-root \"~a:\" scmutils \"~a\"
739 \" --band edwin-mechanics.com\"
743 (defun scmutils-load-tags ()
745 (let ((scmutils \"~a\"))
746 (visit-tags-table (concat scmutils \"/TAGS\"))))
751 (string-append out lib-relative-path
753 (emacs-generate-autoloads ,name emacs-lisp-dir)
754 (emacs-byte-compile-directory emacs-lisp-dir)
757 "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
758 (synopsis "Scmutils library for MIT Scheme")
759 (description "The Scmutils system is an integrated library of
760 procedures, embedded in the programming language Scheme, and intended to
761 support teaching and research in mathematical physics and electrical
766 (let ((commit "5b52db566968d28a89fbbaf338d207f01cc81cac"))
769 (version (string-append "20160220-1." (string-take commit 7)))
773 (url "https://github.com/sarabander/sicp")
777 "10h6h7szwlfbshwh18bnl2hvyddj5i7106l79s145l0sjjv15cxb"))
778 (file-name (string-append name "-" version "-checkout"))))
779 (build-system trivial-build-system)
780 (native-inputs `(("gzip" ,gzip)
782 ("texinfo" ,texinfo)))
784 `(#:modules ((guix build utils)
789 (use-modules (guix build utils)
792 (let ((gzip (assoc-ref %build-inputs "gzip"))
793 (source (assoc-ref %build-inputs "source"))
794 (texinfo (assoc-ref %build-inputs "texinfo"))
795 (info-dir (string-append %output "/share/info")))
796 (setenv "PATH" (string-append gzip "/bin"
800 (system* "makeinfo" "--output"
801 (string-append info-dir "/sicp.info")
802 (string-append source "/sicp-pocket.texi")))
804 (map (cut system* "gzip" "-9n" <>)
805 (find-files info-dir))))))))
806 (home-page "http://sarabander.github.io/sicp")
807 (synopsis "Structure and Interpretation of Computer Programs")
808 (description "Structure and Interpretation of Computer Programs (SICP) is
809 a textbook aiming to teach the principles of computer programming.
811 Using Scheme, a dialect of the Lisp programming language, the book explains
812 core computer science concepts such as abstraction in programming,
813 metalinguistic abstraction, recursion, interpreters, and modular programming.")
814 (license cc-by-sa4.0))))