| 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 | ;;; |
| 6 | ;;; This file is part of GNU Guix. |
| 7 | ;;; |
| 8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 9 | ;;; under the terms of the GNU General Public License as published by |
| 10 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 11 | ;;; your option) any later version. |
| 12 | ;;; |
| 13 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | ;;; GNU General Public License for more details. |
| 17 | ;;; |
| 18 | ;;; You should have received a copy of the GNU General Public License |
| 19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | (define-module (gnu packages lisp) |
| 22 | #:use-module (gnu packages) |
| 23 | #:use-module ((guix licenses) #:prefix license:) |
| 24 | #:use-module (guix packages) |
| 25 | #:use-module (gnu packages readline) |
| 26 | #:use-module (gnu packages texinfo) |
| 27 | #:use-module (gnu packages texlive) |
| 28 | #:use-module (gnu packages m4) |
| 29 | #:use-module (guix download) |
| 30 | #:use-module (guix utils) |
| 31 | #:use-module (guix build-system gnu) |
| 32 | #:use-module (gnu packages base) |
| 33 | #:use-module (gnu packages multiprecision) |
| 34 | #:use-module (gnu packages bdw-gc) |
| 35 | #:use-module (gnu packages libffi) |
| 36 | #:use-module (gnu packages libffcall) |
| 37 | #:use-module (gnu packages readline) |
| 38 | #:use-module (gnu packages libsigsegv) |
| 39 | #:use-module (gnu packages admin) |
| 40 | #:use-module (gnu packages ed) |
| 41 | #:use-module (gnu packages m4) |
| 42 | #:use-module (gnu packages version-control) |
| 43 | #:use-module (ice-9 match)) |
| 44 | |
| 45 | (define-public gcl |
| 46 | (package |
| 47 | (name "gcl") |
| 48 | (version "2.6.12") |
| 49 | (source |
| 50 | (origin |
| 51 | (method url-fetch) |
| 52 | (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz")) |
| 53 | (sha256 |
| 54 | (base32 "1s4hs2qbjqmn9h88l4xvsifq5c3dlc5s74lyb61rdi5grhdlkf4f")))) |
| 55 | (build-system gnu-build-system) |
| 56 | (arguments |
| 57 | `(#:parallel-build? #f ; The build system seems not to be thread safe. |
| 58 | #:tests? #f ; There does not seem to be make check or anything similar. |
| 59 | #:configure-flags '("--enable-ansi") ; required for use by the maxima package |
| 60 | #:phases (alist-cons-before |
| 61 | 'configure 'pre-conf |
| 62 | (lambda _ |
| 63 | ;; Patch bug when building readline support. This bug was |
| 64 | ;; also observed by Debian |
| 65 | ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741819 |
| 66 | (substitute* "o/gcl_readline.d" |
| 67 | (("rl_attempted_completion_function = \ |
| 68 | \\(CPPFunction \\*\\)rl_completion;") |
| 69 | "rl_attempted_completion_function = rl_completion;")) |
| 70 | (substitute* |
| 71 | (append |
| 72 | '("pcl/impl/kcl/makefile.akcl" |
| 73 | "add-defs" |
| 74 | "unixport/makefile.dos" |
| 75 | "add-defs.bat" |
| 76 | "gcl-tk/makefile.prev" |
| 77 | "add-defs1") |
| 78 | (find-files "h" "\\.defs")) |
| 79 | (("SHELL=/bin/(ba)?sh") |
| 80 | (string-append "SHELL=" (which "bash"))))) |
| 81 | ;; drop strip phase to make maxima build, see |
| 82 | ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html |
| 83 | (alist-delete 'strip |
| 84 | %standard-phases)))) |
| 85 | (native-inputs |
| 86 | `(("m4" ,m4) |
| 87 | ("readline" ,readline) |
| 88 | ("texinfo" ,texinfo) |
| 89 | ("texlive" ,texlive))) |
| 90 | (home-page "http://www.gnu.org/software/gcl") |
| 91 | (synopsis "A Common Lisp implementation") |
| 92 | (description "GCL is an implementation of the Common Lisp language. It |
| 93 | features the ability to compile to native object code and to load native |
| 94 | object code modules directly into its lisp core. It also features a |
| 95 | stratified garbage collection strategy, a source-level debugger and a built-in |
| 96 | interface to the Tk widget system.") |
| 97 | (license license:lgpl2.0+))) |
| 98 | |
| 99 | (define-public ecl |
| 100 | (package |
| 101 | (name "ecl") |
| 102 | (version "15.2.21") |
| 103 | (source |
| 104 | (origin |
| 105 | (method url-fetch) |
| 106 | (uri (string-append "mirror://sourceforge/ecls/ecls/" |
| 107 | (version-major+minor version) |
| 108 | "/ecl-" version ".tgz")) |
| 109 | (sha256 |
| 110 | (base32 "05di23v977byf67rq5bdshw8lqbby1ycbscdcl1vca0z6r1s204j")))) |
| 111 | (build-system gnu-build-system) |
| 112 | ;; src/configure uses 'which' to confirm the existence of 'gzip'. |
| 113 | (native-inputs `(("which" ,which))) |
| 114 | (inputs `(("gmp" ,gmp) |
| 115 | ("libatomic-ops" ,libatomic-ops) |
| 116 | ("libgc" ,libgc) |
| 117 | ("libffi" ,libffi))) |
| 118 | (arguments |
| 119 | '(;; During 'make check', ECL fails to initialize with "protocol not |
| 120 | ;; supported", presumably because /etc/protocols is missing in the |
| 121 | ;; build environment. See <http://sourceforge.net/p/ecls/bugs/300/>. |
| 122 | ;; |
| 123 | ;; Should the test suite be re-enabled, it might be necessary to add |
| 124 | ;; '#:parallel-tests #f'. See the same bug report as above. |
| 125 | ;; |
| 126 | ;; The following might also be necessary, due to 'make check' assuming |
| 127 | ;; ECL is installed. See <http://sourceforge.net/p/ecls/bugs/299/>. |
| 128 | ;; |
| 129 | ;; #:phases |
| 130 | ;; (let* ((check-phase (assq-ref %standard-phases 'check)) |
| 131 | ;; (rearranged-phases |
| 132 | ;; (alist-cons-after 'install 'check check-phase |
| 133 | ;; (alist-delete 'check %standard-phases)))) |
| 134 | ;; (alist-cons-before |
| 135 | ;; 'check 'pre-check |
| 136 | ;; (lambda* (#:key outputs #:allow-other-keys) |
| 137 | ;; (substitute* '("build/tests/Makefile") |
| 138 | ;; (("ECL=ecl") |
| 139 | ;; (string-append |
| 140 | ;; "ECL=" (assoc-ref outputs "out") "/bin/ecl")))) |
| 141 | ;; rearranged-phases)) |
| 142 | #:tests? #f)) |
| 143 | (home-page "http://ecls.sourceforge.net/") |
| 144 | (synopsis "Embeddable Common Lisp") |
| 145 | (description "ECL is an implementation of the Common Lisp language as |
| 146 | defined by the ANSI X3J13 specification. Its most relevant features are: a |
| 147 | bytecode compiler and interpreter, being able to compile Common Lisp with any |
| 148 | C/C++ compiler, being able to build standalone executables and libraries, and |
| 149 | supporting ASDF, Sockets, Gray streams, MOP, and other useful components.") |
| 150 | ;; Note that the file "Copyright" points to some files and directories |
| 151 | ;; which aren't under the lgpl2.0+ and instead contain many different, |
| 152 | ;; non-copyleft licenses. |
| 153 | (license license:lgpl2.0+))) |
| 154 | |
| 155 | (define-public clisp |
| 156 | (package |
| 157 | (name "clisp") |
| 158 | (version "2.49") |
| 159 | (source |
| 160 | (origin |
| 161 | (method url-fetch) |
| 162 | (uri (string-append "mirror://gnu/clisp/release/" version |
| 163 | "/clisp-" version ".tar.gz")) |
| 164 | (sha256 |
| 165 | (base32 "0rp82nqp5362isl9i34rwgg04cidz7izljd9d85pqcw1qr964bxx")))) |
| 166 | (build-system gnu-build-system) |
| 167 | (inputs `(("libffcall" ,libffcall) |
| 168 | ("readline" ,readline) |
| 169 | ("libsigsegv" ,libsigsegv))) |
| 170 | (arguments |
| 171 | '(;; XXX The custom configure script does not cope well when passed |
| 172 | ;; --build=<triplet>. |
| 173 | #:build #f |
| 174 | #:phases |
| 175 | (alist-cons-after |
| 176 | 'unpack 'patch-sh-and-pwd |
| 177 | (lambda _ |
| 178 | ;; The package is very messy with its references to "/bin/sh" and |
| 179 | ;; some other absolute paths to traditional tools. These appear in |
| 180 | ;; many places where our automatic patching misses them. Therefore |
| 181 | ;; we do the following, in this early (post-unpack) phase, to solve |
| 182 | ;; the problem from its root. |
| 183 | (substitute* (find-files "." "configure|Makefile") |
| 184 | (("/bin/sh") "sh")) |
| 185 | (substitute* '("src/clisp-link.in") |
| 186 | (("/bin/pwd") "pwd"))) |
| 187 | (alist-cons-before |
| 188 | 'build 'chdir-to-source |
| 189 | (lambda _ |
| 190 | ;; We are supposed to call make under the src sub-directory. |
| 191 | (chdir "src")) |
| 192 | %standard-phases)) |
| 193 | ;; Makefiles seem to have race conditions. |
| 194 | #:parallel-build? #f)) |
| 195 | (home-page "http://www.clisp.org/") |
| 196 | (synopsis "A Common Lisp implementation") |
| 197 | (description |
| 198 | "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a |
| 199 | high-level, object-oriented functional programming language. CLISP includes |
| 200 | an interpreter, a compiler, a debugger, and much more.") |
| 201 | ;; Website says gpl2+, COPYRIGHT file says gpl2; actual source files have |
| 202 | ;; a lot of gpl3+. (Also some parts are under non-copyleft licenses, such |
| 203 | ;; as CLX by Texas Instruments.) In that case gpl3+ wins out. |
| 204 | (license license:gpl3+))) |
| 205 | |
| 206 | (define-public sbcl |
| 207 | (package |
| 208 | (name "sbcl") |
| 209 | (version "1.2.8") |
| 210 | (source |
| 211 | (origin |
| 212 | (method url-fetch) |
| 213 | (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-" |
| 214 | version "-source.tar.bz2")) |
| 215 | (sha256 |
| 216 | (base32 "0ab9lw056yf6y0rjmx3iirn5n59pmssqxf00fbmpyl6qsnpaja1d")))) |
| 217 | (build-system gnu-build-system) |
| 218 | ;; Bootstrap with CLISP. |
| 219 | (native-inputs |
| 220 | `(("clisp" ,clisp) |
| 221 | ("which" ,which) |
| 222 | ("inetutils" ,inetutils) ;for hostname(1) |
| 223 | ("ed" ,ed))) |
| 224 | (arguments |
| 225 | '(#:phases |
| 226 | (modify-phases %standard-phases |
| 227 | (delete 'configure) |
| 228 | (add-before 'build 'patch-unix-tool-paths |
| 229 | (lambda* (#:key outputs inputs #:allow-other-keys) |
| 230 | (let ((out (assoc-ref outputs "out")) |
| 231 | (bash (assoc-ref inputs "bash")) |
| 232 | (coreutils (assoc-ref inputs "coreutils")) |
| 233 | (ed (assoc-ref inputs "ed"))) |
| 234 | (define (quoted-path input path) |
| 235 | (string-append "\"" input path "\"")) |
| 236 | ;; Patch absolute paths in string literals. Note that this |
| 237 | ;; occurs in some .sh files too (which contain Lisp code). Use |
| 238 | ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded. |
| 239 | (with-fluids ((%default-port-encoding #f)) |
| 240 | (substitute* (find-files "." "\\.(lisp|sh)$") |
| 241 | (("\"/bin/sh\"") (quoted-path bash "/bin/sh")) |
| 242 | (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env")) |
| 243 | (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat")) |
| 244 | (("\"/bin/ed\"") (quoted-path ed "/bin/ed")) |
| 245 | (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo")) |
| 246 | (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname")))) |
| 247 | ;; This one script has a non-string occurrence of /bin/sh. |
| 248 | (substitute* '("tests/foreign.test.sh") |
| 249 | ;; Leave whitespace so we don't match the shebang. |
| 250 | ((" /bin/sh ") " sh ")) |
| 251 | ;; This file contains a module that can create executable files |
| 252 | ;; which depend on the presence of SBCL. It generates shell |
| 253 | ;; scripts doing "exec sbcl ..." to achieve this. We patch both |
| 254 | ;; the shebang and the reference to "sbcl", tying the generated |
| 255 | ;; executables to the exact SBCL package that generated them. |
| 256 | (substitute* '("contrib/sb-executable/sb-executable.lisp") |
| 257 | (("/bin/sh") (string-append bash "/bin/sh")) |
| 258 | (("exec sbcl") (string-append "exec " out "/bin/sbcl"))) |
| 259 | ;; Disable some tests that fail in our build environment. |
| 260 | (substitute* '("contrib/sb-bsd-sockets/tests.lisp") |
| 261 | ;; This requires /etc/protocols. |
| 262 | (("\\(deftest get-protocol-by-name/error" all) |
| 263 | (string-append "#+nil ;disabled by Guix\n" all))) |
| 264 | (substitute* '("contrib/sb-posix/posix-tests.lisp") |
| 265 | ;; These assume some users/groups which we don't have. |
| 266 | (("\\(deftest pwent\\.[12]" all) |
| 267 | (string-append "#+nil ;disabled by Guix\n" all)) |
| 268 | (("\\(deftest grent\\.[12]" all) |
| 269 | (string-append "#+nil ;disabled by Guix\n" all)))))) |
| 270 | (replace 'build |
| 271 | (lambda* (#:key outputs #:allow-other-keys) |
| 272 | (setenv "CC" "gcc") |
| 273 | (zero? (system* "sh" "make.sh" "clisp" |
| 274 | (string-append "--prefix=" |
| 275 | (assoc-ref outputs "out")))))) |
| 276 | (replace 'install |
| 277 | (lambda _ |
| 278 | (zero? (system* "sh" "install.sh"))))) |
| 279 | ;; No 'check' target, though "make.sh" (build phase) runs tests. |
| 280 | #:tests? #f)) |
| 281 | (home-page "http://www.sbcl.org/") |
| 282 | (synopsis "Common Lisp implementation") |
| 283 | (description "Steel Bank Common Lisp (SBCL) is a high performance Common |
| 284 | Lisp compiler. In addition to the compiler and runtime system for ANSI Common |
| 285 | Lisp, it provides an interactive environment including a debugger, a |
| 286 | statistical profiler, a code coverage tool, and many other extensions.") |
| 287 | ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT |
| 288 | ;; loop macro has its own license. See COPYING file for further notes. |
| 289 | (license (list license:public-domain license:bsd-2 |
| 290 | (license:x11-style "file://src/code/loop.lisp"))))) |
| 291 | |
| 292 | (define-public ccl |
| 293 | (package |
| 294 | (name "ccl") |
| 295 | (version "1.10") |
| 296 | (source #f) |
| 297 | (build-system gnu-build-system) |
| 298 | ;; CCL consists of a "lisp kernel" and "heap image", both of which are |
| 299 | ;; shipped in precompiled form in source tarballs. The former is a C |
| 300 | ;; program which we can rebuild from scratch, but the latter cannot be |
| 301 | ;; generated without an already working copy of CCL, and is platform |
| 302 | ;; dependent, so we need to fetch the correct tarball for the platform. |
| 303 | (inputs |
| 304 | `(("ccl" |
| 305 | ,(origin |
| 306 | (method url-fetch) |
| 307 | (uri (string-append |
| 308 | "ftp://ftp.clozure.com/pub/release/1.10/ccl-" version "-" |
| 309 | (match (%current-system) |
| 310 | ((or "i686-linux" "x86_64-linux") "linuxx86") |
| 311 | ("armhf-linux" "linuxarm") |
| 312 | ;; Prevent errors when querying this package on unsupported |
| 313 | ;; platforms, e.g. when running "guix package --search=" |
| 314 | (_ "UNSUPPORTED")) |
| 315 | ".tar.gz")) |
| 316 | (sha256 |
| 317 | (base32 |
| 318 | (match (%current-system) |
| 319 | ((or "i686-linux" "x86_64-linux") |
| 320 | "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc") |
| 321 | ("armhf-linux" |
| 322 | "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh") |
| 323 | (_ "")))))))) |
| 324 | (native-inputs |
| 325 | `(("m4" ,m4) |
| 326 | ("subversion" ,subversion))) |
| 327 | (arguments |
| 328 | `(#:tests? #f ;no 'check' target |
| 329 | #:phases |
| 330 | (alist-replace |
| 331 | 'unpack |
| 332 | (lambda* (#:key inputs #:allow-other-keys) |
| 333 | (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl"))) |
| 334 | (begin (chdir "ccl") #t))) |
| 335 | (alist-delete |
| 336 | 'configure |
| 337 | (alist-cons-before |
| 338 | 'build 'pre-build |
| 339 | ;; Enter the source directory for the current platform's lisp |
| 340 | ;; kernel, and run 'make clean' to remove the precompiled one. |
| 341 | (lambda _ |
| 342 | (chdir (string-append |
| 343 | "lisp-kernel/" |
| 344 | ,(match (or (%current-target-system) (%current-system)) |
| 345 | ("i686-linux" "linuxx8632") |
| 346 | ("x86_64-linux" "linuxx8664") |
| 347 | ("armhf-linux" "linuxarm") |
| 348 | ;; Prevent errors when querying this package |
| 349 | ;; on unsupported platforms, e.g. when running |
| 350 | ;; "guix package --search=" |
| 351 | (_ "UNSUPPORTED")))) |
| 352 | (substitute* '("Makefile") |
| 353 | (("/bin/rm") "rm")) |
| 354 | (setenv "CC" "gcc") |
| 355 | (zero? (system* "make" "clean"))) |
| 356 | ;; XXX Do we need to recompile the heap image as well for Guix? |
| 357 | ;; For now just use the one we already got in the tarball. |
| 358 | (alist-replace |
| 359 | 'install |
| 360 | (lambda* (#:key outputs inputs #:allow-other-keys) |
| 361 | ;; The lisp kernel built by running 'make' in lisp-kernel/$system |
| 362 | ;; is put back into the original directory, so go back. The heap |
| 363 | ;; image is there as well. |
| 364 | (chdir "../..") |
| 365 | (let* ((out (assoc-ref outputs "out")) |
| 366 | (libdir (string-append out "/lib/")) |
| 367 | (bindir (string-append out "/bin/")) |
| 368 | (wrapper (string-append bindir "ccl")) |
| 369 | (bash (assoc-ref inputs "bash")) |
| 370 | (kernel |
| 371 | ,(match (or (%current-target-system) (%current-system)) |
| 372 | ("i686-linux" "lx86cl") |
| 373 | ("x86_64-linux" "lx86cl64") |
| 374 | ("armhf-linux" "armcl") |
| 375 | ;; Prevent errors when querying this package |
| 376 | ;; on unsupported platforms, e.g. when running |
| 377 | ;; "guix package --search=" |
| 378 | (_ "UNSUPPORTED"))) |
| 379 | (heap (string-append kernel ".image"))) |
| 380 | (mkdir-p libdir) |
| 381 | (mkdir-p bindir) |
| 382 | (copy-file kernel (string-append libdir kernel)) |
| 383 | (copy-file heap (string-append libdir heap)) |
| 384 | (with-output-to-file wrapper |
| 385 | (lambda () |
| 386 | (display |
| 387 | (string-append |
| 388 | "#!" bash "/bin/sh\n" |
| 389 | "if [ -z \"$CCL_DEFAULT_DIRECTORY\" ]; then\n" |
| 390 | " CCL_DEFAULT_DIRECTORY=" libdir "\n" |
| 391 | "fi\n" |
| 392 | "export CCL_DEFAULT_DIRECTORY\n" |
| 393 | "exec " libdir kernel "\n")))) |
| 394 | (chmod wrapper #o755))) |
| 395 | %standard-phases)))))) |
| 396 | (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")) |
| 397 | (home-page "http://ccl.clozure.com/") |
| 398 | (synopsis "Common Lisp implementation") |
| 399 | (description "Clozure CL (often called CCL for short) is a Common Lisp |
| 400 | implementation featuring fast compilation speed, native threads, a precise, |
| 401 | generational, compacting garbage collector, and a convenient foreign-function |
| 402 | interface.") |
| 403 | ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL |
| 404 | ;; applies to Lisp code according to them. |
| 405 | (license (list license:lgpl2.1 |
| 406 | license:clarified-artistic)))) ;TRIVIAL-LDAP package |