me
/
guix
Archived
1
0
Fork 0

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

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

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
master
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/")))
(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
(name "bzip2")
(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)
(srfi srfi-1))
#: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.
`(alist-cons-before
'build 'build-shared-lib ,build-shared-lib
(alist-cons-after
'install 'install-shared-lib ,install-shared-lib
(alist-replace 'configure ,set-cross-environment
%standard-phases)))
;; Native compilation: build the shared library.
`(alist-cons-before
'build 'build-shared-lib ,build-shared-lib
(alist-cons-after
'install 'install-shared-lib ,install-shared-lib
(alist-delete 'configure %standard-phases))))
(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")))
#t)))
(add-before 'build 'build-shared-lib
(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="
(assoc-ref %outputs "out")))
@ -284,7 +272,7 @@ being around twice as fast at compression and six times faster at
decompression.")
(license (license:non-copyleft "file://LICENSE"
"See LICENSE in the distribution."))
(home-page "http://www.bzip.org/"))))
(home-page "http://www.bzip.org/")))
(define-public lbzip2
(package