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,84 +207,72 @@ 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 (package
;; Build a shared library. (name "bzip2")
'(lambda* (#:key inputs #:allow-other-keys) (version "1.0.6")
(patch-makefile-SHELL "Makefile-libbz2_so") (source (origin
(zero? (system* "make" "-f" "Makefile-libbz2_so")))) (method url-fetch)
(install-shared-lib (uri (string-append "http://www.bzip.org/" version "/bzip2-"
'(lambda* (#:key outputs #:allow-other-keys) version ".tar.gz"))
(let* ((out (assoc-ref outputs "out")) (sha256
(libdir (string-append out "/lib"))) (base32
(for-each (lambda (file) "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
(let ((base (basename file))) (build-system gnu-build-system)
(format #t "installing `~a' to `~a'~%" (arguments
base libdir) `(#:modules ((guix build gnu-build-system)
(copy-file file (guix build utils)
(string-append libdir "/" base)))) (srfi srfi-1))
(find-files "." "^libbz2\\.so"))))) #:phases
(set-cross-environment (modify-phases %standard-phases
'(lambda* (#:key target #:allow-other-keys) (replace 'configure
(substitute* (find-files "." "Makefile") (lambda* (#:key target #:allow-other-keys)
(("CC=.*$") (if ,(%current-target-system)
(string-append "CC = " target "-gcc\n")) ;; Cross-compilation: use the cross tools.
(("AR=.*$") (substitute* (find-files "." "Makefile")
(string-append "AR = " target "-ar\n")) (("CC=.*$")
(("RANLIB=.*$") (string-append "CC = " target "-gcc\n"))
(string-append "RANLIB = " target "-ranlib\n")) (("AR=.*$")
(("^all:(.*)test" _ prerequisites) (string-append "AR = " target "-ar\n"))
;; Remove 'all' -> 'test' dependency. (("RANLIB=.*$")
(string-append "all:" prerequisites "\n")))))) (string-append "RANLIB = " target "-ranlib\n"))
(package (("^all:(.*)test" _ prerequisites)
(name "bzip2") ;; Remove 'all' -> 'test' dependency.
(version "1.0.6") (string-append "all:" prerequisites "\n")))
(source (origin #t)))
(method url-fetch) (add-before 'build 'build-shared-lib
(uri (string-append "http://www.bzip.org/" version "/bzip2-" (lambda* (#:key inputs #:allow-other-keys)
version ".tar.gz")) (patch-makefile-SHELL "Makefile-libbz2_so")
(sha256 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
(base32 (add-after 'install 'install-shared-lib
"1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152")))) (lambda* (#:key outputs #:allow-other-keys)
(build-system gnu-build-system) (let* ((out (assoc-ref outputs "out"))
(arguments (libdir (string-append out "/lib")))
`(#:modules ((guix build gnu-build-system) (for-each (lambda (file)
(guix build utils) (let ((base (basename file)))
(srfi srfi-1)) (format #t "installing `~a' to `~a'~%"
#:phases base libdir)
,(if (%current-target-system) (copy-file file
(string-append libdir "/" base))))
(find-files "." "^libbz2\\.so")))
#t)))
;; Cross-compilation: use the cross tools. #:make-flags (list (string-append "PREFIX="
`(alist-cons-before (assoc-ref %outputs "out")))
'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. ;; Don't attempt to run the tests when cross-compiling.
`(alist-cons-before ,@(if (%current-target-system)
'build 'build-shared-lib ,build-shared-lib '(#:tests? #f)
(alist-cons-after '())))
'install 'install-shared-lib ,install-shared-lib (synopsis "High-quality data compression program")
(alist-delete 'configure %standard-phases)))) (description
"bzip2 is a freely available, patent free (see below), high-quality data
#:make-flags (list (string-append "PREFIX="
(assoc-ref %outputs "out")))
;; Don't attempt to run the tests when cross-compiling.
,@(if (%current-target-system)
'(#:tests? #f)
'())))
(synopsis "High-quality data compression program")
(description
"bzip2 is a freely available, patent free (see below), high-quality data
compressor. It typically compresses files to within 10% to 15% of the best compressor. It typically compresses files to within 10% to 15% of the best
available techniques (the PPM family of statistical compressors), whilst available techniques (the PPM family of statistical compressors), whilst
being around twice as fast at compression and six times faster at 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