;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 John Darrington ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Federico Beffa ;;; Copyright © 2016, 2017 ng0 ;;; Copyright © 2016 Andy Patterson ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2017 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages lisp) #:use-module (gnu packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (gnu packages readline) #:use-module (gnu packages texinfo) #:use-module (gnu packages tex) #:use-module (gnu packages m4) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system asdf) #:use-module (guix build-system trivial) #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages fontutils) #:use-module (gnu packages maths) #: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 sdl) #:use-module (gnu packages libsigsegv) #:use-module (gnu packages linux) #:use-module (gnu packages admin) #:use-module (gnu packages ed) #:use-module (gnu packages gl) #:use-module (gnu packages gcc) #:use-module (gnu packages glib) #:use-module (gnu packages gettext) #:use-module (gnu packages m4) #:use-module (gnu packages pkg-config) #:use-module (gnu packages version-control) #:use-module (gnu packages xorg) #:use-module (ice-9 match) #:use-module (srfi srfi-1)) (define (asdf-substitutions lisp) ;; Prepend XDG_DATA_DIRS/LISP-bundle-systems to ASDF's ;; 'default-system-source-registry'. `((("\\(,dir \"systems/\"\\)\\)") (format #f "(,dir \"~a-bundle-systems\"))) ,@(loop :for dir :in (xdg-data-dirs \"common-lisp/\") :collect `(:directory (,dir \"systems\"))" ,lisp)))) (define-public sbcl-next (package (name "sbcl") (version "1.3.16") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-" version "-source.tar.bz2")) (sha256 (base32 "0qw8kcn66sr1k7ilm6i66dk3ybym722ccxa4xi8w7bkhgc0ripdp")) (modules '((guix build utils))) (snippet ;; Add sbcl-bundle-systems to 'default-system-source-registry'. `(substitute* "contrib/asdf/asdf.lisp" ,@(asdf-substitutions name))))) (build-system gnu-build-system) (outputs '("out" "doc")) ;; Bootstrap with CLISP. (native-inputs `(("clisp" ,clisp) ("which" ,which) ("inetutils" ,inetutils) ;for hostname(1) ("ed" ,ed) ("texlive" ,texlive) ("texinfo" ,texinfo))) (arguments '(#:phases (modify-phases %standard-phases (delete 'configure) (add-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). Use ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded. (with-fluids ((%default-port-encoding #f)) ;; The removed file is utf-16-be encoded, which gives substitute* ;; trouble. It does not contain references to the listed programs. (substitute* (delete "./tests/data/compile-file-pos-utf16be.lisp" (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)))))) (replace 'build (lambda* (#:key outputs #:allow-other-keys) (setenv "CC" "gcc") (zero? (system* "sh" "make.sh" "clisp" (string-append "--prefix=" (assoc-ref outputs "out")))))) (replace 'install (lambda _ (zero? (system* "sh" "install.sh")))) (add-after 'build 'build-doc (lambda _ (with-directory-excursion "doc/manual" (and (zero? (system* "make" "info")) (zero? (system* "make" "dist")))))) (add-after 'install 'install-doc (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (doc (assoc-ref outputs "doc")) (old-doc-dir (string-append out "/share/doc")) (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl"))) (rmdir (string-append old-doc-dir "/sbcl/html")) (mkdir-p new-doc/sbcl-dir) (copy-recursively (string-append old-doc-dir "/sbcl") new-doc/sbcl-dir) (delete-file-recursively old-doc-dir) #t)))) ;; No 'check' target, though "make.sh" (build phase) runs tests. #:tests? #f)) (native-search-paths (list (search-path-specification (variable "XDG_DATA_DIRS") (files '("share"))))) (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")))))