diff options
Diffstat (limited to 'gnu/packages/lisp.scm')
-rw-r--r-- | gnu/packages/lisp.scm | 304 |
1 files changed, 303 insertions, 1 deletions
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 0bacac47bf..5db3fa98f9 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 John Darrington <jmd@gnu.org> +;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,7 +27,19 @@ #:use-module (gnu packages m4) #:use-module (guix download) #:use-module (guix utils) - #:use-module (guix build-system gnu)) + #:use-module (guix build-system gnu) + #:use-module (gnu packages which) + #:use-module (gnu packages multiprecision) + #:use-module (gnu packages bdw-gc) + #:use-module (gnu packages libffi) + #:use-module (gnu packages libffcall) + #:use-module (gnu packages readline) + #:use-module (gnu packages libsigsegv) + #:use-module (gnu packages admin) + #:use-module (gnu packages ed) + #:use-module (gnu packages m4) + #:use-module (gnu packages version-control) + #:use-module (ice-9 match)) (define-public gcl (package @@ -81,3 +94,292 @@ stratified garbage collection strategy, a source-level debugger and a built-in interface to the Tk widget system.") (license license:lgpl2.0+))) +(define-public ecl + (package + (name "ecl") + (version "13.5.1") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/ecls/ecls/" + (version-major+minor version) + "/ecl-" version ".tgz")) + (sha256 + (base32 "18ic8w9sdl0dh3kmyc9lsrafikrd9cg1jkhhr25p9saz0v75f77r")))) + (build-system gnu-build-system) + (native-inputs `(("which" ,which))) + (inputs `(("gmp" ,gmp) + ("libatomic-ops" ,libatomic-ops) + ("libgc" ,libgc) + ("libffi" ,libffi))) + (arguments + '(#:phases + ;; The test-suite seems to assume that ECL is installed. So re-order + ;; the phases, then reference the installed executable. + (let* ((check-phase (assq-ref %standard-phases 'check)) + (rearranged-phases + (alist-cons-after 'install 'check check-phase + (alist-delete 'check %standard-phases)))) + (alist-cons-before + 'check 'pre-check + (lambda* (#:key outputs #:allow-other-keys) + (substitute* '("build/tests/Makefile") + (("ECL=ecl") + (string-append + "ECL=" (assoc-ref outputs "out") "/bin/ecl")))) + rearranged-phases)) + ;; Parallel builds explicitly not supported: + ;; http://sourceforge.net/p/ecls/bugs/98/ + #:parallel-build? #f + #:parallel-tests? #f)) + (home-page "http://ecls.sourceforge.net/") + (synopsis "Embeddable Common Lisp") + (description "ECL is an implementation of the Common Lisp language as +defined by the ANSI X3J13 specification. Its most relevant features are: a +bytecode compiler and interpreter, being able to compile Common Lisp with any +C/C++ compiler, being able to build standalone executables and libraries, and +supporting ASDF, Sockets, Gray streams, MOP, and other useful components.") + ;; Note that the file "Copyright" points to some files and directories + ;; which aren't under the lgpl2.0+ and instead contain many different, + ;; non-copyleft licenses. + (license license:lgpl2.0+))) + +(define-public clisp + (package + (name "clisp") + (version "2.49") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://gnu/clisp/release/" version + "/clisp-" version ".tar.gz")) + (sha256 + (base32 "0rp82nqp5362isl9i34rwgg04cidz7izljd9d85pqcw1qr964bxx")))) + (build-system gnu-build-system) + (inputs `(("libffcall" ,libffcall) + ("readline" ,readline) + ("libsigsegv" ,libsigsegv))) + (arguments + '(#:phases + (alist-cons-after + 'unpack 'patch-sh-and-pwd + (lambda _ + ;; The package is very messy with its references to "/bin/sh" and + ;; some other absolute paths to traditional tools. These appear in + ;; many places where our automatic patching misses them. Therefore + ;; we do the following, in this early (post-unpack) phase, to solve + ;; the problem from its root. + (substitute* (find-files "." "configure|Makefile") + (("/bin/sh") "sh")) + (substitute* '("src/clisp-link.in") + (("/bin/pwd") "pwd"))) + (alist-cons-before + 'build 'chdir-to-source + (lambda _ + ;; We are supposed to call make under the src sub-directory. + (chdir "src")) + %standard-phases)) + ;; Makefiles seem to have race conditions. + #:parallel-build? #f)) + (home-page "http://www.clisp.org/") + (synopsis "A Common Lisp implementation") + (description + "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a +high-level, object-oriented functional programming language. CLISP includes +an interpreter, a compiler, a debugger, and much more.") + ;; Website says gpl2+, COPYRIGHT file says gpl2; actual source files have + ;; a lot of gpl3+. (Also some parts are under non-copyleft licenses, such + ;; as CLX by Texas Instruments.) In that case gpl3+ wins out. + (license license:gpl3+))) + +(define-public sbcl + (package + (name "sbcl") + (version "1.2.8") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-" + version "-source.tar.bz2")) + (sha256 + (base32 "0ab9lw056yf6y0rjmx3iirn5n59pmssqxf00fbmpyl6qsnpaja1d")))) + (build-system gnu-build-system) + ;; Bootstrap with CLISP. + (native-inputs + `(("clisp" ,clisp) + ("which" ,which) + ("inetutils" ,inetutils) ;for hostname(1) + ("ed" ,ed))) + (arguments + '(#:phases + (alist-delete + 'configure + (alist-cons-before + 'build 'patch-unix-tool-paths + (lambda* (#:key outputs inputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (bash (assoc-ref inputs "bash")) + (coreutils (assoc-ref inputs "coreutils")) + (ed (assoc-ref inputs "ed"))) + (define (quoted-path input path) + (string-append "\"" input path "\"")) + ;; Patch absolute paths in string literals. Note that this + ;; occurs in some .sh files too (which contain Lisp code). + (substitute* (find-files "." "\\.(lisp|sh)$") + (("\"/bin/sh\"") (quoted-path bash "/bin/sh")) + (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env")) + (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat")) + (("\"/bin/ed\"") (quoted-path ed "/bin/ed")) + (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo")) + (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))) + ;; This one script has a non-string occurrence of /bin/sh. + (substitute* '("tests/foreign.test.sh") + ;; Leave whitespace so we don't match the shebang. + ((" /bin/sh ") " sh ")) + ;; This file contains a module that can create executable files + ;; which depend on the presence of SBCL. It generates shell + ;; scripts doing "exec sbcl ..." to achieve this. We patch both + ;; the shebang and the reference to "sbcl", tying the generated + ;; executables to the exact SBCL package that generated them. + (substitute* '("contrib/sb-executable/sb-executable.lisp") + (("/bin/sh") (string-append bash "/bin/sh")) + (("exec sbcl") (string-append "exec " out "/bin/sbcl"))) + ;; Disable some tests that fail in our build environment. + (substitute* '("contrib/sb-bsd-sockets/tests.lisp") + ;; This requires /etc/protocols. + (("\\(deftest get-protocol-by-name/error" all) + (string-append "#+nil ;disabled by Guix\n" all))) + (substitute* '("contrib/sb-posix/posix-tests.lisp") + ;; These assume some users/groups which we don't have. + (("\\(deftest pwent\\.[12]" all) + (string-append "#+nil ;disabled by Guix\n" all)) + (("\\(deftest grent\\.[12]" all) + (string-append "#+nil ;disabled by Guix\n" all))))) + (alist-replace + 'build + (lambda* (#:key outputs #:allow-other-keys) + (setenv "CC" "gcc") + (zero? (system* "sh" "make.sh" "clisp" + (string-append "--prefix=" + (assoc-ref outputs "out"))))) + (alist-replace + 'install + (lambda _ + (zero? (system* "sh" "install.sh"))) + %standard-phases)))) + ;; No 'check' target, though "make.sh" (build phase) runs tests. + #:tests? #f)) + (home-page "http://www.sbcl.org/") + (synopsis "Common Lisp implementation") + (description "Steel Bank Common Lisp (SBCL) is a high performance Common +Lisp compiler. In addition to the compiler and runtime system for ANSI Common +Lisp, it provides an interactive environment including a debugger, a +statistical profiler, a code coverage tool, and many other extensions.") + ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT + ;; loop macro has its own license. See COPYING file for further notes. + (license (list license:public-domain license:bsd-2 + (license:x11-style "file://src/code/loop.lisp"))))) + +(define-public ccl + (package + (name "ccl") + (version "1.10") + (source #f) + (build-system gnu-build-system) + ;; CCL consists of a "lisp kernel" and "heap image", both of which are + ;; shipped in precompiled form in source tarballs. The former is a C + ;; program which we can rebuild from scratch, but the latter cannot be + ;; generated without an already working copy of CCL, and is platform + ;; dependent, so we need to fetch the correct tarball for the platform. + (inputs + `(("ccl" + ,(origin + (method url-fetch) + (uri (string-append + "ftp://ftp.clozure.com/pub/release/1.10/ccl-" version "-" + (match (%current-system) + ((or "i686-linux" "x86_64-linux") "linuxx86") + ("armhf-linux" "linuxarm")) + ".tar.gz")) + (sha256 + (base32 + (match (%current-system) + ((or "i686-linux" "x86_64-linux") + "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc") + ("armhf" + "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh")))))))) + (native-inputs + `(("m4" ,m4) + ("subversion" ,subversion))) + (arguments + `(#:tests? #f ;no 'check' target + #:phases + (alist-replace + 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl"))) + (begin (chdir "ccl") #t))) + (alist-delete + 'configure + (alist-cons-before + 'build 'pre-build + ;; Enter the source directory for the current platform's lisp + ;; kernel, and run 'make clean' to remove the precompiled one. + (lambda _ + (chdir (string-append + "lisp-kernel/" + ,(match (or (%current-target-system) (%current-system)) + ("i686-linux" "linuxx8632") + ("x86_64-linux" "linuxx8664") + ("armhf-linux" "linuxarm")))) + (substitute* '("Makefile") + (("/bin/rm") "rm")) + (setenv "CC" "gcc") + (zero? (system* "make" "clean"))) + ;; XXX Do we need to recompile the heap image as well for Guix? + ;; For now just use the one we already got in the tarball. + (alist-replace + 'install + (lambda* (#:key outputs inputs #:allow-other-keys) + ;; The lisp kernel built by running 'make' in lisp-kernel/$system + ;; is put back into the original directory, so go back. The heap + ;; image is there as well. + (chdir "../..") + (let* ((out (assoc-ref outputs "out")) + (libdir (string-append out "/lib/")) + (bindir (string-append out "/bin/")) + (wrapper (string-append bindir "ccl")) + (bash (assoc-ref inputs "bash")) + (kernel + ,(match (or (%current-target-system) (%current-system)) + ("i686-linux" "lx86cl") + ("x86_64-linux" "lx86cl64") + ("armhf-linux" "armcl"))) + (heap (string-append kernel ".image"))) + (mkdir-p libdir) + (mkdir-p bindir) + (copy-file kernel (string-append libdir kernel)) + (copy-file heap (string-append libdir heap)) + (with-output-to-file wrapper + (lambda () + (display + (string-append + "#!" bash "/bin/sh\n" + "if [ -z \"$CCL_DEFAULT_DIRECTORY\" ]; then\n" + " CCL_DEFAULT_DIRECTORY=" libdir "\n" + "fi\n" + "export CCL_DEFAULT_DIRECTORY\n" + "exec " libdir kernel "\n")))) + (chmod wrapper #o755))) + %standard-phases)))))) + (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")) + (home-page "http://ccl.clozure.com/") + (synopsis "Common Lisp implementation") + (description "Clozure CL (often called CCL for short) is a Common Lisp +implementation featuring fast compilation speed, native threads, a precise, +generational, compacting garbage collector, and a convenient foreign-function +interface.") + ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL + ;; applies to Lisp code according to them. + (license (list license:lgpl2.1 + license:clarified-artistic)))) ;TRIVIAL-LDAP package |