From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d58IL-000566-9T for guix-patches@gnu.org; Mon, 01 May 2017 06:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d58II-0000y0-Cx for guix-patches@gnu.org; Mon, 01 May 2017 06:11:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d58II-0000xn-9S for guix-patches@gnu.org; Mon, 01 May 2017 06:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d58II-0006Hv-5s for guix-patches@gnu.org; Mon, 01 May 2017 06:11:02 -0400 Subject: bug#26730: [PATCH 1/2] gnu: bzip2: Use 'modify-phases' syntax. References: In-Reply-To: Resent-Message-ID: From: Christopher Baines Date: Mon, 1 May 2017 11:10:14 +0100 Message-Id: <20170501101015.30567-1-mail@cbaines.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26730@debbugs.gnu.org * gnu/packages/compression.scm (bzip2)[arguments]: Use 'modify-phases' syntax. --- gnu/packages/compression.scm | 130 +++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 72 deletions(-) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index 4793755c2..031ecaad4 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -207,84 +207,70 @@ 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") - (source (origin - (method url-fetch) - (uri (string-append "http://www.bzip.org/" version "/bzip2-" - version ".tar.gz")) - (sha256 - (base32 - "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152")))) - (build-system gnu-build-system) - (arguments - `(#:modules ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-1)) - #:phases - ,(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)))) + (package + (name "bzip2") + (version "1.0.6") + (source (origin + (method url-fetch) + (uri (string-append "http://www.bzip.org/" version "/bzip2-" + version ".tar.gz")) + (sha256 + (base32 + "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152")))) + (build-system gnu-build-system) + (arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-1)) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key target #:allow-other-keys) + (if ,(%current-target-system) + ;; Cross-compilation: use the cross tools. + (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")))))) + (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")))))) - #:make-flags (list (string-append "PREFIX=" - (assoc-ref %outputs "out"))) + #: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 + ;; 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 available techniques (the PPM family of statistical compressors), whilst 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/")))) + (license (license:non-copyleft "file://LICENSE" + "See LICENSE in the distribution.")) + (home-page "http://www.bzip.org/"))) (define-public lbzip2 (package -- 2.12.2