scheme.scm 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  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, 2017 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
  8. ;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
  9. ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
  10. ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
  11. ;;;
  12. ;;; This file is part of GNU Guix.
  13. ;;;
  14. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  15. ;;; under the terms of the GNU General Public License as published by
  16. ;;; the Free Software Foundation; either version 3 of the License, or (at
  17. ;;; your option) any later version.
  18. ;;;
  19. ;;; GNU Guix is distributed in the hope that it will be useful, but
  20. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;;; GNU General Public License for more details.
  23. ;;;
  24. ;;; You should have received a copy of the GNU General Public License
  25. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  26. (define-module (gnu packages scheme)
  27. #:use-module (gnu packages)
  28. #:use-module ((guix licenses)
  29. #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
  30. cc-by-sa4.0 non-copyleft))
  31. #:use-module (guix packages)
  32. #:use-module (guix download)
  33. #:use-module (guix git-download)
  34. #:use-module (guix utils)
  35. #:use-module (guix build-system gnu)
  36. #:use-module (guix build-system trivial)
  37. #:use-module (gnu packages bdw-gc)
  38. #:use-module (gnu packages compression)
  39. #:use-module (gnu packages libevent)
  40. #:use-module (gnu packages libunistring)
  41. #:use-module (gnu packages m4)
  42. #:use-module (gnu packages multiprecision)
  43. #:use-module (gnu packages ncurses)
  44. #:use-module (gnu packages pcre)
  45. #:use-module (gnu packages databases)
  46. #:use-module (gnu packages emacs)
  47. #:use-module (gnu packages ghostscript)
  48. #:use-module (gnu packages netpbm)
  49. #:use-module (gnu packages texinfo)
  50. #:use-module (gnu packages tex)
  51. #:use-module (gnu packages base)
  52. #:use-module (gnu packages compression)
  53. #:use-module (gnu packages pkg-config)
  54. #:use-module (gnu packages avahi)
  55. #:use-module (gnu packages libphidget)
  56. #:use-module (gnu packages gcc)
  57. #:use-module (gnu packages glib)
  58. #:use-module (gnu packages gtk)
  59. #:use-module (gnu packages libffi)
  60. #:use-module (gnu packages fontutils)
  61. #:use-module (gnu packages image)
  62. #:use-module (gnu packages xorg)
  63. #:use-module (gnu packages tls)
  64. #:use-module (gnu packages gl)
  65. #:use-module (ice-9 match))
  66. (define (mit-scheme-source-directory system version)
  67. (string-append "mit-scheme-"
  68. (if (or (string-prefix? "x86_64" system)
  69. (string-prefix? "i686" system))
  70. ""
  71. "c-")
  72. version))
  73. (define-public mit-scheme
  74. (package
  75. (name "mit-scheme")
  76. (version "9.2")
  77. (source #f) ; see below
  78. (outputs '("out" "doc"))
  79. (build-system gnu-build-system)
  80. (arguments
  81. `(#:tests? #f ; no "check" target
  82. #:modules ((guix build gnu-build-system)
  83. (guix build utils)
  84. (srfi srfi-1))
  85. #:phases
  86. (modify-phases %standard-phases
  87. (replace 'unpack
  88. (lambda* (#:key inputs #:allow-other-keys)
  89. (and (zero? (system* "tar" "xzvf"
  90. (assoc-ref inputs "source")))
  91. (chdir ,(mit-scheme-source-directory (%current-system)
  92. version))
  93. (begin
  94. ;; Delete these dangling symlinks since they break
  95. ;; `patch-shebangs'.
  96. (for-each delete-file
  97. (append '("src/lib/shim-config.scm")
  98. (find-files "src/lib/lib" "\\.so$")
  99. (find-files "src/lib" "^liarc-")
  100. (find-files "src/compiler" "^make\\.")))
  101. (chdir "src")
  102. #t))))
  103. (replace 'build
  104. (lambda* (#:key system outputs #:allow-other-keys)
  105. (let ((out (assoc-ref outputs "out")))
  106. (if (or (string-prefix? "x86_64" system)
  107. (string-prefix? "i686" system))
  108. (zero? (system* "make" "compile-microcode"))
  109. (zero? (system* "./etc/make-liarc.sh"
  110. (string-append "--prefix=" out)))))))
  111. (add-after 'configure 'configure-doc
  112. (lambda* (#:key outputs inputs #:allow-other-keys)
  113. (with-directory-excursion "../doc"
  114. (let* ((out (assoc-ref outputs "out"))
  115. (bash (assoc-ref inputs "bash"))
  116. (bin/sh (string-append bash "/bin/sh")))
  117. (system* bin/sh "./configure"
  118. (string-append "--prefix=" out)
  119. (string-append "SHELL=" bin/sh))
  120. (substitute* '("Makefile" "make-common")
  121. (("/lib/mit-scheme/doc")
  122. (string-append "/share/doc/" ,name "-" ,version)))
  123. #t))))
  124. (add-after 'build 'build-doc
  125. (lambda* _
  126. (with-directory-excursion "../doc"
  127. (zero? (system* "make")))))
  128. (add-after 'install 'install-doc
  129. (lambda* (#:key outputs #:allow-other-keys)
  130. (let* ((out (assoc-ref outputs "out"))
  131. (doc (assoc-ref outputs "doc"))
  132. (old-doc-dir (string-append out "/share/doc"))
  133. (new-doc/mit-scheme-dir
  134. (string-append doc "/share/doc/" ,name "-" ,version)))
  135. (with-directory-excursion "../doc"
  136. (for-each (lambda (target)
  137. (system* "make" target))
  138. '("install-config" "install-info-gz" "install-man"
  139. "install-html" "install-pdf")))
  140. (mkdir-p new-doc/mit-scheme-dir)
  141. (copy-recursively
  142. (string-append old-doc-dir "/" ,name "-" ,version)
  143. new-doc/mit-scheme-dir)
  144. (delete-file-recursively old-doc-dir)
  145. #t))))))
  146. (native-inputs
  147. `(("texlive" ,texlive)
  148. ("texinfo" ,texinfo)
  149. ("m4" ,m4)))
  150. (inputs
  151. `(("libx11" ,libx11)
  152. ("source"
  153. ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
  154. ;; compile from the architecture-specific tarballs, which contain
  155. ;; pre-built binaries. It leads to more efficient code than when
  156. ;; building the tarball that contains generated C code instead of
  157. ;; those binaries.
  158. ,(origin
  159. (method url-fetch)
  160. (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
  161. version "/mit-scheme-"
  162. (match (%current-system)
  163. ("x86_64-linux"
  164. (string-append version "-x86-64"))
  165. ("i686-linux"
  166. (string-append version "-i386"))
  167. (_
  168. (string-append "c-" version)))
  169. ".tar.gz"))
  170. (sha256
  171. (match (%current-system)
  172. ("x86_64-linux"
  173. (base32
  174. "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
  175. ("i686-linux"
  176. (base32
  177. "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
  178. (_
  179. (base32
  180. "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
  181. ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
  182. (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
  183. (home-page "https://www.gnu.org/software/mit-scheme/")
  184. (synopsis "A Scheme implementation with integrated editor and debugger")
  185. (description
  186. "GNU/MIT Scheme is an implementation of the Scheme programming
  187. language. It provides an interpreter, a compiler and a debugger. It also
  188. features an integrated Emacs-like editor and a large runtime library.")
  189. (license gpl2+)
  190. (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
  191. (define-public bigloo
  192. (package
  193. (name "bigloo")
  194. (version "4.3a")
  195. (source (origin
  196. (method url-fetch)
  197. (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
  198. version ".tar.gz"))
  199. (sha256
  200. (base32
  201. "03rcqs6kvy2j5lqk4fidqay5qfyp474qqspbh6wk4qdbds6w599w"))
  202. ;; Remove bundled libraries.
  203. (modules '((guix build utils)))
  204. (snippet
  205. '(for-each delete-file-recursively
  206. '("gc" "gmp" "libuv")))))
  207. (build-system gnu-build-system)
  208. (arguments
  209. `(#:test-target "test"
  210. #:phases
  211. (modify-phases %standard-phases
  212. (replace 'configure
  213. (lambda* (#:key inputs outputs #:allow-other-keys)
  214. (substitute* "configure"
  215. (("^shell=.*$")
  216. (string-append "shell=" (which "bash") "\n"))
  217. (("`date`") "0"))
  218. (substitute* "autoconf/runtest.in"
  219. ((", @DATE@") ""))
  220. (substitute* "autoconf/osversion"
  221. (("^version.*$") "version=\"\"\n"))
  222. ;; The `configure' script doesn't understand options
  223. ;; of those of Autoconf.
  224. (let ((out (assoc-ref outputs "out")))
  225. (zero?
  226. (system* "./configure"
  227. (string-append "--prefix=" out)
  228. ; use system libraries
  229. "--customgc=no"
  230. "--customunistring=no"
  231. "--customlibuv=no"
  232. (string-append"--mv=" (which "mv"))
  233. (string-append "--rm=" (which "rm"))
  234. "--cflags=-fPIC"
  235. (string-append "--ldflags=-Wl,-rpath="
  236. (assoc-ref outputs "out")
  237. "/lib/bigloo/" ,version)
  238. (string-append "--lispdir=" out
  239. "/share/emacs/site-lisp")
  240. "--sharedbde=yes"
  241. "--sharedcompiler=yes")))))
  242. (add-after 'install 'install-emacs-modes
  243. (lambda* (#:key outputs #:allow-other-keys)
  244. (let* ((out (assoc-ref outputs "out"))
  245. (dir (string-append out "/share/emacs/site-lisp")))
  246. (zero? (system* "make" "-C" "bmacs" "all" "install"
  247. (string-append "EMACSBRAND=emacs25")
  248. (string-append "EMACSDIR=" dir)))))))))
  249. (inputs
  250. `(("emacs" ,emacs) ;UDE needs the X version of Emacs
  251. ("libgc" ,libgc)
  252. ("libunistring" ,libunistring)
  253. ("libuv" ,libuv)
  254. ("openssl" ,openssl)
  255. ("sqlite" ,sqlite)
  256. ;; Optional APIs for which Bigloo has bindings.
  257. ("avahi" ,avahi)
  258. ("libphidget" ,libphidget)
  259. ("pcre" ,pcre)))
  260. (native-inputs
  261. `(("pkg-config" ,pkg-config)))
  262. (propagated-inputs
  263. `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
  264. (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
  265. (synopsis "Efficient Scheme compiler")
  266. (description
  267. "Bigloo is a Scheme implementation devoted to one goal: enabling
  268. Scheme based programming style where C(++) is usually
  269. required. Bigloo attempts to make Scheme practical by offering
  270. features usually presented by traditional programming languages
  271. but not offered by Scheme and functional programming. Bigloo
  272. compiles Scheme modules. It delivers small and fast stand alone
  273. binary executables. Bigloo enables full connections between
  274. Scheme and C programs and between Scheme and Java programs.")
  275. (license gpl2+)))
  276. (define-public hop
  277. (package
  278. (name "hop")
  279. (version "3.1.0-pre2")
  280. (source (origin
  281. (method url-fetch)
  282. (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
  283. version ".tar.gz"))
  284. (sha256
  285. (base32
  286. "09m7pahjsp7wxzd20cdph9j3mgf2nq5dyckcjljcd40m25v85kks"))))
  287. (build-system gnu-build-system)
  288. (arguments
  289. `(#:test-target "test"
  290. #:make-flags '("BIGLOO=bigloo")
  291. #:parallel-build? #f
  292. #:phases
  293. (modify-phases %standard-phases
  294. (replace 'configure
  295. (lambda* (#:key inputs outputs #:allow-other-keys)
  296. (let ((out (assoc-ref outputs "out")))
  297. (zero?
  298. (system* "./configure"
  299. (string-append "--prefix=" out)
  300. (string-append "--blflags="
  301. ;; user flags completely override useful
  302. ;; default flags, so repeat them here.
  303. "-copt \\$(CPICFLAGS) "
  304. "-L \\$(BUILDLIBDIR) "
  305. "-ldopt -Wl,-rpath," out "/lib")))))))))
  306. (inputs `(("avahi" ,avahi)
  307. ("bigloo" ,bigloo)
  308. ("libgc" ,libgc)
  309. ("libunistring" ,libunistring)
  310. ("libuv" ,libuv)
  311. ("pcre" ,pcre)
  312. ("sqlite" ,sqlite)
  313. ("which" ,which)))
  314. (home-page "http://hop.inria.fr/")
  315. (synopsis "Multi-tier programming language for the Web 2.0")
  316. (description
  317. "HOP is a multi-tier programming language for the Web 2.0 and the
  318. so-called diffuse Web. It is designed for programming interactive web
  319. applications in many fields such as multimedia (web galleries, music players,
  320. ...), ubiquitous and house automation (SmartPhones, personal appliance),
  321. mashups, office (web agendas, mail clients, ...), etc.")
  322. (license gpl2+)))
  323. (define-public chicken
  324. (package
  325. (name "chicken")
  326. (version "4.12.0")
  327. (source (origin
  328. (method url-fetch)
  329. (uri (string-append "https://code.call-cc.org/releases/"
  330. version "/chicken-" version ".tar.gz"))
  331. (sha256
  332. (base32
  333. "12b9gaa9lqh39lj1v4wm48f6z8ww3jdkvc5bh9gqqvn6kd2wwnk0"))
  334. (patches
  335. (search-patches "chicken-CVE-2017-6949.patch"
  336. "chicken-CVE-2017-11343.patch"))))
  337. (build-system gnu-build-system)
  338. (arguments
  339. `(#:modules ((guix build gnu-build-system)
  340. (guix build utils)
  341. (srfi srfi-1))
  342. ;; No `configure' script; run "make check" after "make install" as
  343. ;; prescribed by README.
  344. #:phases
  345. (modify-phases %standard-phases
  346. (delete 'configure)
  347. (delete 'check)
  348. (add-after 'install 'check
  349. (assoc-ref %standard-phases 'check)))
  350. #:make-flags (let ((out (assoc-ref %outputs "out")))
  351. (list "PLATFORM=linux"
  352. (string-append "PREFIX=" out)
  353. (string-append "VARDIR=" out "/var/lib")))
  354. ;; Parallel builds are not supported, as noted in README.
  355. #:parallel-build? #f))
  356. (home-page "http://www.call-cc.org/")
  357. (synopsis "R5RS Scheme implementation that compiles native code via C")
  358. (description
  359. "CHICKEN is a compiler for the Scheme programming language. CHICKEN
  360. produces portable and efficient C, supports almost all of the R5RS Scheme
  361. language standard, and includes many enhancements and extensions.")
  362. (license bsd-3)))
  363. (define-public scheme48
  364. (package
  365. (name "scheme48")
  366. (version "1.9.2")
  367. (source (origin
  368. (method url-fetch)
  369. (uri (string-append "http://s48.org/" version
  370. "/scheme48-" version ".tgz"))
  371. (sha256
  372. (base32
  373. "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
  374. (patches (search-patches "scheme48-tests.patch"))))
  375. (build-system gnu-build-system)
  376. (home-page "http://s48.org/")
  377. (synopsis "Scheme implementation using a bytecode interpreter")
  378. (description
  379. "Scheme 48 is an implementation of Scheme based on a byte-code
  380. interpreter and is designed to be used as a testbed for experiments in
  381. implementation techniques and as an expository tool.")
  382. ;; Most files are BSD-3; see COPYING for the few exceptions.
  383. (license bsd-3)))
  384. (define-public racket
  385. (package
  386. (name "racket")
  387. (version "6.8")
  388. (source (origin
  389. (method url-fetch)
  390. (uri (list (string-append "http://mirror.racket-lang.org/installers/"
  391. version "/racket-" version "-src.tgz")
  392. (string-append
  393. "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
  394. version "/racket/racket-" version "-src-unix.tgz")))
  395. (sha256
  396. (base32
  397. "1l9z1a0r5zydr50cklx9xjw3l0pwnf64i10xq7112fl1r89q3qgv"))))
  398. (build-system gnu-build-system)
  399. (arguments
  400. '(#:phases
  401. (alist-cons-before
  402. 'configure 'pre-configure
  403. (lambda* (#:key inputs #:allow-other-keys)
  404. ;; Patch dynamically loaded libraries with their absolute paths.
  405. (let* ((library-path (search-path-as-string->list
  406. (getenv "LIBRARY_PATH")))
  407. (find-so (lambda (soname)
  408. (search-path
  409. library-path
  410. (format #f "~a.so" soname))))
  411. (patch-ffi-libs (lambda (file libs)
  412. (for-each
  413. (lambda (lib)
  414. (substitute* file
  415. (((format #f "\"~a\"" lib))
  416. (format #f "\"~a\"" (find-so lib)))))
  417. libs))))
  418. (substitute* "collects/db/private/sqlite3/ffi.rkt"
  419. (("ffi-lib sqlite-so")
  420. (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
  421. (substitute* "collects/openssl/libssl.rkt"
  422. (("ffi-lib libssl-so")
  423. (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
  424. (substitute* "collects/openssl/libcrypto.rkt"
  425. (("ffi-lib libcrypto-so")
  426. (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
  427. (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
  428. (("ffi-lib libgmp-so")
  429. (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
  430. (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
  431. (("ffi-lib libmpfr-so")
  432. (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
  433. (for-each
  434. (lambda (x) (apply patch-ffi-libs x))
  435. '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
  436. ("libfontconfig" "libcairo"))
  437. ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
  438. ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
  439. ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
  440. ("libjpeg"))
  441. ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
  442. ("libpango-1.0" "libpangocairo-1.0"))
  443. ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
  444. ("libpng"))
  445. ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
  446. ("libodbc"))
  447. ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
  448. ("libX11"))
  449. ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
  450. ("libgio-2.0"))
  451. ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
  452. ("libgdk-3" "libgtk-3"))
  453. ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
  454. ("libunique-1.0"))
  455. ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
  456. ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
  457. ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
  458. ("libGL"))
  459. ("share/pkgs/sgl/gl.rkt"
  460. ("libGL" "libGLU")))))
  461. (chdir "src"))
  462. (alist-cons-after
  463. 'unpack 'patch-/bin/sh
  464. (lambda _
  465. (substitute* "collects/racket/system.rkt"
  466. (("/bin/sh") (which "sh"))))
  467. %standard-phases))
  468. #:tests? #f ; XXX: how to run them?
  469. ))
  470. (inputs
  471. `(("libffi" ,libffi)
  472. ;; Hardcode dynamically loaded libraries for better functionality.
  473. ;; sqlite and libraries for `racket/draw' are needed to build the doc.
  474. ("cairo" ,cairo)
  475. ("fontconfig" ,fontconfig)
  476. ("glib" ,glib)
  477. ("glu" ,glu)
  478. ("gmp" ,gmp)
  479. ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
  480. ("libjpeg" ,libjpeg)
  481. ("libpng" ,libpng)
  482. ("libx11" ,libx11)
  483. ("mesa" ,mesa)
  484. ("mpfr" ,mpfr)
  485. ("openssl" ,openssl)
  486. ("pango" ,pango)
  487. ("sqlite" ,sqlite)
  488. ("unixodbc" ,unixodbc)))
  489. (home-page "http://racket-lang.org")
  490. (synopsis "Implementation of Scheme and related languages")
  491. (description
  492. "Racket is an implementation of the Scheme programming language (R5RS and
  493. R6RS) and related languages, such as Typed Racket. It features a compiler and
  494. a virtual machine with just-in-time native compilation, as well as a large set
  495. of libraries.")
  496. (license lgpl2.0+)))
  497. (define-public gambit-c
  498. (package
  499. (name "gambit-c")
  500. (version "4.8.5")
  501. (source
  502. (origin
  503. (method url-fetch)
  504. (uri (string-append
  505. "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
  506. (version-major+minor version) "/source/gambit-v"
  507. (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
  508. ".tgz"))
  509. (sha256
  510. (base32 "0xwmqzqvk83xyjz48vp36p5vj1415rl3pi3xq7y8i3p8s409a98b"))))
  511. (build-system gnu-build-system)
  512. (arguments
  513. '(#:configure-flags
  514. ;; According to the ./configure script, this makes the build slower and
  515. ;; use >= 1 GB memory, but makes Gambit much faster.
  516. '("--enable-single-host")
  517. #:phases
  518. (modify-phases %standard-phases
  519. (add-before 'check 'fix-tests
  520. (lambda _
  521. (substitute* '("tests/makefile")
  522. ;; '-:' is how run-time options are set. 'tl' sets some terminal
  523. ;; option, which makes it fail in our build environment. It
  524. ;; recommends using 'd-' as a solution, which sets the REPL
  525. ;; interaction channel to stdin/stdout.
  526. (("gsi -:tl") "gsi -:d-,tl"))
  527. #t)))))
  528. (home-page "http://www.iro.umontreal.ca/~gambit/")
  529. (synopsis "Efficient Scheme interpreter and compiler")
  530. (description
  531. "Gambit consists of two main programs: gsi, the Gambit Scheme
  532. interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
  533. the complete execution and debugging environment. The compiler is the
  534. interpreter extended with the capability of generating executable files. The
  535. compiler can produce standalone executables or compiled modules which can be
  536. loaded at run time. Interpreted code and compiled code can be freely
  537. mixed.")
  538. ;; Dual license.
  539. (license (list lgpl2.1+ asl2.0))))
  540. (define-public chibi-scheme
  541. (package
  542. (name "chibi-scheme")
  543. (version "0.7.3")
  544. (source
  545. (origin
  546. (method url-fetch)
  547. (uri (string-append "https://github.com/ashinn/chibi-scheme/archive/"
  548. version ".tar.gz"))
  549. (sha256
  550. (base32 "16wppf4qzr0748iyp0m89gidsfgq9s6x3gw4xggym91waw4fh742"))
  551. (file-name (string-append "chibi-scheme-" version ".tar.gz"))))
  552. (build-system gnu-build-system)
  553. (arguments
  554. `(#:phases (modify-phases %standard-phases
  555. (delete 'configure)
  556. (add-before 'build 'set-cc
  557. (lambda _
  558. (setenv "CC" "gcc"))))
  559. #:make-flags (let ((out (assoc-ref %outputs "out")))
  560. (list (string-append "PREFIX=" out)
  561. (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
  562. #:test-target "test"))
  563. (home-page "https://github.com/ashinn/chibi-scheme")
  564. (synopsis "Small embeddable Scheme implementation")
  565. (description
  566. "Chibi-Scheme is a very small library with no external dependencies
  567. intended for use as an extension and scripting language in C programs. In
  568. addition to support for lightweight VM-based threads, each VM itself runs in
  569. an isolated heap allowing multiple VMs to run simultaneously in different OS
  570. threads.")
  571. (license bsd-3)))
  572. (define-public scmutils
  573. (let ()
  574. (define (system-suffix)
  575. (cond
  576. ((string-prefix? "x86_64" (or (%current-target-system)
  577. (%current-system)))
  578. "x86-64")
  579. (else "i386")))
  580. (package
  581. (name "scmutils")
  582. (version "20140302")
  583. (source
  584. (origin
  585. (method url-fetch/tarbomb)
  586. (modules '((guix build utils)))
  587. (snippet
  588. ;; Remove binary code
  589. '(delete-file-recursively "scmutils/mit-scheme"))
  590. (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
  591. "/scmutils-tarballs/" name "-" version
  592. "-x86-64-gnu-linux.tar.gz"))
  593. (sha256
  594. (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
  595. (build-system gnu-build-system)
  596. (inputs
  597. `(("mit-scheme" ,mit-scheme)
  598. ("emacs" ,emacs-minimal)))
  599. (arguments
  600. `(#:tests? #f ;; no tests-suite
  601. #:modules ((guix build gnu-build-system)
  602. (guix build utils)
  603. (guix build emacs-utils))
  604. #:imported-modules (,@%gnu-build-system-modules
  605. (guix build emacs-utils))
  606. #:phases
  607. (modify-phases %standard-phases
  608. (replace 'configure
  609. ;; No standard build procedure is used. We set the correct
  610. ;; runtime path in the custom build system.
  611. (lambda* (#:key outputs #:allow-other-keys)
  612. (let ((out (assoc-ref outputs "out")))
  613. ;; Required to find .bci files at runtime.
  614. (with-directory-excursion "scmutils"
  615. (rename-file "src" "scmutils"))
  616. (substitute* "scmutils/scmutils/load.scm"
  617. (("/usr/local/scmutils/")
  618. (string-append out "/lib/mit-scheme-"
  619. ,(system-suffix) "/")))
  620. #t)))
  621. (replace 'build
  622. ;; Compile the code and build a band.
  623. (lambda* (#:key outputs #:allow-other-keys)
  624. (let* ((out (assoc-ref outputs "out"))
  625. (make-img (string-append
  626. "echo '(load \"load\") "
  627. "(disk-save \"edwin-mechanics.com\")'"
  628. "| mit-scheme")))
  629. (with-directory-excursion "scmutils/scmutils"
  630. (and (zero? (system "mit-scheme < compile.scm"))
  631. (zero? (system make-img)))))))
  632. (add-before 'install 'fix-directory-names
  633. ;; Correct directory names in the startup script.
  634. (lambda* (#:key inputs outputs #:allow-other-keys)
  635. (let* ((out (assoc-ref outputs "out"))
  636. (scm-root (assoc-ref inputs "mit-scheme")))
  637. (substitute* "bin/mechanics"
  638. (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
  639. (string-append
  640. "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
  641. "LIB=\"${ROOT}/lib/mit-scheme-"
  642. ,(system-suffix) ":"
  643. out "/lib/mit-scheme-" ,(system-suffix) "\""))
  644. (("EDWIN_INFO_DIRECTORY=.*\n") "")
  645. (("SCHEME=.*\n")
  646. (string-append "SCHEME=\"${ROOT}/bin/scheme "
  647. "--library ${LIB}\"\n"))
  648. (("export EDWIN_INFO_DIRECTORY") ""))
  649. #t)))
  650. (add-before 'install 'emacs-tags
  651. ;; Generate Emacs's tags for easy reference to source
  652. ;; code.
  653. (lambda* (#:key inputs outputs #:allow-other-keys)
  654. (with-directory-excursion "scmutils/scmutils"
  655. (zero? (apply system* "etags"
  656. (find-files "." "\\.scm"))))))
  657. (replace 'install
  658. ;; Copy files to the store.
  659. (lambda* (#:key outputs #:allow-other-keys)
  660. (define* (copy-files-to-directory files dir
  661. #:optional (delete? #f))
  662. (for-each (lambda (f)
  663. (copy-file f (string-append dir "/" f))
  664. (when delete? (delete-file f)))
  665. files))
  666. (let* ((out (assoc-ref outputs "out"))
  667. (bin (string-append out "/bin"))
  668. (doc (string-append out "/share/doc/"
  669. ,name "-" ,version))
  670. (lib (string-append out "/lib/mit-scheme-"
  671. ,(system-suffix)
  672. "/scmutils")))
  673. (for-each mkdir-p (list lib doc bin))
  674. (with-directory-excursion "scmutils/scmutils"
  675. (copy-files-to-directory '("COPYING" "LICENSE")
  676. doc #t)
  677. (for-each delete-file (find-files "." "\\.bin"))
  678. (copy-files-to-directory '("edwin-mechanics.com")
  679. (string-append lib "/..") #t)
  680. (copy-recursively "." lib))
  681. (with-directory-excursion "bin"
  682. (copy-files-to-directory (find-files ".") bin))
  683. (with-directory-excursion "scmutils/manual"
  684. (copy-files-to-directory (find-files ".") doc))
  685. #t)))
  686. (add-after 'install 'emacs-helpers
  687. ;; Add convenience Emacs commands to easily load the
  688. ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
  689. ;; and to easily load code tags.
  690. (lambda* (#:key inputs outputs #:allow-other-keys)
  691. (let* ((out (assoc-ref outputs "out"))
  692. (mit-root (assoc-ref inputs "mit-scheme"))
  693. (emacs-lisp-dir
  694. (string-append out "/share/emacs/site-lisp"
  695. "/guix.d/" ,name "-" ,version))
  696. (el-file (string-append emacs-lisp-dir
  697. "/scmutils.el"))
  698. (lib-relative-path
  699. (string-append "/lib/mit-scheme-"
  700. ,(system-suffix))))
  701. (mkdir-p emacs-lisp-dir)
  702. (call-with-output-file el-file
  703. (lambda (p)
  704. (format p
  705. ";;;###autoload
  706. (defun scmutils-load ()
  707. (interactive)
  708. (require 'xscheme)
  709. (let ((mit-root \"~a\")
  710. (scmutils \"~a\"))
  711. (run-scheme
  712. (concat mit-root \"/bin/scheme --library \"
  713. mit-root \"~a:\" scmutils \"~a\"
  714. \" --band edwin-mechanics.com\"
  715. \" --emacs\"))))
  716. ;;;###autoload
  717. (defun scmutils-load-tags ()
  718. (interactive)
  719. (let ((scmutils \"~a\"))
  720. (visit-tags-table (concat scmutils \"/TAGS\"))))
  721. "
  722. mit-root out
  723. lib-relative-path
  724. lib-relative-path
  725. (string-append out lib-relative-path
  726. "/scmutils"))))
  727. (emacs-generate-autoloads ,name emacs-lisp-dir)
  728. (emacs-byte-compile-directory emacs-lisp-dir)
  729. #t))))))
  730. (home-page
  731. "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
  732. (synopsis "Scmutils library for MIT Scheme")
  733. (description "The Scmutils system is an integrated library of
  734. procedures, embedded in the programming language Scheme, and intended to
  735. support teaching and research in mathematical physics and electrical
  736. engineering.")
  737. (license gpl2+))))
  738. (define-public sicp
  739. (let ((commit "5b52db566968d28a89fbbaf338d207f01cc81cac"))
  740. (package
  741. (name "sicp")
  742. (version (string-append "20160220-1." (string-take commit 7)))
  743. (source (origin
  744. (method git-fetch)
  745. (uri (git-reference
  746. (url "https://github.com/sarabander/sicp")
  747. (commit commit)))
  748. (sha256
  749. (base32
  750. "10h6h7szwlfbshwh18bnl2hvyddj5i7106l79s145l0sjjv15cxb"))
  751. (file-name (string-append name "-" version "-checkout"))))
  752. (build-system trivial-build-system)
  753. (native-inputs `(("gzip" ,gzip)
  754. ("source" ,source)
  755. ("texinfo" ,texinfo)))
  756. (arguments
  757. `(#:modules ((guix build utils)
  758. (srfi srfi-1)
  759. (srfi srfi-26))
  760. #:builder
  761. (begin
  762. (use-modules (guix build utils)
  763. (srfi srfi-1)
  764. (srfi srfi-26))
  765. (let ((gzip (assoc-ref %build-inputs "gzip"))
  766. (source (assoc-ref %build-inputs "source"))
  767. (texinfo (assoc-ref %build-inputs "texinfo"))
  768. (html-dir (string-append %output "/share/doc/" ,name "/html"))
  769. (info-dir (string-append %output "/share/info")))
  770. (copy-recursively (string-append source "/html") html-dir)
  771. (setenv "PATH" (string-append gzip "/bin"
  772. ":" texinfo "/bin"))
  773. (mkdir-p info-dir)
  774. (and (zero?
  775. (system* "makeinfo" "--output"
  776. (string-append info-dir "/sicp.info")
  777. (string-append source "/sicp-pocket.texi")))
  778. (every zero?
  779. (map (cut system* "gzip" "-9n" <>)
  780. (find-files info-dir))))))))
  781. (home-page "http://sarabander.github.io/sicp")
  782. (synopsis "Structure and Interpretation of Computer Programs")
  783. (description "Structure and Interpretation of Computer Programs (SICP) is
  784. a textbook aiming to teach the principles of computer programming.
  785. Using Scheme, a dialect of the Lisp programming language, the book explains
  786. core computer science concepts such as abstraction in programming,
  787. metalinguistic abstraction, recursion, interpreters, and modular programming.")
  788. (license cc-by-sa4.0))))
  789. (define-public scheme48-rx
  790. (let* ((commit "d3231ad13de2b44e3ee173b1c9d09ff165e8b6d5")
  791. (revision "1"))
  792. (package
  793. (name "scheme48-rx")
  794. (version (string-append "0.0.0-" revision "." (string-take commit 7)))
  795. (source
  796. (origin
  797. (method git-fetch)
  798. (uri (git-reference
  799. (url "https://github.com/scheme/rx")
  800. (commit commit)))
  801. (sha256
  802. (base32
  803. "1nmziaibgmfi346kzidj6xyad0vm7724qymbzgxvdzyrqji6v6yz"))
  804. (file-name (string-append name "-" version "-checkout"))))
  805. (build-system trivial-build-system)
  806. (arguments
  807. `(#:modules ((guix build utils))
  808. #:builder
  809. (begin
  810. (use-modules (guix build utils))
  811. (let ((share (string-append %output
  812. "/share/scheme48-"
  813. ,(package-version scheme48)
  814. "/rx")))
  815. (chdir (assoc-ref %build-inputs "source"))
  816. (mkdir-p share)
  817. (copy-recursively "." share)))))
  818. (native-inputs
  819. `(("source" ,source)
  820. ("scheme48" ,scheme48)))
  821. (home-page "https://github.com/scheme/rx/")
  822. (synopsis "SRE String pattern-matching library for scheme48")
  823. (description
  824. "String pattern-matching library for scheme48 based on the SRE
  825. regular-expression notation.")
  826. (license bsd-3))))
  827. (define-public slib
  828. (package
  829. (name "slib")
  830. (version "3b5")
  831. (source (origin
  832. (method url-fetch)
  833. (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
  834. version ".zip"))
  835. (sha256
  836. (base32
  837. "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
  838. (build-system gnu-build-system)
  839. (arguments
  840. `(#:tests? #f ; There is no check target.
  841. #:phases
  842. (modify-phases %standard-phases
  843. (add-after 'install 'remove-bin-share
  844. (lambda* (#:key inputs outputs #:allow-other-keys)
  845. (delete-file-recursively
  846. (string-append (assoc-ref outputs "out") "/bin"))))
  847. (replace 'configure
  848. (lambda* (#:key inputs outputs #:allow-other-keys)
  849. (zero? (system* "./configure"
  850. (string-append "--prefix="
  851. (assoc-ref outputs "out")))))))))
  852. (native-inputs `(("unzip" ,unzip)
  853. ("texinfo" ,texinfo)))
  854. (home-page "http://people.csail.mit.edu/jaffer/SLIB/")
  855. (synopsis "Compatibility and utility library for Scheme")
  856. (description "SLIB is a portable Scheme library providing compatibility and
  857. utility functions for all standard Scheme implementations.")
  858. (license (non-copyleft
  859. "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
  860. "Or see COPYING in the distribution."))))
  861. (define-public scm
  862. (package
  863. (name "scm")
  864. (version "5f2")
  865. (source (origin
  866. (method url-fetch)
  867. (uri (string-append
  868. "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
  869. version ".zip"))
  870. (sha256
  871. (base32
  872. "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
  873. (build-system gnu-build-system)
  874. (arguments
  875. `(#:phases
  876. (modify-phases %standard-phases
  877. (replace 'configure
  878. (lambda* (#:key inputs outputs #:allow-other-keys)
  879. (zero? (system* "./configure"
  880. (string-append "--prefix="
  881. (assoc-ref outputs "out"))))))
  882. (add-before 'build 'pre-build
  883. (lambda* (#:key inputs #:allow-other-keys)
  884. (substitute* "Makefile"
  885. (("ginstall-info") "install-info"))))
  886. (replace 'build
  887. (lambda* (#:key inputs outputs #:allow-other-keys)
  888. (setenv "SCHEME_LIBRARY_PATH"
  889. (string-append (assoc-ref inputs "slib")
  890. "/lib/slib/"))
  891. (and
  892. (zero? (system* "make" "scmlit" "CC=gcc"))
  893. (zero? (system* "make" "all")))))
  894. (add-after 'install 'post-install
  895. (lambda* (#:key inputs outputs #:allow-other-keys)
  896. (let ((req
  897. (string-append (assoc-ref outputs "out")
  898. "/lib/scm/require.scm")))
  899. (and
  900. (delete-file req)
  901. (format (open req (logior O_WRONLY O_CREAT))
  902. "(define (library-vicinity) ~s)\n"
  903. (string-append (assoc-ref inputs "slib")
  904. "/lib/slib/"))
  905. ;; We must generate the slibcat file
  906. (zero? (system*
  907. (string-append
  908. (assoc-ref outputs "out")
  909. "/bin/scm")
  910. "-br" "new-catalog")))))))))
  911. (inputs `(("slib" ,slib)))
  912. (native-inputs `(("unzip" ,unzip)
  913. ("texinfo" ,texinfo)))
  914. (home-page "http://people.csail.mit.edu/jaffer/SCM")
  915. (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
  916. (description "GNU SCM is an implementation of Scheme. This
  917. implementation includes Hobbit, a Scheme-to-C compiler, which can
  918. generate C files whose binaries can be dynamically or statically
  919. linked with a SCM executable.")
  920. (license lgpl3+)))