gnu: sbcl: Convert to the 'modify-phases' syntax.

* gnu/packages/lisp.scm (sbcl): Do it.
This commit is contained in:
Federico Beffa 2015-12-31 18:36:52 +01:00
parent 85960693e4
commit 1ee131df42
1 changed files with 54 additions and 58 deletions

View File

@ -223,65 +223,61 @@ an interpreter, a compiler, a debugger, and much more.")
("ed" ,ed))) ("ed" ,ed)))
(arguments (arguments
'(#:phases '(#:phases
(alist-delete (modify-phases %standard-phases
'configure (delete 'configure)
(alist-cons-before (add-before 'build 'patch-unix-tool-paths
'build 'patch-unix-tool-paths (lambda* (#:key outputs inputs #:allow-other-keys)
(lambda* (#:key outputs inputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))
(let ((out (assoc-ref outputs "out")) (bash (assoc-ref inputs "bash"))
(bash (assoc-ref inputs "bash")) (coreutils (assoc-ref inputs "coreutils"))
(coreutils (assoc-ref inputs "coreutils")) (ed (assoc-ref inputs "ed")))
(ed (assoc-ref inputs "ed"))) (define (quoted-path input path)
(define (quoted-path input path) (string-append "\"" input path "\""))
(string-append "\"" input path "\"")) ;; Patch absolute paths in string literals. Note that this
;; Patch absolute paths in string literals. Note that this ;; occurs in some .sh files too (which contain Lisp code). Use
;; occurs in some .sh files too (which contain Lisp code). Use ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
;; ISO-8859-1 because some of the files are ISO-8859-1 encoded. (with-fluids ((%default-port-encoding #f))
(with-fluids ((%default-port-encoding #f)) (substitute* (find-files "." "\\.(lisp|sh)$")
(substitute* (find-files "." "\\.(lisp|sh)$") (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
(("\"/bin/sh\"") (quoted-path bash "/bin/sh")) (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
(("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env")) (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
(("\"/bin/cat\"") (quoted-path coreutils "/bin/cat")) (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
(("\"/bin/ed\"") (quoted-path ed "/bin/ed")) (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
(("\"/bin/echo\"") (quoted-path coreutils "/bin/echo")) (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
(("\"/bin/uname\"") (quoted-path coreutils "/bin/uname")))) ;; This one script has a non-string occurrence of /bin/sh.
;; This one script has a non-string occurrence of /bin/sh. (substitute* '("tests/foreign.test.sh")
(substitute* '("tests/foreign.test.sh") ;; Leave whitespace so we don't match the shebang.
;; Leave whitespace so we don't match the shebang. ((" /bin/sh ") " sh "))
((" /bin/sh ") " sh ")) ;; This file contains a module that can create executable files
;; This file contains a module that can create executable files ;; which depend on the presence of SBCL. It generates shell
;; which depend on the presence of SBCL. It generates shell ;; scripts doing "exec sbcl ..." to achieve this. We patch both
;; scripts doing "exec sbcl ..." to achieve this. We patch both ;; the shebang and the reference to "sbcl", tying the generated
;; the shebang and the reference to "sbcl", tying the generated ;; executables to the exact SBCL package that generated them.
;; executables to the exact SBCL package that generated them. (substitute* '("contrib/sb-executable/sb-executable.lisp")
(substitute* '("contrib/sb-executable/sb-executable.lisp") (("/bin/sh") (string-append bash "/bin/sh"))
(("/bin/sh") (string-append bash "/bin/sh")) (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
(("exec sbcl") (string-append "exec " out "/bin/sbcl"))) ;; Disable some tests that fail in our build environment.
;; Disable some tests that fail in our build environment. (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
(substitute* '("contrib/sb-bsd-sockets/tests.lisp") ;; This requires /etc/protocols.
;; This requires /etc/protocols. (("\\(deftest get-protocol-by-name/error" all)
(("\\(deftest get-protocol-by-name/error" all) (string-append "#+nil ;disabled by Guix\n" all)))
(string-append "#+nil ;disabled by Guix\n" all))) (substitute* '("contrib/sb-posix/posix-tests.lisp")
(substitute* '("contrib/sb-posix/posix-tests.lisp") ;; These assume some users/groups which we don't have.
;; These assume some users/groups which we don't have. (("\\(deftest pwent\\.[12]" all)
(("\\(deftest pwent\\.[12]" all) (string-append "#+nil ;disabled by Guix\n" all))
(string-append "#+nil ;disabled by Guix\n" all)) (("\\(deftest grent\\.[12]" all)
(("\\(deftest grent\\.[12]" all) (string-append "#+nil ;disabled by Guix\n" all))))))
(string-append "#+nil ;disabled by Guix\n" all))))) (replace 'build
(alist-replace (lambda* (#:key outputs #:allow-other-keys)
'build (setenv "CC" "gcc")
(lambda* (#:key outputs #:allow-other-keys) (zero? (system* "sh" "make.sh" "clisp"
(setenv "CC" "gcc") (string-append "--prefix="
(zero? (system* "sh" "make.sh" "clisp" (assoc-ref outputs "out"))))))
(string-append "--prefix=" (replace 'install
(assoc-ref outputs "out")))))
(alist-replace
'install
(lambda _ (lambda _
(zero? (system* "sh" "install.sh"))) (zero? (system* "sh" "install.sh")))))
%standard-phases)))) ;; No 'check' target, though "make.sh" (build phase) runs tests.
;; No 'check' target, though "make.sh" (build phase) runs tests. #:tests? #f))
#:tests? #f))
(home-page "http://www.sbcl.org/") (home-page "http://www.sbcl.org/")
(synopsis "Common Lisp implementation") (synopsis "Common Lisp implementation")
(description "Steel Bank Common Lisp (SBCL) is a high performance Common (description "Steel Bank Common Lisp (SBCL) is a high performance Common