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