scheme.scm 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2020, 2021 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, 2020 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
  8. ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
  9. ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
  10. ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
  11. ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  12. ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
  13. ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
  14. ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
  15. ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
  16. ;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
  17. ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
  18. ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
  19. ;;;
  20. ;;; This file is part of GNU Guix.
  21. ;;;
  22. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  23. ;;; under the terms of the GNU General Public License as published by
  24. ;;; the Free Software Foundation; either version 3 of the License, or (at
  25. ;;; your option) any later version.
  26. ;;;
  27. ;;; GNU Guix is distributed in the hope that it will be useful, but
  28. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  29. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. ;;; GNU General Public License for more details.
  31. ;;;
  32. ;;; You should have received a copy of the GNU General Public License
  33. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  34. (define-module (gnu packages scheme)
  35. #:use-module (gnu packages)
  36. #:use-module ((guix licenses)
  37. #:select (gpl2+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ asl2.0 bsd-3
  38. cc-by-sa4.0 non-copyleft expat))
  39. #:use-module (guix packages)
  40. #:use-module (guix download)
  41. #:use-module (guix git-download)
  42. #:use-module (guix utils)
  43. #:use-module (guix build-system gnu)
  44. #:use-module (guix build-system trivial)
  45. #:use-module (gnu packages autotools)
  46. #:use-module (gnu packages bdw-gc)
  47. #:use-module (gnu packages bash)
  48. #:use-module (gnu packages compression)
  49. #:use-module (gnu packages databases)
  50. #:use-module (gnu packages libevent)
  51. #:use-module (gnu packages libunistring)
  52. #:use-module (gnu packages m4)
  53. #:use-module (gnu packages multiprecision)
  54. #:use-module (gnu packages ncurses)
  55. #:use-module (gnu packages pcre)
  56. #:use-module (gnu packages emacs)
  57. #:use-module (gnu packages ghostscript)
  58. #:use-module (gnu packages netpbm)
  59. #:use-module (gnu packages texinfo)
  60. #:use-module (gnu packages tex)
  61. #:use-module (gnu packages base)
  62. #:use-module (gnu packages compression)
  63. #:use-module (gnu packages pkg-config)
  64. #:use-module (gnu packages avahi)
  65. #:use-module (gnu packages libphidget)
  66. #:use-module (gnu packages gcc)
  67. #:use-module (gnu packages glib)
  68. #:use-module (gnu packages gtk)
  69. #:use-module (gnu packages libffi)
  70. #:use-module (gnu packages fontutils)
  71. #:use-module (gnu packages image)
  72. #:use-module (gnu packages xorg)
  73. #:use-module (gnu packages sqlite)
  74. #:use-module (gnu packages tls)
  75. #:use-module (gnu packages gl)
  76. #:use-module (gnu packages libedit)
  77. #:use-module (gnu packages linux)
  78. #:use-module (srfi srfi-1)
  79. #:use-module (ice-9 match))
  80. (define (mit-scheme-source-directory system version)
  81. (string-append "mit-scheme-"
  82. (if (or (string-prefix? "x86_64" system)
  83. (string-prefix? "i686" system))
  84. ""
  85. "c-")
  86. version))
  87. (define-public mit-scheme
  88. (package
  89. (name "mit-scheme")
  90. (version "11.2")
  91. (source #f) ; see below
  92. (outputs '("out" "doc"))
  93. (build-system gnu-build-system)
  94. (arguments
  95. `(#:modules ((guix build gnu-build-system)
  96. (guix build utils)
  97. (srfi srfi-1))
  98. #:phases
  99. (modify-phases %standard-phases
  100. (replace 'unpack
  101. (lambda* (#:key inputs #:allow-other-keys)
  102. (invoke "tar" "xzvf"
  103. (assoc-ref inputs "source"))
  104. (chdir ,(mit-scheme-source-directory (%current-system)
  105. version))
  106. ;; Delete these dangling symlinks since they break
  107. ;; `patch-shebangs'.
  108. (for-each delete-file
  109. (find-files "src/compiler" "^make\\."))
  110. (chdir "src")
  111. #t))
  112. (add-after 'unpack 'patch-/bin/sh
  113. (lambda _
  114. (setenv "CONFIG_SHELL" (which "sh"))
  115. (substitute* '("../tests/ffi/autogen.sh"
  116. "../tests/ffi/autobuild.sh"
  117. "../tests/ffi/test-ffi.sh"
  118. "../tests/runtime/test-process.scm"
  119. "runtime/unxprm.scm")
  120. (("/bin/sh") (which "sh"))
  121. (("\\./autogen\\.sh")
  122. (string-append (which "sh") " autogen.sh"))
  123. (("\\./configure")
  124. (string-append (which "sh") " configure")))
  125. #t))
  126. (replace 'build
  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)))
  134. #t)))
  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))
  144. #t))))
  145. (add-after 'build 'build-doc
  146. (lambda* _
  147. (with-directory-excursion "../doc"
  148. (invoke "make"))
  149. #t))
  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)
  163. (copy-recursively
  164. (string-append old-doc-dir "/" ,name)
  165. new-doc/mit-scheme-dir)
  166. (delete-file-recursively old-doc-dir)
  167. #t))))))
  168. (native-inputs
  169. `(;; Autoconf, Automake, and Libtool are necessary for the FFI tests.
  170. ("autoconf" ,autoconf)
  171. ("automake" ,automake)
  172. ("libtool" ,libtool)
  173. ("texlive" ,(texlive-updmap.cfg (list texlive-tex-texinfo
  174. texlive-epsf)))
  175. ("texinfo" ,texinfo)
  176. ("ghostscript" ,ghostscript)
  177. ("m4" ,m4)))
  178. (inputs
  179. `(("libx11" ,libx11)
  180. ("ncurses" ,ncurses)
  181. ("source"
  182. ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
  183. ;; compile from the architecture-specific tarballs, which contain
  184. ;; pre-built binaries. It leads to more efficient code than when
  185. ;; building the tarball that contains generated C code instead of
  186. ;; those binaries.
  187. ,(origin
  188. (method url-fetch)
  189. (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
  190. version "/mit-scheme-"
  191. (match (%current-system)
  192. ("x86_64-linux"
  193. (string-append version "-x86-64"))
  194. ("aarch64-linux"
  195. (string-append version "-aarch64le"))
  196. (_
  197. (string-append "c-" version)))
  198. ".tar.gz"))
  199. (sha256
  200. (match (%current-system)
  201. ("x86_64-linux"
  202. (base32
  203. "17822hs9y07vcviv2af17p3va7qh79dird49nj50bwi9rz64ia3w"))
  204. ("aarch64-linux"
  205. (base32
  206. "11maixldk20wqb5js5p4imq221zz9nf27649v9pqkdf8fv7rnrs9"))
  207. (_
  208. (base32
  209. "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))))))))
  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"))
  214. (home-page "https://www.gnu.org/software/mit-scheme/")
  215. (synopsis "A Scheme implementation with integrated editor and debugger")
  216. (description
  217. "GNU/MIT Scheme is an implementation of the Scheme programming
  218. language. It provides an interpreter, a compiler and a debugger. It also
  219. features an integrated Emacs-like editor and a large runtime library.")
  220. (license gpl2+)
  221. (properties '((ftp-directory . "/gnu/mit-scheme/stable.pkg")))))
  222. (define-public bigloo
  223. ;; Upstream modifies source tarballs in place, making significant changes
  224. ;; long after the initial publication: <https://bugs.gnu.org/33525>.
  225. (let ((upstream-version "4.3g"))
  226. (package
  227. (name "bigloo")
  228. (version "4.3g")
  229. (source (origin
  230. (method url-fetch)
  231. (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
  232. upstream-version ".tar.gz"))
  233. (sha256
  234. (base32
  235. "07305c134v7s1nz44igwsyqpb9qqia5zyng1q2qj60sskw3nbd67"))
  236. ;; Remove bundled libraries.
  237. (modules '((guix build utils)))
  238. (snippet
  239. '(begin
  240. (for-each delete-file-recursively
  241. '("gc" "gmp" "libuv" "libunistring" "pcre"))
  242. #t))))
  243. (build-system gnu-build-system)
  244. (arguments
  245. `(#:test-target "test"
  246. #:phases
  247. (modify-phases %standard-phases
  248. (add-after 'unpack 'fix-gmp-detection
  249. (lambda _
  250. (substitute* "configure"
  251. (("gmpversion=`\\$autoconf gmp --lib=\\$gmplib`")
  252. "gmpversion=`\\$autoconf gmp --lib=\"\\$gmplib\"`"))))
  253. (replace 'configure
  254. (lambda* (#:key inputs outputs #:allow-other-keys)
  255. (substitute* "configure"
  256. (("^shell=.*$")
  257. (string-append "shell=" (which "bash") "\n"))
  258. (("`date`") "0"))
  259. (substitute* "autoconf/runtest.in"
  260. ((", @DATE@") ""))
  261. (substitute* "autoconf/osversion"
  262. (("^version.*$") "version=\"\"\n"))
  263. (substitute* "comptime/Makefile"
  264. (("\\$\\(LDCOMPLIBS\\)")
  265. "$(LDCOMPLIBS) $(LDFLAGS)"))
  266. ;; The `configure' script doesn't understand options
  267. ;; of those of Autoconf.
  268. (let ((out (assoc-ref outputs "out")))
  269. (invoke "./configure"
  270. (string-append "--prefix=" out)
  271. ; use system libraries
  272. "--customgc=no"
  273. "--enable-gmp"
  274. "--customgmp=no"
  275. "--customunistring=no"
  276. "--customlibuv=no"
  277. (string-append"--mv=" (which "mv"))
  278. (string-append "--rm=" (which "rm"))
  279. "--cflags=-fPIC"
  280. (string-append "--ldflags=-Wl,-rpath="
  281. (assoc-ref outputs "out")
  282. "/lib/bigloo/" ,upstream-version)
  283. (string-append "--lispdir=" out
  284. "/share/emacs/site-lisp")
  285. "--sharedbde=yes"
  286. "--sharedcompiler=yes"
  287. "--disable-patch"))))
  288. (add-after 'install 'install-emacs-modes
  289. (lambda* (#:key outputs #:allow-other-keys)
  290. (let* ((out (assoc-ref outputs "out"))
  291. (dir (string-append out "/share/emacs/site-lisp")))
  292. (invoke "make" "-C" "bmacs" "all" "install"
  293. (string-append "EMACSBRAND=emacs25")
  294. (string-append "EMACSDIR=" dir))))))))
  295. (inputs
  296. `(("emacs" ,emacs) ;UDE needs the X version of Emacs
  297. ("libgc" ,libgc)
  298. ("libunistring" ,libunistring)
  299. ("libuv" ,libuv)
  300. ("openssl" ,openssl)
  301. ("sqlite" ,sqlite)
  302. ;; Optional APIs for which Bigloo has bindings.
  303. ("avahi" ,avahi)
  304. ("libphidget" ,libphidget)
  305. ("pcre" ,pcre)))
  306. (native-inputs
  307. `(("pkg-config" ,pkg-config)))
  308. (propagated-inputs
  309. `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
  310. (home-page "https://www-sop.inria.fr/indes/fp/Bigloo/")
  311. (synopsis "Efficient Scheme compiler")
  312. (description
  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.")
  320. (license gpl2+))))
  321. (define-public hop
  322. (package
  323. (name "hop")
  324. (version "3.2.0-pre1")
  325. (source (origin
  326. (method url-fetch)
  327. (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
  328. version ".tar.gz"))
  329. (sha256
  330. (base32
  331. "0jf418d0s9imv98s6qrpjxr1mdaxr37knh5qyfl5y4a9cc41mlg5"))))
  332. (build-system gnu-build-system)
  333. (arguments
  334. `(#:test-target "test"
  335. #:make-flags '("BIGLOO=bigloo")
  336. #:parallel-build? #f
  337. #:phases
  338. (modify-phases %standard-phases
  339. (replace 'configure
  340. (lambda* (#:key inputs outputs #:allow-other-keys)
  341. (let ((out (assoc-ref outputs "out")))
  342. (substitute* '("tools/Makefile"
  343. "test/hopjs/TEST.in")
  344. (("/bin/rm") (which "rm")))
  345. (invoke "./configure"
  346. (string-append "--prefix=" out)
  347. "--hostcc=gcc"
  348. (string-append "--blflags="
  349. ;; user flags completely override useful
  350. ;; default flags, so repeat them here.
  351. "-copt \\$(CPICFLAGS) "
  352. "-L \\$(BUILDLIBDIR) "
  353. "-ldopt -Wl,-rpath," out "/lib"))))))))
  354. (inputs `(("avahi" ,avahi)
  355. ("bigloo" ,bigloo)
  356. ("libgc" ,libgc)
  357. ("libunistring" ,libunistring)
  358. ("libuv" ,libuv)
  359. ("pcre" ,pcre)
  360. ("sqlite" ,sqlite)
  361. ("which" ,which)))
  362. (home-page "http://hop.inria.fr/")
  363. (synopsis "Multi-tier programming language for the Web 2.0")
  364. (description
  365. "HOP is a multi-tier programming language for the Web 2.0 and the
  366. so-called diffuse Web. It is designed for programming interactive web
  367. applications in many fields such as multimedia (web galleries, music players,
  368. ...), ubiquitous and house automation (SmartPhones, personal appliance),
  369. mashups, office (web agendas, mail clients, ...), etc.")
  370. (license gpl2+)))
  371. (define-public scheme48
  372. (package
  373. (name "scheme48")
  374. (version "1.9.2")
  375. (source (origin
  376. (method url-fetch)
  377. (uri (string-append "http://s48.org/" version
  378. "/scheme48-" version ".tgz"))
  379. (sha256
  380. (base32
  381. "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"))
  382. (patches (search-patches "scheme48-tests.patch"))))
  383. (build-system gnu-build-system)
  384. (home-page "http://s48.org/")
  385. (synopsis "Scheme implementation using a bytecode interpreter")
  386. (description
  387. "Scheme 48 is an implementation of Scheme based on a byte-code
  388. interpreter and is designed to be used as a testbed for experiments in
  389. implementation techniques and as an expository tool.")
  390. ;; Most files are BSD-3; see COPYING for the few exceptions.
  391. (license bsd-3)))
  392. (define-public gambit-c
  393. (package
  394. (name "gambit-c")
  395. (version "4.9.3")
  396. (source
  397. (origin
  398. (method url-fetch)
  399. (uri (string-append
  400. "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
  401. (version-major+minor version) "/source/gambit-v"
  402. (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
  403. ".tgz"))
  404. (sha256
  405. (base32 "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk"))))
  406. (build-system gnu-build-system)
  407. (arguments
  408. '(#:configure-flags
  409. ;; According to the ./configure script, this makes the build slower and
  410. ;; use >= 1 GB memory, but makes Gambit much faster.
  411. '("--enable-single-host")))
  412. (home-page "http://dynamo.iro.umontreal.ca/wiki/index.php/Main_Page")
  413. (synopsis "Efficient Scheme interpreter and compiler")
  414. (description
  415. "Gambit consists of two main programs: gsi, the Gambit Scheme
  416. interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
  417. the complete execution and debugging environment. The compiler is the
  418. interpreter extended with the capability of generating executable files. The
  419. compiler can produce standalone executables or compiled modules which can be
  420. loaded at run time. Interpreted code and compiled code can be freely
  421. mixed.")
  422. ;; Dual license.
  423. (license (list lgpl2.1+ asl2.0))))
  424. (define-public chibi-scheme
  425. (package
  426. (name "chibi-scheme")
  427. (version "0.9")
  428. (home-page "https://github.com/ashinn/chibi-scheme")
  429. (source
  430. (origin
  431. (method git-fetch)
  432. (uri (git-reference (url home-page) (commit version)))
  433. (file-name (git-file-name name version))
  434. (sha256
  435. (base32
  436. "1lnap41gl9vg82h557f4rlr69jgmd2gh0iqs6cxm77d39kv1scb8"))))
  437. (build-system gnu-build-system)
  438. (arguments
  439. `(#:phases (modify-phases %standard-phases
  440. (delete 'configure)
  441. (add-before 'build 'set-cc
  442. (lambda _
  443. (setenv "CC" "gcc"))))
  444. #:make-flags (let ((out (assoc-ref %outputs "out")))
  445. (list (string-append "PREFIX=" out)
  446. (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
  447. #:test-target "test"))
  448. (synopsis "Small embeddable Scheme implementation")
  449. (description
  450. "Chibi-Scheme is a very small library with no external dependencies
  451. intended for use as an extension and scripting language in C programs. In
  452. addition to support for lightweight VM-based threads, each VM itself runs in
  453. an isolated heap allowing multiple VMs to run simultaneously in different OS
  454. threads.")
  455. (license bsd-3)))
  456. (define-public sicp
  457. (let ((commit "225c172f9b859902a64a3c5dd5e1f9ac1a7382de"))
  458. (package
  459. (name "sicp")
  460. (version (string-append "20170703-1." (string-take commit 7)))
  461. (source (origin
  462. (method git-fetch)
  463. (uri (git-reference
  464. (url "https://github.com/sarabander/sicp")
  465. (commit commit)))
  466. (sha256
  467. (base32
  468. "0bhdrdc1mgdjdsg4jksq9z6x129f3346jbf3zir2a0dfmsj6m10n"))
  469. (file-name (string-append name "-" version "-checkout"))))
  470. (build-system trivial-build-system)
  471. (native-inputs `(("gzip" ,gzip)
  472. ("source" ,source)
  473. ("texinfo" ,texinfo)))
  474. (arguments
  475. `(#:modules ((guix build utils))
  476. #:builder
  477. (begin
  478. (use-modules (guix build utils)
  479. (srfi srfi-26))
  480. (let ((gzip (assoc-ref %build-inputs "gzip"))
  481. (source (assoc-ref %build-inputs "source"))
  482. (texinfo (assoc-ref %build-inputs "texinfo"))
  483. (html-dir (string-append %output "/share/doc/" ,name "/html"))
  484. (info-dir (string-append %output "/share/info")))
  485. (copy-recursively (string-append source "/html") html-dir)
  486. (setenv "PATH" (string-append gzip "/bin"
  487. ":" texinfo "/bin"))
  488. (mkdir-p info-dir)
  489. (invoke "makeinfo" "--output"
  490. (string-append info-dir "/sicp.info")
  491. (string-append source "/sicp-pocket.texi"))
  492. (for-each (cut invoke "gzip" "-9n" <>)
  493. (find-files info-dir))
  494. #t))))
  495. (home-page "https://sarabander.github.io/sicp")
  496. (synopsis "Structure and Interpretation of Computer Programs")
  497. (description "Structure and Interpretation of Computer Programs (SICP) is
  498. a textbook aiming to teach the principles of computer programming.
  499. Using Scheme, a dialect of the Lisp programming language, the book explains
  500. core computer science concepts such as abstraction in programming,
  501. metalinguistic abstraction, recursion, interpreters, and modular programming.")
  502. (license cc-by-sa4.0))))
  503. (define-public scheme48-rx
  504. (let* ((commit "dd9037f6f9ea01019390614f6b126b7dd293798d")
  505. (revision "2"))
  506. (package
  507. (name "scheme48-rx")
  508. (version (string-append "0.0.0-" revision "." (string-take commit 7)))
  509. (source
  510. (origin
  511. (method git-fetch)
  512. (uri (git-reference
  513. (url "https://github.com/scheme/rx")
  514. (commit commit)))
  515. (sha256
  516. (base32
  517. "1bvriavxw5kf2izjbil3999vr983vkk2xplfpinafr86m40b2cci"))
  518. (file-name (string-append name "-" version "-checkout"))))
  519. (build-system trivial-build-system)
  520. (arguments
  521. `(#:modules ((guix build utils))
  522. #:builder
  523. (begin
  524. (use-modules (guix build utils))
  525. (let ((share (string-append %output
  526. "/share/scheme48-"
  527. ,(package-version scheme48)
  528. "/rx")))
  529. (chdir (assoc-ref %build-inputs "source"))
  530. (mkdir-p share)
  531. (copy-recursively "." share)
  532. #t))))
  533. (native-inputs
  534. `(("source" ,source)
  535. ("scheme48" ,scheme48)))
  536. (home-page "https://github.com/scheme/rx/")
  537. (synopsis "SRE String pattern-matching library for scheme48")
  538. (description
  539. "String pattern-matching library for scheme48 based on the SRE
  540. regular-expression notation.")
  541. (license bsd-3))))
  542. (define-public slib
  543. (package
  544. (name "slib")
  545. (version "3b5")
  546. (source (origin
  547. (method url-fetch)
  548. (uri (string-append "http://groups.csail.mit.edu/mac/ftpdir/scm/slib-"
  549. version ".zip"))
  550. (sha256
  551. (base32
  552. "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq"))))
  553. (build-system gnu-build-system)
  554. (arguments
  555. `(#:tests? #f ; There is no check target.
  556. #:phases
  557. (modify-phases %standard-phases
  558. (add-after 'install 'remove-bin-share
  559. (lambda* (#:key inputs outputs #:allow-other-keys)
  560. (delete-file-recursively
  561. (string-append (assoc-ref outputs "out") "/bin"))
  562. #t))
  563. (replace 'configure
  564. (lambda* (#:key inputs outputs #:allow-other-keys)
  565. (invoke "./configure"
  566. (string-append "--prefix="
  567. (assoc-ref outputs "out"))))))))
  568. (native-inputs `(("unzip" ,unzip)
  569. ("texinfo" ,texinfo)))
  570. (home-page "https://people.csail.mit.edu/jaffer/SLIB.html")
  571. (synopsis "Compatibility and utility library for Scheme")
  572. (description "SLIB is a portable Scheme library providing compatibility and
  573. utility functions for all standard Scheme implementations.")
  574. (license (non-copyleft
  575. "http://people.csail.mit.edu/jaffer/SLIB_COPYING.txt"
  576. "Or see COPYING in the distribution."))))
  577. (define-public scm
  578. (package
  579. (name "scm")
  580. (version "5f3")
  581. (source (origin
  582. (method url-fetch)
  583. (uri (string-append
  584. "http://groups.csail.mit.edu/mac/ftpdir/scm/scm-"
  585. version ".zip"))
  586. (sha256
  587. (base32
  588. "1jxxlhmgal26mpcl97kz37djkn97rfy9h5pvw0hah6f3f6w49j97"))))
  589. (build-system gnu-build-system)
  590. (arguments
  591. `(#:phases
  592. (modify-phases %standard-phases
  593. (replace 'configure
  594. (lambda* (#:key inputs outputs #:allow-other-keys)
  595. (invoke "./configure"
  596. (string-append "--prefix="
  597. (assoc-ref outputs "out")))))
  598. (add-before 'build 'pre-build
  599. (lambda* (#:key inputs #:allow-other-keys)
  600. (substitute* "Makefile"
  601. (("ginstall-info") "install-info"))
  602. #t))
  603. (replace 'build
  604. (lambda* (#:key inputs outputs #:allow-other-keys)
  605. (setenv "SCHEME_LIBRARY_PATH"
  606. (search-input-directory inputs "lib/slib"))
  607. (invoke "make" "scmlit" "CC=gcc")
  608. (invoke "make" "all")))
  609. (add-after 'install 'post-install
  610. (lambda* (#:key inputs outputs #:allow-other-keys)
  611. (let* ((out (assoc-ref outputs "out"))
  612. (req (string-append out "/lib/scm/require.scm")))
  613. (delete-file req)
  614. (format (open req (logior O_WRONLY O_CREAT))
  615. "(define (library-vicinity) ~s)\n"
  616. (search-input-directory inputs "lib/slib"))
  617. ;; We must generate the slibcat file.
  618. (invoke (string-append out "/bin/scm")
  619. "-br" "new-catalog")))))))
  620. (inputs `(("slib" ,slib)))
  621. (native-inputs `(("unzip" ,unzip)
  622. ("texinfo" ,texinfo)))
  623. (home-page "https://people.csail.mit.edu/jaffer/SCM")
  624. (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
  625. (description "GNU SCM is an implementation of Scheme. This
  626. implementation includes Hobbit, a Scheme-to-C compiler, which can
  627. generate C files whose binaries can be dynamically or statically
  628. linked with a SCM executable.")
  629. (license lgpl3+)))
  630. (define-public tinyscheme
  631. (package
  632. (name "tinyscheme")
  633. (version "1.42")
  634. (source (origin
  635. (method url-fetch)
  636. (uri (string-append "mirror://sourceforge/" name "/" name "/"
  637. name "-" version "/" name "-" version ".zip"))
  638. (sha256
  639. (base32
  640. "0rik3qnxqd8wjlazx8rw996pfzkjjg60v6hcbpcqzi7rgml8q4n8"))))
  641. (build-system gnu-build-system)
  642. (native-inputs
  643. `(("unzip" ,unzip)))
  644. (arguments
  645. `(#:phases
  646. (modify-phases %standard-phases
  647. (replace 'unpack
  648. (lambda* (#:key source #:allow-other-keys)
  649. (invoke "unzip" source)
  650. (chdir (string-append ,name "-" ,version))
  651. #t))
  652. (add-after 'unpack 'set-scm-directory
  653. ;; Hard-code ‘our’ init.scm instead of looking in the current
  654. ;; working directory, so invoking ‘scheme’ just works.
  655. (lambda* (#:key outputs #:allow-other-keys)
  656. (let* ((out (assoc-ref outputs "out"))
  657. (scm (string-append out "/share/" ,name)))
  658. (substitute* "scheme.c"
  659. (("init.scm" all)
  660. (string-append scm "/" all)))
  661. #t)))
  662. (delete 'configure) ; no configure script
  663. (replace 'install
  664. ;; There's no ‘install’ target. Install files manually.
  665. (lambda* (#:key outputs #:allow-other-keys)
  666. (let* ((out (assoc-ref outputs "out"))
  667. (bin (string-append out "/bin"))
  668. (doc (string-append out "/share/doc/"
  669. ,name "-" ,version))
  670. (include (string-append out "/include"))
  671. (lib (string-append out "/lib"))
  672. (scm (string-append out "/share/" ,name)))
  673. (install-file "scheme" bin)
  674. (install-file "Manual.txt" doc)
  675. (install-file "scheme.h" include)
  676. (install-file "libtinyscheme.so" lib)
  677. (install-file "init.scm" scm)
  678. #t))))
  679. #:tests? #f)) ; no tests
  680. (home-page "http://tinyscheme.sourceforge.net/")
  681. (synopsis "Light-weight interpreter for the Scheme programming language")
  682. (description
  683. "TinyScheme is a light-weight Scheme interpreter that implements as large a
  684. subset of R5RS as was possible without getting very large and complicated.
  685. It's meant to be used as an embedded scripting interpreter for other programs.
  686. As such, it does not offer an Integrated Development Environment (@dfn{IDE}) or
  687. extensive toolkits, although it does sport a small (and optional) top-level
  688. loop.
  689. As an embedded interpreter, it allows multiple interpreter states to coexist in
  690. the same program, without any interference between them. Foreign functions in C
  691. can be added and values can be defined in the Scheme environment. Being quite a
  692. small program, it is easy to comprehend, get to grips with, and use.")
  693. (license bsd-3))) ; there are no licence headers
  694. (define-public stalin
  695. (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
  696. ;; FIXME: The Stalin "source" contains C code generated by itself:
  697. ;; 'stalin-AMD64.c', etc.
  698. (package
  699. (name "stalin")
  700. (version "0.11")
  701. (source (origin
  702. ;; Use Pearlmutter's upstream branch with AMD64 patches
  703. ;; applied. Saves us from including those 20M! patches
  704. ;; in Guix. For more info, see:
  705. ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
  706. (method git-fetch)
  707. (uri (git-reference
  708. (url "https://github.com/barak/stalin")
  709. (commit commit)))
  710. (file-name (string-append name "-" version "-checkout"))
  711. (sha256
  712. (base32
  713. "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
  714. (modules '((guix build utils)))
  715. (snippet
  716. ;; remove gc libs from build, we have them as input
  717. '(begin
  718. (delete-file "gc6.8.tar.gz")
  719. (delete-file-recursively "benchmarks")
  720. (substitute* "build"
  721. ((".*gc6.8.*") "")
  722. ((" cd \\.\\.") "")
  723. ((".*B include/libgc.a") "")
  724. ((".*make.*") ""))
  725. #t))))
  726. (build-system gnu-build-system)
  727. (arguments
  728. `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
  729. #:phases
  730. (modify-phases %standard-phases
  731. (replace 'configure
  732. (lambda* (#:key outputs #:allow-other-keys)
  733. (let* ((out (assoc-ref outputs "out"))
  734. (include-out (string-append out "/include")))
  735. (invoke "./build")
  736. (for-each (lambda (fname)
  737. (install-file fname include-out))
  738. (find-files "include"))
  739. (substitute* "makefile"
  740. (("\\./include") include-out))
  741. (substitute* "post-make"
  742. (("`pwd`") out))
  743. #t)))
  744. (delete 'check)
  745. (replace 'install
  746. (lambda* (#:key outputs #:allow-other-keys)
  747. (let ((out (assoc-ref outputs "out")))
  748. (install-file "stalin.1"
  749. (string-append out "/share/man/man1"))
  750. (install-file "stalin"
  751. (string-append out "/bin"))
  752. #t))))))
  753. (inputs
  754. `(("libx11" ,libx11)))
  755. (propagated-inputs
  756. `(("libgc" ,libgc)))
  757. (supported-systems '("x86_64-linux"))
  758. (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
  759. (synopsis "Brutally efficient Scheme compiler")
  760. (description
  761. "Stalin is an aggressively optimizing whole-program compiler
  762. for Scheme that does polyvariant interprocedural flow analysis,
  763. flow-directed interprocedural escape analysis, flow-directed
  764. lightweight CPS conversion, flow-directed lightweight closure
  765. conversion, flow-directed interprocedural lifetime analysis, automatic
  766. in-lining, unboxing, and flow-directed program-specific and
  767. program-point-specific low-level representation selection and code
  768. generation.")
  769. (license gpl2+))))
  770. (define-public femtolisp
  771. (let ((commit "ec7601076a976f845bc05ad6bd3ed5b8cde58a97")
  772. (revision "2"))
  773. (package
  774. (name "femtolisp")
  775. (version (string-append "0.0.0-" revision "." (string-take commit 7)))
  776. (source (origin
  777. (method git-fetch)
  778. (uri (git-reference
  779. (url "https://github.com/JeffBezanson/femtolisp")
  780. (commit commit)))
  781. (file-name (string-append name "-" version "-checkout"))
  782. (sha256
  783. (base32
  784. "1fcyiqlqn27nd4wxi27km8mhmlzpzzsxzpwsl1bxbmhraq468njw"))))
  785. ;; See "utils.h" for supported systems. Upstream bug:
  786. ;; https://github.com/JeffBezanson/femtolisp/issues/25
  787. (supported-systems
  788. (fold delete %supported-systems
  789. '("armhf-linux" "mips64el-linux" "aarch64-linux")))
  790. (build-system gnu-build-system)
  791. (arguments
  792. `(#:make-flags '("CC=gcc" "release")
  793. #:test-target "test"
  794. #:phases
  795. (modify-phases %standard-phases
  796. (delete 'bootstrap)
  797. (delete 'configure) ; No configure script
  798. (replace 'install ; Makefile has no 'install phase
  799. (lambda* (#:key outputs #:allow-other-keys)
  800. (let* ((out (assoc-ref outputs "out"))
  801. (bin (string-append out "/bin")))
  802. (install-file "flisp" bin)
  803. #t)))
  804. ;; The flisp binary is now available, run bootstrap to
  805. ;; generate flisp.boot and afterwards runs make test.
  806. (add-after 'install 'bootstrap-gen-and-test
  807. (lambda* (#:key outputs #:allow-other-keys)
  808. (let* ((out (assoc-ref outputs "out"))
  809. (bin (string-append out "/bin")))
  810. (invoke "./bootstrap.sh")
  811. (install-file "flisp.boot" bin)
  812. #t))))))
  813. (synopsis "Scheme-like lisp implementation")
  814. (description
  815. "@code{femtolisp} is a scheme-like lisp implementation with a
  816. simple, elegant Scheme dialect. It is a lisp-1 with lexical scope.
  817. The core is 12 builtin special forms and 33 builtin functions.")
  818. (home-page "https://github.com/JeffBezanson/femtolisp")
  819. (license bsd-3))))
  820. (define-public gauche
  821. (package
  822. (name "gauche")
  823. (version "0.9.10")
  824. (home-page "https://practical-scheme.net/gauche/index.html")
  825. (source
  826. (origin
  827. (method url-fetch)
  828. (uri (string-append
  829. "mirror://sourceforge/gauche/Gauche/Gauche-"
  830. version ".tgz"))
  831. (sha256
  832. (base32 "0ci57ak5cp3lkmfy3nh50hifh8nbg58hh6r18asq0rn5mqfxyf8g"))
  833. (modules '((guix build utils)))
  834. (snippet '(begin
  835. ;; Remove libatomic-ops.
  836. (delete-file-recursively "gc/libatomic_ops")
  837. #t))))
  838. (build-system gnu-build-system)
  839. (inputs
  840. `(("libatomic-ops" ,libatomic-ops)
  841. ("slib" ,slib)
  842. ("zlib" ,zlib)))
  843. (native-inputs
  844. `(("texinfo" ,texinfo)
  845. ("openssl" ,openssl) ; needed for tests
  846. ("pkg-config" ,pkg-config))) ; needed to find external libatomic-ops
  847. (arguments
  848. `(#:configure-flags
  849. (list (string-append "--with-slib="
  850. (assoc-ref %build-inputs "slib")
  851. "/lib/slib"))
  852. #:phases
  853. (modify-phases %standard-phases
  854. (add-after 'unpack 'patch-/bin/sh
  855. ;; Needed only for tests.
  856. (lambda _
  857. (substitute* '("test/www.scm"
  858. "ext/tls/test.scm"
  859. "lib/gauche/package/util.scm"
  860. "libsrc/gauche/process.scm")
  861. (("/bin/sh") (which "sh")))
  862. #t))
  863. (add-after 'build 'build-doc
  864. (lambda _
  865. (with-directory-excursion "doc"
  866. (invoke "make" "info"))
  867. #t))
  868. (add-before 'check 'patch-network-tests
  869. ;; Remove net checks.
  870. (lambda _
  871. (delete-file "ext/net/test.scm")
  872. (invoke "touch" "ext/net/test.scm")
  873. #t))
  874. (add-after 'install 'install-docs
  875. (lambda _
  876. (with-directory-excursion "doc"
  877. (invoke "make" "install"))
  878. #t)))))
  879. (synopsis "Scheme scripting engine")
  880. (description "Gauche is a R7RS Scheme scripting engine aiming at being a
  881. handy tool that helps programmers and system administrators to write small to
  882. large scripts quickly. Quick startup, built-in system interface, native
  883. multilingual support are some of the goals. Gauche comes with a package
  884. manager/installer @code{gauche-package} which can download, compile, install
  885. and list gauche extension packages.")
  886. (license bsd-3)))
  887. (define-public gerbil
  888. (package
  889. (name "gerbil")
  890. (version "0.16")
  891. (source
  892. (origin
  893. (method git-fetch)
  894. (uri (git-reference
  895. (url "https://github.com/vyzo/gerbil")
  896. (commit (string-append "v" version))))
  897. (file-name (git-file-name name version))
  898. (sha256
  899. (base32 "0vng0kxpnwsg8jbjdpyn4sdww36jz7zfpfbzayg9sdpz6bjxjy0f"))))
  900. (arguments
  901. `(#:phases
  902. (modify-phases %standard-phases
  903. (delete 'bootstrap)
  904. (add-before 'configure 'chdir
  905. (lambda _
  906. (chdir "src")
  907. #t))
  908. (replace 'configure
  909. (lambda* (#:key outputs inputs #:allow-other-keys)
  910. (invoke "chmod" "755" "-R" ".")
  911. ;; Otherwise fails when editing an r--r--r-- file.
  912. (invoke "gsi-script" "configure"
  913. "--prefix" (assoc-ref outputs "out")
  914. "--with-gambit" (assoc-ref inputs "gambit-c"))))
  915. (add-before 'patch-generated-file-shebangs 'fix-gxi-shebangs
  916. (lambda _
  917. ;; Some .ss files refer to gxi using /usr/bin/env gxi
  918. ;; and 'patch-generated-file-shebangs can't fix that
  919. ;; because gxi has not been compiled yet.
  920. ;; We know where gxi is going to end up so we
  921. ;; Doctor Who our fix here before the problem
  922. ;; happens towards the end of the build.sh script.
  923. (let ((abs-srcdir (getcwd)))
  924. (for-each
  925. (lambda (f)
  926. (substitute* f
  927. (("#!/usr/bin/env gxi")
  928. (string-append "#!" abs-srcdir "/../bin/gxi"))))
  929. '("./gerbil/gxc"
  930. "./lang/build.ss"
  931. "./misc/http-perf/build.ss"
  932. "./misc/rpc-perf/build.ss"
  933. "./misc/scripts/docsnarf.ss"
  934. "./misc/scripts/docstub.ss"
  935. "./misc/scripts/docsyms.ss"
  936. "./r7rs-large/build.ss"
  937. "./release.ss"
  938. "./std/build.ss"
  939. "./std/run-tests.ss"
  940. "./std/web/fastcgi-test.ss"
  941. "./std/web/rack-test.ss"
  942. "./tools/build.ss"
  943. "./tutorial/httpd/build.ss"
  944. "./tutorial/kvstore/build.ss"
  945. "./tutorial/lang/build.ss"
  946. "./tutorial/proxy/build-static.ss"
  947. "./tutorial/proxy/build.ss")))
  948. #t))
  949. (replace
  950. 'build
  951. (lambda*
  952. (#:key inputs #:allow-other-keys)
  953. (setenv "HOME" (getcwd))
  954. (invoke
  955. ;; The build script needs a tty or it'll crash on an ioctl
  956. ;; trying to find the width of the terminal it's running on.
  957. ;; Calling in script prevents that.
  958. "script"
  959. "-qefc"
  960. "./build.sh")))
  961. (delete 'check)
  962. (replace 'install
  963. (lambda* (#:key outputs #:allow-other-keys)
  964. (let* ((out (assoc-ref outputs "out"))
  965. (bin (string-append out "/bin"))
  966. (lib (string-append out "/lib")))
  967. (mkdir-p bin)
  968. (mkdir-p lib)
  969. (copy-recursively "../bin" bin)
  970. (copy-recursively "../lib" lib)))))))
  971. (native-inputs
  972. `(("coreutils" ,coreutils)
  973. ("util-linux" ,util-linux)))
  974. (propagated-inputs
  975. `(("gambit-c" ,gambit-c)
  976. ("zlib" ,zlib)
  977. ("openssl" ,openssl)
  978. ("sqlite" ,sqlite)))
  979. (build-system gnu-build-system)
  980. (synopsis "Meta-dialect of Scheme with post-modern features")
  981. (description "Gerbil is an opinionated dialect of Scheme designed for Systems
  982. Programming, with a state of the art macro and module system on top of the Gambit
  983. runtime. The macro system is based on quote-syntax, and provides the full meta-syntactic
  984. tower with a native implementation of syntax-case. It also provides a full-blown module
  985. system, similar to PLT Scheme's (sorry, Racket) modules. The main difference from Racket
  986. is that Gerbil modules are single instantiation, supporting high performance ahead of
  987. time compilation and compiled macros.")
  988. (home-page "https://cons.io")
  989. (license `(,lgpl2.1 ,asl2.0))))