lisp.scm 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
  3. ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
  4. ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
  6. ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
  7. ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
  8. ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
  9. ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
  10. ;;; Copyright © 2017, 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  11. ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
  12. ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
  13. ;;; Copyright © 2018, 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
  14. ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
  15. ;;; Copyright © 2019, 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
  16. ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
  17. ;;; Copyright © 2019, 2020, 2021 Guillaume Le Vaillant <glv@posteo.net>
  18. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  19. ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
  20. ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
  21. ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
  22. ;;;
  23. ;;; This file is part of GNU Guix.
  24. ;;;
  25. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  26. ;;; under the terms of the GNU General Public License as published by
  27. ;;; the Free Software Foundation; either version 3 of the License, or (at
  28. ;;; your option) any later version.
  29. ;;;
  30. ;;; GNU Guix is distributed in the hope that it will be useful, but
  31. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  32. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  33. ;;; GNU General Public License for more details.
  34. ;;;
  35. ;;; You should have received a copy of the GNU General Public License
  36. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  37. ;;; This file only contains Common Lisp compilers and tooling.
  38. ;;; Common Lisp libraries go to lisp-xyz.scm.
  39. ;;; Common Lisp applications should go to the most appropriate file,
  40. ;;; e.g. StumpWM is in wm.scm.
  41. (define-module (gnu packages lisp)
  42. #:use-module (gnu packages)
  43. #:use-module ((guix licenses) #:prefix license:)
  44. #:use-module (guix packages)
  45. #:use-module (guix download)
  46. #:use-module (guix git-download)
  47. #:use-module (guix gexp)
  48. #:use-module (guix utils)
  49. #:use-module (guix build-system copy)
  50. #:use-module (guix build-system gnu)
  51. #:use-module (guix build-system ant)
  52. #:use-module (guix build-system asdf)
  53. #:use-module (guix build-system trivial)
  54. #:use-module (gnu packages admin)
  55. #:use-module (gnu packages base)
  56. #:use-module (gnu packages bash)
  57. #:use-module (gnu packages bdw-gc)
  58. #:use-module (gnu packages compression)
  59. #:use-module (gnu packages ed)
  60. #:use-module (gnu packages fontutils)
  61. #:use-module (gnu packages gcc)
  62. #:use-module (gnu packages gettext)
  63. #:use-module (gnu packages ghostscript)
  64. #:use-module (gnu packages gl)
  65. #:use-module (gnu packages glib)
  66. #:use-module (gnu packages groff)
  67. #:use-module (gnu packages libffcall)
  68. #:use-module (gnu packages libffi)
  69. #:use-module (gnu packages libsigsegv)
  70. #:use-module (gnu packages linux)
  71. #:use-module (gnu packages m4)
  72. #:use-module (gnu packages maths)
  73. #:use-module (gnu packages multiprecision)
  74. #:use-module (gnu packages ncurses)
  75. #:use-module (gnu packages onc-rpc)
  76. #:use-module (gnu packages perl)
  77. #:use-module (gnu packages readline)
  78. #:use-module (gnu packages sdl)
  79. #:use-module (gnu packages tex)
  80. #:use-module (gnu packages texinfo)
  81. #:use-module (gnu packages tls)
  82. #:use-module (gnu packages version-control)
  83. #:use-module (gnu packages xorg)
  84. #:use-module (ice-9 match))
  85. (define-public cl-asdf
  86. (package
  87. (name "cl-asdf")
  88. (version "3.3.5")
  89. (source
  90. (origin
  91. (method url-fetch)
  92. (uri
  93. (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
  94. version ".lisp"))
  95. (sha256
  96. (base32 "1mydyrii3f0aig1q5admj6hyf59vjn4a5x1q8hqgh483987ilz6h"))))
  97. (build-system trivial-build-system)
  98. (native-inputs
  99. `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
  100. ("patch" ,patch)))
  101. (arguments
  102. `(#:modules ((guix build utils)
  103. (guix build lisp-utils))
  104. #:builder
  105. (begin
  106. (use-modules (guix build utils)
  107. (guix build lisp-utils))
  108. (let* ((out (string-append (assoc-ref %outputs "out")))
  109. (asdf-install (string-append out %source-install-prefix
  110. "/source/asdf/"))
  111. (src-asdf (string-append (assoc-ref %build-inputs "source")))
  112. (dst-asdf (string-append asdf-install "asdf.lisp"))
  113. (patch (string-append (assoc-ref %build-inputs "patch")
  114. "/bin/patch"))
  115. (config-patch (assoc-ref %build-inputs "config-patch")))
  116. (mkdir-p asdf-install)
  117. (copy-file src-asdf dst-asdf)
  118. (invoke patch "-p1" "-i" config-patch dst-asdf)))))
  119. (home-page "https://common-lisp.net/project/asdf/")
  120. (synopsis "Another System Definition Facility")
  121. (description
  122. "ASDF is what Common Lisp hackers use to build and load software. It is
  123. the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
  124. Definition Facility.")
  125. ;; MIT License
  126. (license license:expat)))
  127. (define-public gcl
  128. (let ((commit "ff7ef981765cc0efdb4b1db27c292f5c11a72753")
  129. (revision "3")) ;Guix package revision
  130. (package
  131. (name "gcl")
  132. (version (git-version "2.6.12" revision commit))
  133. (source
  134. (origin
  135. (method git-fetch)
  136. (uri (git-reference
  137. (url "https://git.savannah.gnu.org/r/gcl.git")
  138. (commit commit)))
  139. (file-name (git-file-name name version))
  140. (sha256
  141. (base32 "0z64fxxcaial2i1s1hms8r095dm1ff3wd8ivwdx894a3yln9c0an"))))
  142. (build-system gnu-build-system)
  143. (arguments
  144. `(#:parallel-build? #f ; The build system seems not to be thread safe.
  145. #:test-target "ansi-tests/test_results"
  146. #:configure-flags ,#~(list
  147. "--enable-ansi" ; required by the maxima package
  148. (string-append "CFLAGS=-I"
  149. #$(this-package-input "libtirpc")
  150. "/include/tirpc")
  151. (string-append "LDFLAGS=-L"
  152. #$(this-package-input "libtirpc")
  153. "/lib")
  154. "LIBS=-ltirpc")
  155. #:make-flags ,#~(list
  156. (string-append "GCL_CC=" #$gcc "/bin/gcc")
  157. (string-append "CC="#$gcc "/bin/gcc"))
  158. #:phases
  159. (modify-phases %standard-phases
  160. (add-after 'unpack 'realpath-workaround
  161. ;; Calls to the realpath function can set errno even if the return
  162. ;; value of the function indicates that there is no error, which
  163. ;; make massert consider that there was an error.
  164. (lambda _
  165. (substitute* "gcl/o/main.c"
  166. (("massert\\(realpath\\(s,o\\)\\);" all)
  167. "massert((realpath(s, o) != NULL) && ((errno = 0) == 0));"))))
  168. (add-after 'unpack 'fix-makefile
  169. ;; The "final" target doesn't exist.
  170. (lambda _
  171. (substitute* "gcl/makefile"
  172. (("\\$\\(MAKE\\) -C \\$\\(PORTDIR\\) final")
  173. "$(MAKE) -C $(PORTDIR)"))))
  174. (add-before 'configure 'pre-conf
  175. (lambda* (#:key inputs #:allow-other-keys)
  176. (chdir "gcl")
  177. (substitute*
  178. (append
  179. '("pcl/impl/kcl/makefile.akcl"
  180. "add-defs"
  181. "unixport/makefile.dos"
  182. "add-defs.bat"
  183. "gcl-tk/makefile.prev"
  184. "add-defs1")
  185. (find-files "h" "\\.defs"))
  186. (("SHELL=/bin/bash")
  187. (string-append "SHELL=" (which "bash")))
  188. (("SHELL=/bin/sh")
  189. (string-append "SHELL=" (which "sh"))))
  190. (substitute* "h/linux.defs"
  191. (("#CC") "CC")
  192. (("-fwritable-strings") "")
  193. (("-Werror") ""))
  194. (substitute* "lsp/gcl_top.lsp"
  195. (("\"cc\"")
  196. (string-append "\"" (assoc-ref %build-inputs "gcc")
  197. "/bin/gcc\""))
  198. (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
  199. (("\"ld\"")
  200. (string-append "\"" (assoc-ref %build-inputs "binutils")
  201. "/bin/ld\""))
  202. (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
  203. (("\\(get-path \"objdump --source \"\\)")
  204. (string-append "\"" (assoc-ref %build-inputs "binutils")
  205. "/bin/objdump --source \"")))
  206. #t))
  207. (add-after 'install 'wrap
  208. (lambda* (#:key inputs outputs #:allow-other-keys)
  209. (let* ((gcl (assoc-ref outputs "out"))
  210. (input-path (lambda (lib path)
  211. (string-append
  212. (assoc-ref inputs lib) path)))
  213. (binaries '("binutils")))
  214. ;; GCC and the GNU binutils are necessary for GCL to be
  215. ;; able to compile Lisp functions and programs (this is
  216. ;; a standard feature in Common Lisp). While the
  217. ;; the location of GCC is specified in the make-flags,
  218. ;; the GNU binutils must be available in GCL's $PATH.
  219. (wrap-program (string-append gcl "/bin/gcl")
  220. `("PATH" prefix ,(map (lambda (binary)
  221. (input-path binary "/bin"))
  222. binaries))))
  223. #t))
  224. ;; drop strip phase to make maxima build, see
  225. ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
  226. (delete 'strip))))
  227. (inputs
  228. `(("bash-minimal" ,bash-minimal)
  229. ("gmp" ,gmp)
  230. ("libtirpc" ,libtirpc)
  231. ("readline" ,readline)))
  232. (native-inputs
  233. `(("m4" ,m4)
  234. ("texinfo" ,texinfo)))
  235. (home-page "https://www.gnu.org/software/gcl/")
  236. (synopsis "A Common Lisp implementation")
  237. (description "GCL is an implementation of the Common Lisp language. It
  238. features the ability to compile to native object code and to load native
  239. object code modules directly into its lisp core. It also features a
  240. stratified garbage collection strategy, a source-level debugger and a built-in
  241. interface to the Tk widget system.")
  242. (license license:lgpl2.0+))))
  243. (define-public ecl
  244. (package
  245. (name "ecl")
  246. (version "21.2.1")
  247. (source
  248. (origin
  249. (method url-fetch)
  250. (uri (string-append
  251. "https://common-lisp.net/project/ecl/static/files/release/"
  252. name "-" version ".tgz"))
  253. (sha256
  254. (base32 "000906nnq25177bgsfndiw3iqqgrjc9spk10hzk653sbz3f7anmi"))))
  255. (build-system gnu-build-system)
  256. ;; src/configure uses 'which' to confirm the existence of 'gzip'.
  257. (native-inputs
  258. `(("cl-asdf" ,cl-asdf)
  259. ("which" ,which)
  260. ("texinfo" ,texinfo)))
  261. ;; When ECL is embedded in a program that wants to use Common Lisp as an
  262. ;; extension language, libgmp, libatomic-ops, libgc and libffi must be
  263. ;; present when compiling the program because they are required by ECL's
  264. ;; header file.
  265. ;; Therefore we put these libraries in 'propagated-inputs' instead
  266. ;; of 'inputs'.
  267. (propagated-inputs
  268. `(("gmp" ,gmp)
  269. ("libatomic-ops" ,libatomic-ops)
  270. ("libgc" ,libgc)
  271. ("libffi" ,libffi)))
  272. (arguments
  273. `(#:configure-flags '("--without-rt")
  274. ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
  275. ;; 2-3 tests may be due to FHS assumptions.
  276. #:tests? #t
  277. #:parallel-tests? #f
  278. #:phases
  279. (modify-phases %standard-phases
  280. (delete 'check)
  281. (add-after 'unpack 'replace-asdf
  282. ;; Use system ASDF instead of bundled one.
  283. (lambda* (#:key inputs #:allow-other-keys)
  284. (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
  285. (guix-asdf (string-append
  286. cl-asdf
  287. "/share/common-lisp/source/asdf/asdf.lisp"))
  288. (contrib-asdf "contrib/asdf/asdf.lisp"))
  289. (copy-file guix-asdf contrib-asdf))
  290. #t))
  291. (add-after 'install 'remove-build-stamp
  292. (lambda* (#:key outputs #:allow-other-keys)
  293. (delete-file (string-append (assoc-ref outputs "out")
  294. "/lib/ecl-" ,version "/build-stamp"))
  295. #t))
  296. (add-after 'remove-build-stamp 'wrap
  297. (lambda* (#:key inputs outputs #:allow-other-keys)
  298. (let* ((ecl (assoc-ref outputs "out"))
  299. (input-path (lambda (lib path)
  300. (string-append
  301. (assoc-ref inputs lib) path)))
  302. (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
  303. (binaries '("gcc" "ld-wrapper" "binutils"))
  304. (library-directories
  305. (map (lambda (lib) (input-path lib "/lib"))
  306. libraries)))
  307. (wrap-program (string-append ecl "/bin/ecl")
  308. `("PATH" prefix
  309. ,(map (lambda (binary)
  310. (input-path binary "/bin"))
  311. binaries))
  312. `("CPATH" suffix
  313. ,(map (lambda (lib)
  314. (input-path lib "/include"))
  315. `("kernel-headers" ,@libraries)))
  316. `("LIBRARY_PATH" suffix ,library-directories)
  317. `("LD_LIBRARY_PATH" suffix ,library-directories))
  318. #t)))
  319. (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
  320. (add-before 'check 'fix-path-to-ecl
  321. (lambda _
  322. (substitute* "build/tests/Makefile"
  323. (("\\$\\{exec_prefix\\}/") ""))
  324. #t)))))
  325. (native-search-paths
  326. (list (search-path-specification
  327. (variable "XDG_DATA_DIRS")
  328. (files '("share")))
  329. (search-path-specification
  330. (variable "XDG_CONFIG_DIRS")
  331. (files '("etc")))))
  332. (home-page "http://ecls.sourceforge.net/")
  333. (synopsis "Embeddable Common Lisp")
  334. (description "ECL is an implementation of the Common Lisp language as
  335. defined by the ANSI X3J13 specification. Its most relevant features are: a
  336. bytecode compiler and interpreter, being able to compile Common Lisp with any
  337. C/C++ compiler, being able to build standalone executables and libraries, and
  338. supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
  339. ;; Note that the file "Copyright" points to some files and directories
  340. ;; which aren't under the lgpl2.1+ and instead contain many different,
  341. ;; non-copyleft licenses.
  342. ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
  343. (license license:lgpl2.1+)))
  344. (define-public clisp
  345. (package
  346. (name "clisp")
  347. (version "2.49-92")
  348. (source
  349. (origin
  350. (method git-fetch)
  351. (uri (git-reference
  352. (url "https://gitlab.com/gnu-clisp/clisp")
  353. (commit "clisp-2.49.92-2018-02-18")))
  354. (file-name (git-file-name name version))
  355. (sha256
  356. (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
  357. (build-system gnu-build-system)
  358. (native-inputs
  359. `(("cl-asdf" ,cl-asdf)))
  360. (inputs `(("libffcall" ,libffcall)
  361. ("ncurses" ,ncurses)
  362. ("readline" ,readline)
  363. ("libsigsegv" ,libsigsegv)))
  364. (arguments
  365. `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
  366. (or (%current-system)
  367. (%current-target-system)))
  368. '("CFLAGS=-falign-functions=4")
  369. '())
  370. "--with-dynamic-ffi"
  371. "--with-dynamic-modules"
  372. "--with-ffcall"
  373. "--with-readline"
  374. "--with-sigsegv"
  375. "--with-module=asdf"
  376. "--with-module=rawsock")
  377. #:phases
  378. (modify-phases %standard-phases
  379. (add-after 'unpack 'patch-sh-and-pwd
  380. (lambda _
  381. ;; The package is very messy with its references to "/bin/sh" and
  382. ;; some other absolute paths to traditional tools. These appear in
  383. ;; many places where our automatic patching misses them. Therefore
  384. ;; we do the following, in this early (post-unpack) phase, to solve
  385. ;; the problem from its root.
  386. (substitute* '("src/clisp-link.in"
  387. "src/unix.d"
  388. "src/makemake.in")
  389. (("/bin/sh") (which "sh")))
  390. (substitute* (find-files "." "configure|Makefile")
  391. (("/bin/sh") "sh"))
  392. (substitute* '("src/clisp-link.in")
  393. (("/bin/pwd") "pwd"))
  394. #t))
  395. (add-after 'unpack 'replace-asdf
  396. ;; Use system ASDF instead of bundled one.
  397. (lambda* (#:key inputs #:allow-other-keys)
  398. (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
  399. (guix-asdf (string-append
  400. cl-asdf
  401. "/share/common-lisp/source/asdf/asdf.lisp"))
  402. (contrib-asdf "modules/asdf/asdf.lisp"))
  403. (delete-file contrib-asdf)
  404. (copy-file guix-asdf contrib-asdf)))))))
  405. (native-search-paths
  406. (list (search-path-specification
  407. (variable "XDG_DATA_DIRS")
  408. (files '("share")))
  409. (search-path-specification
  410. (variable "XDG_CONFIG_DIRS")
  411. (files '("etc")))))
  412. (home-page "https://clisp.sourceforge.io/")
  413. (synopsis "A Common Lisp implementation")
  414. (description
  415. "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
  416. high-level, object-oriented functional programming language. CLISP includes
  417. an interpreter, a compiler, a debugger, and much more.")
  418. (license license:gpl2+)))
  419. (define-public sbcl
  420. (package
  421. (name "sbcl")
  422. (version "2.1.6")
  423. (source
  424. (origin
  425. (method url-fetch)
  426. (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
  427. version "-source.tar.bz2"))
  428. (sha256
  429. (base32 "1vydq6mmssla2vn0plpsrm50n3b42a464zxw72j6qihas9fhq8cb"))))
  430. (build-system gnu-build-system)
  431. (outputs '("out" "doc"))
  432. (native-inputs
  433. ;; From INSTALL:
  434. ;; Supported build hosts are:
  435. ;; SBCL
  436. ;; CMUCL
  437. ;; CCL (formerly known as OpenMCL)
  438. ;; ABCL (recent versions only)
  439. ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
  440. ;; XCL
  441. ;;
  442. ;; From NEWS:
  443. ;; * build enhancement: new host quirks mechanism, support for building under
  444. ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
  445. ;;
  446. ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
  447. ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
  448. ;; was last updated in 2010, and both take about the same time to build SBCL.
  449. ;;
  450. ;; For now we stick to CLISP for all systems. We keep the `match' here
  451. ;; to make it easier to change the host compiler for various
  452. ;; architectures. Consider switching to ECL if it gets faster than CLISP
  453. ;; (maybe post 2020 release).
  454. `(,@(match (%current-system)
  455. ((or "x86_64-linux" "i686-linux")
  456. `(("clisp" ,clisp)))
  457. (_
  458. `(("clisp" ,clisp))))
  459. ("cl-asdf" ,cl-asdf)
  460. ("ed" ,ed)
  461. ("inetutils" ,inetutils) ;for hostname(1)
  462. ("texinfo" ,texinfo)
  463. ("texlive" ,(texlive-updmap.cfg (list texlive-tex-texinfo)))
  464. ("which" ,which)
  465. ("zlib" ,zlib)))
  466. (arguments
  467. `(#:modules ((guix build gnu-build-system)
  468. (guix build utils)
  469. (srfi srfi-1))
  470. #:phases
  471. (modify-phases %standard-phases
  472. (delete 'configure)
  473. (add-after 'unpack 'replace-asdf
  474. ;; SBCL developers have not committed to keeping ASDF up to date
  475. ;; due to breaking changes [1]. Guix can handle this situation
  476. ;; easily, and it behooves us to have more control over what version
  477. ;; of ASDF we use to build software; therefore, replace the contrib
  478. ;; ASDF with the version packaged into Guix.
  479. ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
  480. (lambda* (#:key inputs #:allow-other-keys)
  481. (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
  482. (guix-asdf (string-append
  483. cl-asdf
  484. "/share/common-lisp/source/asdf/asdf.lisp"))
  485. (contrib-asdf "contrib/asdf/asdf.lisp"))
  486. (copy-file guix-asdf contrib-asdf))
  487. #t))
  488. (add-before 'build 'patch-unix-tool-paths
  489. (lambda* (#:key outputs inputs #:allow-other-keys)
  490. (let ((out (assoc-ref outputs "out"))
  491. (bash (assoc-ref inputs "bash"))
  492. (coreutils (assoc-ref inputs "coreutils"))
  493. (ed (assoc-ref inputs "ed")))
  494. (define (quoted-path input path)
  495. (string-append "\"" input path "\""))
  496. ;; Patch absolute paths in string literals. Note that this
  497. ;; occurs in some .sh files too (which contain Lisp code). Use
  498. ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
  499. (with-fluids ((%default-port-encoding #f))
  500. ;; The removed file is utf-16-be encoded, which gives substitute*
  501. ;; trouble. It does not contain references to the listed programs.
  502. (substitute* (delete
  503. "./tests/data/compile-file-pos-utf16be.lisp"
  504. (find-files "." "\\.(lisp|sh)$"))
  505. (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
  506. (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
  507. (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
  508. (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
  509. (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
  510. (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
  511. ;; This one script has a non-string occurrence of /bin/sh.
  512. (substitute* '("tests/foreign.test.sh")
  513. ;; Leave whitespace so we don't match the shebang.
  514. ((" /bin/sh ") " sh "))
  515. ;; This file contains a module that can create executable files
  516. ;; which depend on the presence of SBCL. It generates shell
  517. ;; scripts doing "exec sbcl ..." to achieve this. We patch both
  518. ;; the shebang and the reference to "sbcl", tying the generated
  519. ;; executables to the exact SBCL package that generated them.
  520. (substitute* '("contrib/sb-executable/sb-executable.lisp")
  521. (("/bin/sh") (string-append bash "/bin/sh"))
  522. (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
  523. ;; Disable some tests that fail in our build environment.
  524. (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
  525. ;; This requires /etc/protocols.
  526. (("\\(deftest get-protocol-by-name/error" all)
  527. (string-append "#+nil ;disabled by Guix\n" all)))
  528. (substitute* '("contrib/sb-posix/posix-tests.lisp")
  529. ;; These assume some users/groups which we don't have.
  530. (("\\(deftest pwent\\.[12]" all)
  531. (string-append "#+nil ;disabled by Guix\n" all))
  532. (("\\(deftest grent\\.[12]" all)
  533. (string-append "#+nil ;disabled by Guix\n" all))))
  534. #t))
  535. (replace 'build
  536. (lambda* (#:key outputs #:allow-other-keys)
  537. (setenv "CC" "gcc")
  538. (invoke "sh" "make.sh" ,@(match (%current-system)
  539. ((or "x86_64-linux" "i686-linux")
  540. `("clisp"))
  541. (_
  542. `("clisp")))
  543. (string-append "--prefix="
  544. (assoc-ref outputs "out"))
  545. "--dynamic-space-size=3072"
  546. "--with-sb-core-compression"
  547. "--with-sb-xref-for-internals")))
  548. (replace 'install
  549. (lambda _
  550. (invoke "sh" "install.sh")))
  551. (add-after 'build 'build-doc
  552. (lambda _
  553. ;; TODO: Doc is not deterministic, maybe there is a timespamp?
  554. (with-directory-excursion "doc/manual"
  555. (and (invoke "make" "info")
  556. (invoke "make" "dist")))))
  557. (add-after 'build 'build-source
  558. (lambda* (#:key outputs #:allow-other-keys)
  559. (let* ((out (assoc-ref outputs "out"))
  560. (rc (string-append out "/lib/sbcl/sbclrc"))
  561. (source-dir (string-append out "/share/sbcl")))
  562. (for-each (lambda (p)
  563. (copy-recursively p (string-append source-dir "/" p)))
  564. '("src" "contrib"))
  565. (mkdir-p (dirname rc))
  566. (with-output-to-file rc
  567. (lambda ()
  568. (display
  569. (string-append "(sb-ext:set-sbcl-source-location \""
  570. source-dir "\")") )))
  571. #t)))
  572. (add-after 'install 'install-doc
  573. (lambda* (#:key outputs #:allow-other-keys)
  574. (let* ((out (assoc-ref outputs "out"))
  575. (doc (assoc-ref outputs "doc"))
  576. (old-doc-dir (string-append out "/share/doc"))
  577. (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
  578. (rmdir (string-append old-doc-dir "/sbcl/html"))
  579. (mkdir-p new-doc/sbcl-dir)
  580. (copy-recursively (string-append old-doc-dir "/sbcl")
  581. new-doc/sbcl-dir)
  582. (delete-file-recursively old-doc-dir)
  583. #t))))
  584. ;; No 'check' target, though "make.sh" (build phase) runs tests.
  585. #:tests? #f))
  586. (native-search-paths
  587. (list (search-path-specification
  588. (variable "XDG_DATA_DIRS")
  589. (files '("share")))
  590. (search-path-specification
  591. (variable "XDG_CONFIG_DIRS")
  592. (files '("etc")))))
  593. (home-page "http://www.sbcl.org/")
  594. (synopsis "Common Lisp implementation")
  595. (description "Steel Bank Common Lisp (SBCL) is a high performance Common
  596. Lisp compiler. In addition to the compiler and runtime system for ANSI Common
  597. Lisp, it provides an interactive environment including a debugger, a
  598. statistical profiler, a code coverage tool, and many other extensions.")
  599. ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
  600. ;; loop macro has its own license. See COPYING file for further notes.
  601. (license (list license:public-domain license:bsd-2
  602. (license:x11-style "file://src/code/loop.lisp")))))
  603. (define-public ccl
  604. ;; Warning: according to upstream, CCL is not bootstrappable.
  605. ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
  606. ;;
  607. ;; "As far as I know, there is no way to build CCL without an existing
  608. ;; running CCL image. It was bootstrapped back in 1986 or so as
  609. ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
  610. ;; the planet to tell us the story. It SHOULD be possible to port the
  611. ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
  612. ;; it, as is the case for SBCL, but I know of no attempt to do so."
  613. (package
  614. (name "ccl")
  615. ;; XXX When updating this package, check whether we can simply append
  616. ;; VERSION to the ccl-bootstrap URL again, instead of per architecture.
  617. (version "1.12.1")
  618. (source (origin
  619. (method git-fetch)
  620. (uri (git-reference
  621. (url "https://github.com/Clozure/ccl/")
  622. (commit (string-append "v" version))))
  623. (file-name (git-file-name "ccl" version))
  624. (sha256
  625. (base32
  626. "1zz291lvsrr7pps8wfl2kdxsnzjngqi4v3mil14pga4r5zanmsi7"))))
  627. (build-system gnu-build-system)
  628. ;; CCL consists of a "lisp kernel" and "heap image", both of which are
  629. ;; shipped in precompiled form in source tarballs. The former is a C
  630. ;; program which we can rebuild from scratch, but the latter cannot be
  631. ;; generated without an already working copy of CCL, and is platform
  632. ;; dependent, so we need to fetch the correct tarball for the platform.
  633. (inputs
  634. `(("ccl-bootstrap"
  635. ,(origin
  636. (method url-fetch)
  637. (uri (string-append
  638. "https://github.com/Clozure/ccl/releases/download/v"
  639. (match (%current-system)
  640. ("armhf-linux" "1.12/linuxarm")
  641. ;; XXX: This source only works on x86, but provide it as a
  642. ;; catch-all to prevent errors when querying this package
  643. ;; on unsupported platforms.
  644. (_ "1.12.1/linuxx86"))
  645. ".tar.gz"))
  646. (sha256
  647. (base32
  648. (match (%current-system)
  649. ("armhf-linux"
  650. "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
  651. (_ "0ll017ajcfsyx8f7zsy4394y8xxvz40iz0gcsmznp0n3mf0xi67c"))))))))
  652. (native-inputs
  653. `(("cl-asdf" ,cl-asdf)
  654. ("m4" ,m4)))
  655. (arguments
  656. `(#:tests? #f ;no 'check' target
  657. #:modules ((ice-9 match)
  658. (srfi srfi-26)
  659. (guix build utils)
  660. (guix build gnu-build-system))
  661. #:phases
  662. (modify-phases %standard-phases
  663. (add-after 'unpack 'unpack-image
  664. (lambda* (#:key inputs #:allow-other-keys)
  665. (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
  666. (add-after 'unpack 'replace-asdf
  667. ;; Use system ASDF instead of bundled one.
  668. (lambda* (#:key inputs #:allow-other-keys)
  669. (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
  670. (guix-asdf (string-append
  671. cl-asdf
  672. "/share/common-lisp/source/asdf/asdf.lisp"))
  673. (contrib-asdf "tools/asdf.lisp"))
  674. (delete-file contrib-asdf)
  675. (copy-file guix-asdf contrib-asdf))))
  676. (delete 'configure)
  677. (add-before 'build 'pre-build
  678. ;; Enter the source directory for the current platform's lisp
  679. ;; kernel, and run 'make clean' to remove the precompiled one.
  680. (lambda* (#:key system #:allow-other-keys)
  681. (substitute* "lisp-kernel/m4macros.m4"
  682. (("/bin/pwd") (which "pwd")))
  683. (chdir (string-append
  684. "lisp-kernel/"
  685. (match system
  686. ("i686-linux" "linuxx8632")
  687. ("x86_64-linux" "linuxx8664")
  688. ("armhf-linux" "linuxarm")
  689. (_ (string-append "unknown system: " system)))))
  690. (substitute* '("Makefile")
  691. (("/bin/rm") "rm"))
  692. (setenv "CC" "gcc")
  693. (invoke "make" "clean")))
  694. ;; XXX Do we need to recompile the heap image as well for Guix?
  695. ;; For now just use the one we already got in the tarball.
  696. (replace 'install
  697. (lambda* (#:key outputs inputs system #:allow-other-keys)
  698. ;; The lisp kernel built by running 'make' in lisp-kernel/$system
  699. ;; is put back into the original directory, so go back. The heap
  700. ;; image is there as well.
  701. (chdir "../..")
  702. (let* ((out (assoc-ref outputs "out"))
  703. (libdir (string-append out "/lib/"))
  704. (bindir (string-append out "/bin/"))
  705. (wrapper (string-append bindir "ccl"))
  706. (bash (assoc-ref inputs "bash"))
  707. (kernel
  708. (match system
  709. ("i686-linux" "lx86cl")
  710. ("x86_64-linux" "lx86cl64")
  711. ("armhf-linux" "armcl")
  712. ;; Unlikely to work, but try it anyway...
  713. (_ system)))
  714. (heap (string-append kernel ".image")))
  715. (install-file kernel libdir)
  716. (install-file heap libdir)
  717. (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
  718. ,@(match system
  719. ("x86_64-linux"
  720. '("x86-headers64"))
  721. ("i686-linux"
  722. '("x86-headers"))
  723. (_ '())))))
  724. (for-each copy-recursively
  725. dirs
  726. (map (cut string-append libdir <>) dirs)))
  727. (mkdir-p bindir)
  728. (with-output-to-file wrapper
  729. (lambda ()
  730. (display
  731. (string-append
  732. "#!" bash "/bin/sh\n"
  733. "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
  734. "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
  735. (chmod wrapper #o755))
  736. #t)))))
  737. (native-search-paths
  738. (list (search-path-specification
  739. (variable "XDG_DATA_DIRS")
  740. (files '("share")))
  741. (search-path-specification
  742. (variable "XDG_CONFIG_DIRS")
  743. (files '("etc")))))
  744. (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
  745. (home-page "https://ccl.clozure.com/")
  746. (synopsis "Common Lisp implementation")
  747. (description "Clozure CL (often called CCL for short) is a Common Lisp
  748. implementation featuring fast compilation speed, native threads, a precise,
  749. generational, compacting garbage collector, and a convenient foreign-function
  750. interface.")
  751. (license license:asl2.0)))
  752. (define-public lush2
  753. (package
  754. (name "lush2")
  755. (version "2.0.1")
  756. (source
  757. (origin
  758. (method url-fetch)
  759. (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
  760. version ".tar.gz"))
  761. (modules '((guix build utils)))
  762. (snippet
  763. '(begin
  764. (substitute* "src/unix.c"
  765. (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
  766. (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
  767. (substitute* "src/main.c"
  768. (("\" \\(built \" __DATE__ \"\\)\"") ""))
  769. #t))
  770. (sha256
  771. (base32
  772. "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
  773. (build-system gnu-build-system)
  774. (arguments
  775. `(;; We have to add these LIBS so that they are found.
  776. #:configure-flags (list "LIBS=-lz"
  777. "X_EXTRA_LIBS=-lfontconfig"
  778. "--with-x")
  779. #:tests? #f)) ; No make check.
  780. (native-inputs `(("intltool" ,intltool)))
  781. (inputs
  782. `(("alsa-lib" ,alsa-lib)
  783. ("sdl" ,sdl)
  784. ("sdl-image" ,sdl-image)
  785. ("sdl-mixer" ,sdl-mixer)
  786. ("sdl-net" ,sdl-net)
  787. ("sdl-ttf" ,sdl-ttf)
  788. ("lapack" ,lapack)
  789. ("libxft" ,libxft)
  790. ("fontconfig" ,fontconfig)
  791. ("gsl" ,gsl)
  792. ("openblas" ,openblas)
  793. ("glu" ,glu)
  794. ("mesa" ,mesa)
  795. ("mesa-utils" ,mesa-utils)
  796. ("binutils" ,binutils)
  797. ("libiberty" ,libiberty)
  798. ("readline" ,readline)
  799. ("zlib" ,zlib)
  800. ("gettext-minimal" ,gettext-minimal)))
  801. (synopsis "Lisp Universal Shell")
  802. (description
  803. "Lush is an object-oriented Lisp interpreter/compiler with features
  804. designed to please people who want to prototype large numerical
  805. applications. Lush includes an extensive library of
  806. vector/matrix/tensor manipulation, numerous numerical libraries
  807. (including GSL, LAPACK, and BLAS), a set of graphic functions, a
  808. simple GUI toolkit, and interfaces to various graphic and multimedia
  809. libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
  810. grabbing), and others. Lush is an ideal frontend script language for
  811. programming projects written in C or other languages. Lush also has
  812. libraries for Machine Learning, Neural Nets and statistical estimation.")
  813. (home-page "http://lush.sourceforge.net/")
  814. (license license:lgpl2.1+)))
  815. (define-public confusion-mdl
  816. (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
  817. (package
  818. (name "confusion-mdl")
  819. (version "0.2")
  820. (source (origin
  821. (method git-fetch)
  822. (uri (git-reference
  823. (url (string-append "https://gitlab.com/emacsomancer/" name))
  824. (commit commit)))
  825. (sha256
  826. (base32
  827. "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
  828. (file-name (git-file-name name version))))
  829. (build-system gnu-build-system)
  830. (arguments
  831. `(#:tests? #f ; there are no tests
  832. #:phases
  833. (modify-phases %standard-phases
  834. (delete 'configure)
  835. (replace 'build
  836. (lambda* (#:key (make-flags '()) #:allow-other-keys)
  837. (apply invoke "make" "CC=gcc" make-flags)))
  838. (replace 'install
  839. (lambda* (#:key outputs #:allow-other-keys)
  840. (let* ((out (assoc-ref outputs "out"))
  841. (bin (string-append out "/bin")))
  842. (install-file "mdli" bin)
  843. #t))))))
  844. (native-inputs
  845. `(("perl" ,perl)))
  846. (inputs
  847. `(("libgc" ,libgc)))
  848. (synopsis "Interpreter for the MIT Design Language (MDL)")
  849. (description "MDL (the MIT Design Language) is a descendant of Lisp. It
  850. was originally developed in 1971 on the PDP-10 computer under the Incompatible
  851. Timesharing System (ITS) to provide high level language support for the
  852. Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
  853. PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
  854. based on a subset of MDL. Confusion is a MDL interpreter that works just well
  855. enough to play the original mainframe Zork all the way through.")
  856. (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
  857. (license license:gpl3+))))
  858. (define man-for-txr
  859. (let ((commit "dfbf19b9a96474b8c1bacac85e43605e5691ceb2")
  860. ;; Number of additional commits since the last tag (see the output of
  861. ;; "git describe --tags").
  862. (revision "41"))
  863. (package
  864. (name "man-for-txr")
  865. (version (git-version "1.6g" revision commit))
  866. (source
  867. (origin
  868. (method git-fetch)
  869. (uri (git-reference
  870. (url "http://www.kylheku.com/git/man/")
  871. (commit commit)))
  872. (file-name (git-file-name name version))
  873. (sha256
  874. (base32 "1zy0g8fj9nsfwzvg88hyaiy94r8j14xhs8vy2ln2niqdm6x2lvy2"))))
  875. (build-system gnu-build-system)
  876. (arguments
  877. `(#:tests? #f ; There are no tests.
  878. #:phases
  879. (modify-phases %standard-phases
  880. (add-after 'unpack 'fix-man2html-makefile
  881. (lambda _
  882. (substitute* "man2html/Makefile.in"
  883. ;; It inadvertently ignores @bindir@.
  884. (("^(bindir = \\$\\(DESTDIR\\)\\$\\(PREFIX\\)).*" _ prefix)
  885. (string-append prefix "@bindir@\n")))
  886. #t))
  887. (add-after 'unpack 'delete-generated-files
  888. (lambda _
  889. (for-each delete-file
  890. (append
  891. (list "conf_script")
  892. (map (lambda (d) (string-append d "/Makefile"))
  893. '("." "man" "man2html" "src"))
  894. (map (lambda (f) (string-append "src/" f))
  895. '("makewhatis.in" "man.conf"
  896. "paths.h" "version.h"))))
  897. #t))
  898. (replace 'configure
  899. (lambda* (#:key outputs #:allow-other-keys)
  900. (setenv "CC" ,(cc-for-target))
  901. ;; Humor the manually written configure script.
  902. (invoke "./configure" "+lang" "en" "+fhs"
  903. (string-append "-prefix=" (assoc-ref outputs "out")))
  904. #t)))))
  905. (home-page "http://www.kylheku.com/cgit/man/")
  906. (synopsis "Modifications to the man utilities, specifically man2html")
  907. (description
  908. "This is a fork of the man utilities intended specifically for building
  909. the HTML documentation of TXR.")
  910. (license license:gpl2))))
  911. (define-public txr
  912. (package
  913. (name "txr")
  914. (version "270")
  915. (source
  916. (origin
  917. (method git-fetch)
  918. (uri (git-reference
  919. (url "http://www.kylheku.com/git/txr/")
  920. (commit (string-append "txr-" version))))
  921. (file-name (git-file-name name version))
  922. (sha256
  923. (base32 "1kp64h3ls8mddvrlaqqylrb3brckfrqvkk8049xn15mimfggg0xv"))))
  924. (build-system gnu-build-system)
  925. (native-inputs
  926. ;; Required to build the documentation.
  927. `(("ghostscript" ,ghostscript)
  928. ("groff" ,groff)
  929. ("man2html" ,man-for-txr)))
  930. (inputs
  931. `(("bash" ,bash-minimal)
  932. ("libffi" ,libffi)))
  933. (arguments
  934. `(#:configure-flags
  935. (list ,(string-append "cc=" (cc-for-target))
  936. (string-append "--prefix=" (assoc-ref %outputs "out")))
  937. #:test-target "tests"
  938. #:phases
  939. (modify-phases %standard-phases
  940. (add-after 'unpack 'fix-license-installation
  941. (lambda* (#:key outputs #:allow-other-keys)
  942. (substitute* "Makefile"
  943. (("INSTALL(,.*LICENSE,.*)\\$\\(datadir\\)" _ match)
  944. (string-append "INSTALL" match
  945. (assoc-ref outputs "out")
  946. "/share/doc/" ,name "-" ,version)))
  947. #t))
  948. (delete 'install-license-files)
  949. (add-after 'unpack 'inhibit-doc-syms-generation
  950. (lambda _
  951. (substitute* "genman.txr"
  952. ;; Exit from genman.txr before it tries to write to
  953. ;; stdlib/doc-syms.tl, which is anyway kept up to date with
  954. ;; each release (and is already compiled to stdlib/doc-syms.tlo
  955. ;; when genman.txr is run).
  956. (("^@\\(output \"stdlib/doc-syms\\.tl\"\\).*" line)
  957. (string-append "@(do (exit))\n" line)))
  958. #t))
  959. (add-after 'unpack 'fix-paths
  960. (lambda* (#:key inputs #:allow-other-keys)
  961. (substitute* "stream.c"
  962. (("/bin/sh")
  963. (string-append (assoc-ref inputs "bash") "/bin/bash")))))
  964. (add-after 'unpack 'fix-tests
  965. (lambda _
  966. (substitute* (list "tests/017/realpath.tl"
  967. "tests/017/realpath.expected")
  968. (("/usr/bin") "/"))))
  969. (replace 'configure
  970. ;; ./configure is a hand-written script that can't handle standard
  971. ;; autotools arguments like CONFIG_SHELL.
  972. (lambda* (#:key configure-flags #:allow-other-keys)
  973. (setenv "txr_shell" (which "bash"))
  974. (apply invoke "./configure" configure-flags)
  975. #t))
  976. (add-after 'build 'build-doc
  977. (lambda _
  978. (setenv "GS_GENERATE_UUIDS" "0")
  979. (invoke "make" "txr-manpage.html" "txr-manpage.pdf")
  980. #t))
  981. (add-after 'install 'install-doc
  982. (lambda* (#:key outputs #:allow-other-keys)
  983. (let ((doc (string-append (assoc-ref outputs "out")
  984. "/share/doc/" ,name "-" ,version)))
  985. (for-each (lambda (f) (install-file f doc))
  986. '("txr-manpage.html" "txr-manpage.pdf")))
  987. #t)))))
  988. (synopsis "General-purpose, multi-paradigm programming language")
  989. (description
  990. "TXR is a general-purpose, multi-paradigm programming language. It
  991. comprises two languages integrated into a single tool: a text scanning and
  992. extraction language referred to as the TXR Pattern Language (sometimes just
  993. \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
  994. used for everything from \"one liner\" data transformation tasks at the
  995. command line, to data scanning and extracting scripts, to full application
  996. development in a wide-range of areas.")
  997. (home-page "https://nongnu.org/txr/")
  998. (license license:bsd-2)))
  999. (define picolisp32
  1000. (package
  1001. (name "picolisp32")
  1002. (version "19.12")
  1003. (source
  1004. (origin
  1005. (method url-fetch)
  1006. (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
  1007. (sha256
  1008. (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
  1009. (modules '((guix build utils)))
  1010. (snippet '(begin
  1011. ;; Delete the pre-compiled jar file.
  1012. (delete-file "ersatz/picolisp.jar")
  1013. #t))))
  1014. (build-system gnu-build-system)
  1015. (inputs
  1016. `(("openssl" ,openssl)))
  1017. (arguments
  1018. `(#:system ,(match (%current-system)
  1019. ((or "armhf-linux" "aarch64-linux")
  1020. "armhf-linux")
  1021. (_
  1022. "i686-linux"))
  1023. #:phases
  1024. (modify-phases %standard-phases
  1025. (delete 'configure)
  1026. (add-after 'unpack 'fix-paths
  1027. (lambda* (#:key outputs #:allow-other-keys)
  1028. (let* ((out (assoc-ref outputs "out"))
  1029. (shebang-line (string-append
  1030. "#!" out "/bin/picolisp "
  1031. out "/lib/picolisp/lib.l")))
  1032. (substitute* '("bin/pil"
  1033. "bin/pilIndent"
  1034. "bin/pilPretty"
  1035. "bin/psh"
  1036. "bin/replica"
  1037. "bin/vip"
  1038. "bin/watchdog"
  1039. "games/xchess"
  1040. "misc/bigtest"
  1041. "misc/calc"
  1042. "misc/chat"
  1043. "misc/mailing"
  1044. "src/mkVers")
  1045. (("#\\!bin/picolisp lib.l")
  1046. shebang-line)
  1047. (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
  1048. shebang-line)
  1049. (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
  1050. shebang-line)))
  1051. #t))
  1052. (add-after 'fix-paths 'make-build-reproducible
  1053. (lambda _
  1054. (substitute* "src64/lib/asm.l"
  1055. (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
  1056. ""))
  1057. #t))
  1058. (add-after 'make-build-reproducible 'fix-permissions
  1059. (lambda _
  1060. (for-each make-file-writable
  1061. '("doc/family.tgz"
  1062. "doc/family64.tgz"
  1063. "lib/map"
  1064. "src64/tags"))
  1065. #t))
  1066. (replace 'build
  1067. (lambda _
  1068. (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
  1069. (add-before 'check 'set-home-for-tests
  1070. (lambda _
  1071. (setenv "HOME" "/tmp")
  1072. #t))
  1073. (replace 'check
  1074. (lambda _
  1075. (invoke "./pil" "test/lib.l" "-bye" "+")))
  1076. (replace 'install
  1077. (lambda* (#:key outputs #:allow-other-keys)
  1078. (let* ((out (assoc-ref outputs "out"))
  1079. (bin (string-append out "/bin"))
  1080. (man (string-append out "/share/man"))
  1081. (picolisp (string-append out "/lib/picolisp")))
  1082. (copy-recursively "man" man)
  1083. (copy-recursively "." picolisp)
  1084. (for-each (lambda (name)
  1085. (let ((path (string-append picolisp "/" name)))
  1086. (delete-file-recursively path)))
  1087. '("CHANGES" "COPYING" "CREDITS" "cygwin"
  1088. "INSTALL" "man" "pil" "README" "src" "src64"
  1089. "test"))
  1090. (mkdir-p bin)
  1091. (symlink (string-append picolisp "/bin/picolisp")
  1092. (string-append bin "/picolisp"))
  1093. (symlink (string-append picolisp "/bin/pil")
  1094. (string-append bin "/pil")))
  1095. #t)))))
  1096. (synopsis "Interpreter for the PicoLisp programming language")
  1097. (description
  1098. "PicoLisp is a programming language, or really a programming system,
  1099. including a built-in database engine and a GUI system.")
  1100. (home-page "https://picolisp.com/wiki/?home")
  1101. (license license:expat)))
  1102. (define-public picolisp
  1103. (match (%current-system)
  1104. ((or "aarch64-linux" "x86_64-linux")
  1105. (package
  1106. ;; Use the 32-bit picolisp to generate the assembly files required by
  1107. ;; the 64-bit picolisp.
  1108. (inherit picolisp32)
  1109. (name "picolisp")
  1110. (native-inputs
  1111. `(("picolisp32" ,picolisp32)
  1112. ("which" ,which)))
  1113. (arguments
  1114. (substitute-keyword-arguments (package-arguments picolisp32)
  1115. ((#:system _ "") (%current-system))
  1116. ((#:phases phases)
  1117. `(modify-phases ,phases
  1118. (delete 'fix-paths)
  1119. (add-before 'build 'fix-paths
  1120. ;; This must run after the other shebang-patching phases,
  1121. ;; or they will override our changes.
  1122. (lambda* (#:key inputs outputs #:allow-other-keys)
  1123. (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
  1124. (out (assoc-ref outputs "out"))
  1125. (shebang-line (string-append
  1126. "#!" out "/bin/picolisp "
  1127. out "/lib/picolisp/lib.l")))
  1128. (substitute* '("bin/pil"
  1129. "bin/pilIndent"
  1130. "bin/pilPretty"
  1131. "bin/psh"
  1132. "bin/replica"
  1133. "bin/vip"
  1134. "bin/watchdog"
  1135. "games/xchess"
  1136. "misc/bigtest"
  1137. "misc/calc"
  1138. "misc/chat"
  1139. "misc/mailing"
  1140. "src/mkVers")
  1141. (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
  1142. shebang-line))
  1143. (substitute* "src64/mkAsm"
  1144. (("/usr/bin/")
  1145. (string-append picolisp32 "/bin/"))))
  1146. #t))
  1147. (replace 'build
  1148. (lambda _
  1149. (invoke "make" "-C" "src" "tools" "gate")
  1150. (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
  1151. (_
  1152. (package
  1153. (inherit picolisp32)
  1154. (name "picolisp")))))
  1155. (define-public janet
  1156. (package
  1157. (name "janet")
  1158. (version "1.12.2")
  1159. (source
  1160. (origin
  1161. (method git-fetch)
  1162. (uri (git-reference
  1163. (url "https://github.com/janet-lang/janet")
  1164. (commit (string-append "v" version))))
  1165. (file-name (git-file-name name version))
  1166. (sha256
  1167. (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
  1168. (build-system gnu-build-system)
  1169. (arguments
  1170. `(#:make-flags (list
  1171. (string-append "DESTDIR=" (assoc-ref %outputs "out"))
  1172. (string-append "PREFIX=")
  1173. (string-append "CC=" (assoc-ref %build-inputs "gcc")
  1174. "/bin/gcc"))
  1175. #:phases
  1176. (modify-phases %standard-phases
  1177. (delete 'configure)
  1178. (replace 'check
  1179. (lambda _
  1180. (invoke "make" "test"))))))
  1181. (home-page "https://janet-lang.org/")
  1182. (synopsis "Functional, imperative and embeddable programming language")
  1183. (description
  1184. "Janet is a functional and imperative programming language. It can be
  1185. used for rapid prototyping, dynamic systems, and other domains where dynamic
  1186. languages shine. You can also add Janet scripting to an application by
  1187. embedding a single C file and two headers. It can be easily ported to new
  1188. platforms. The entire language (core library, interpreter, compiler,
  1189. assembler, PEG) is less than 1MB.")
  1190. (license license:expat)))
  1191. (define-public lisp-repl-core-dumper
  1192. (package
  1193. (name "lisp-repl-core-dumper")
  1194. (version "0.7.0")
  1195. (source
  1196. (origin
  1197. (method git-fetch)
  1198. (uri (git-reference
  1199. (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
  1200. (commit version)))
  1201. (file-name (git-file-name name version))
  1202. (sha256
  1203. (base32 "0yfsyxj462yi3bx587yssp4gwb54jdm6fjk9q93gjrfv8a65ilp7"))))
  1204. (build-system copy-build-system)
  1205. (arguments
  1206. '(#:install-plan
  1207. '(("lisp-repl-core-dumper" "bin/"))
  1208. #:phases
  1209. (modify-phases %standard-phases
  1210. (add-before 'install 'fix-utils-path
  1211. (lambda* (#:key inputs #:allow-other-keys)
  1212. (let* ((cat (search-input-file inputs "/bin/cat"))
  1213. (paste (search-input-file inputs "/bin/paste"))
  1214. (sort (search-input-file inputs "/bin/sort"))
  1215. (basename (search-input-file inputs "/bin/basename"))
  1216. (sed (search-input-file inputs "/bin/sed")))
  1217. (substitute* "lisp-repl-core-dumper"
  1218. (("\\$\\(basename") (string-append "$(" basename))
  1219. (("\\<cat\\>") cat)
  1220. (("\\<paste\\>") paste)
  1221. (("\\<sed\\>") sed)
  1222. (("\\<sort\\>") sort))))))))
  1223. (inputs
  1224. `(("coreutils" ,coreutils-minimal)
  1225. ("sed" ,sed)))
  1226. (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
  1227. (synopsis "Generate REPL-optimized Lisp cores on demand")
  1228. (description
  1229. "This tool generates Lisp images that can embed the provided systems
  1230. and make for REPLs that start blazing fast.
  1231. @itemize
  1232. @item It’s portable and should work with any compiler.
  1233. @item It works for any REPL.
  1234. @item It allows you to include arbitrary libraries.
  1235. @end itemize\n")
  1236. (license license:gpl3+)))
  1237. (define-public buildapp
  1238. (package
  1239. (name "buildapp")
  1240. (version "1.5.6")
  1241. (source
  1242. (origin
  1243. (method git-fetch)
  1244. (uri (git-reference
  1245. (url "https://github.com/xach/buildapp")
  1246. (commit (string-append "release-" version))))
  1247. (file-name (git-file-name name version))
  1248. (sha256
  1249. (base32 "020ipjfqa3l8skd97cj5kq837wgpj28ygfxnkv64cnjrlbnzh161"))))
  1250. (build-system gnu-build-system)
  1251. (native-inputs
  1252. `(("sbcl" ,sbcl)))
  1253. (arguments
  1254. `(#:tests? #f
  1255. #:make-flags
  1256. (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
  1257. #:strip-binaries? #f
  1258. #:phases
  1259. (modify-phases %standard-phases
  1260. (delete 'configure)
  1261. (add-after 'unpack 'set-home
  1262. (lambda _
  1263. (setenv "HOME" "/tmp")
  1264. #t))
  1265. (add-before 'install 'create-target-directory
  1266. (lambda* (#:key outputs #:allow-other-keys)
  1267. (let* ((bin (string-append (assoc-ref outputs "out") "/bin")))
  1268. (mkdir-p bin)
  1269. #t))))))
  1270. (home-page "https://www.xach.com/lisp/buildapp/")
  1271. (synopsis "Makes easy to build application executables with SBCL")
  1272. (description
  1273. "Buildapp is an application for SBCL or CCL that configures and saves an
  1274. executable Common Lisp image. It is similar to cl-launch and hu.dwim.build. ")
  1275. (license license:bsd-2)))