gnu: bzip2: Use 'modify-phases' syntax.

* gnu/packages/compression.scm (bzip2)[arguments]: Use 'modify-phases' syntax.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
This commit is contained in:
Christopher Baines 2017-05-16 21:36:31 +01:00 committed by Marius Bakke
parent 664ac384be
commit 03bc86b8f4
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 60 additions and 72 deletions

View File

@ -207,34 +207,6 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in
(home-page "https://www.gnu.org/software/gzip/"))) (home-page "https://www.gnu.org/software/gzip/")))
(define-public bzip2 (define-public bzip2
(let ((build-shared-lib
;; Build a shared library.
'(lambda* (#:key inputs #:allow-other-keys)
(patch-makefile-SHELL "Makefile-libbz2_so")
(zero? (system* "make" "-f" "Makefile-libbz2_so"))))
(install-shared-lib
'(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(libdir (string-append out "/lib")))
(for-each (lambda (file)
(let ((base (basename file)))
(format #t "installing `~a' to `~a'~%"
base libdir)
(copy-file file
(string-append libdir "/" base))))
(find-files "." "^libbz2\\.so")))))
(set-cross-environment
'(lambda* (#:key target #:allow-other-keys)
(substitute* (find-files "." "Makefile")
(("CC=.*$")
(string-append "CC = " target "-gcc\n"))
(("AR=.*$")
(string-append "AR = " target "-ar\n"))
(("RANLIB=.*$")
(string-append "RANLIB = " target "-ranlib\n"))
(("^all:(.*)test" _ prerequisites)
;; Remove 'all' -> 'test' dependency.
(string-append "all:" prerequisites "\n"))))))
(package (package
(name "bzip2") (name "bzip2")
(version "1.0.6") (version "1.0.6")
@ -251,22 +223,38 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in
(guix build utils) (guix build utils)
(srfi srfi-1)) (srfi srfi-1))
#:phases #:phases
,(if (%current-target-system) (modify-phases %standard-phases
(replace 'configure
(lambda* (#:key target #:allow-other-keys)
(if ,(%current-target-system)
;; Cross-compilation: use the cross tools. ;; Cross-compilation: use the cross tools.
`(alist-cons-before (substitute* (find-files "." "Makefile")
'build 'build-shared-lib ,build-shared-lib (("CC=.*$")
(alist-cons-after (string-append "CC = " target "-gcc\n"))
'install 'install-shared-lib ,install-shared-lib (("AR=.*$")
(alist-replace 'configure ,set-cross-environment (string-append "AR = " target "-ar\n"))
%standard-phases))) (("RANLIB=.*$")
(string-append "RANLIB = " target "-ranlib\n"))
;; Native compilation: build the shared library. (("^all:(.*)test" _ prerequisites)
`(alist-cons-before ;; Remove 'all' -> 'test' dependency.
'build 'build-shared-lib ,build-shared-lib (string-append "all:" prerequisites "\n")))
(alist-cons-after #t)))
'install 'install-shared-lib ,install-shared-lib (add-before 'build 'build-shared-lib
(alist-delete 'configure %standard-phases)))) (lambda* (#:key inputs #:allow-other-keys)
(patch-makefile-SHELL "Makefile-libbz2_so")
(zero? (system* "make" "-f" "Makefile-libbz2_so"))))
(add-after 'install 'install-shared-lib
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(libdir (string-append out "/lib")))
(for-each (lambda (file)
(let ((base (basename file)))
(format #t "installing `~a' to `~a'~%"
base libdir)
(copy-file file
(string-append libdir "/" base))))
(find-files "." "^libbz2\\.so")))
#t)))
#:make-flags (list (string-append "PREFIX=" #:make-flags (list (string-append "PREFIX="
(assoc-ref %outputs "out"))) (assoc-ref %outputs "out")))
@ -284,7 +272,7 @@ being around twice as fast at compression and six times faster at
decompression.") decompression.")
(license (license:non-copyleft "file://LICENSE" (license (license:non-copyleft "file://LICENSE"
"See LICENSE in the distribution.")) "See LICENSE in the distribution."))
(home-page "http://www.bzip.org/")))) (home-page "http://www.bzip.org/")))
(define-public lbzip2 (define-public lbzip2
(package (package