gnu: bzip2: Simplify phase.

* gnu/packages/compression.scm (bzip2)[arguments]: Use SCANDIR instead of
FIND-FILES when locating the shared library.
This commit is contained in:
Marius Bakke 2018-07-14 22:11:45 +02:00
parent 49b92a2414
commit 5212c52ce5
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 10 additions and 10 deletions

View File

@ -246,6 +246,7 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in
(arguments (arguments
`(#:modules ((guix build gnu-build-system) `(#:modules ((guix build gnu-build-system)
(guix build utils) (guix build utils)
(ice-9 ftw)
(srfi srfi-1)) (srfi srfi-1))
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
@ -274,19 +275,18 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in
;; it create all the (un)versioned symlinks, so we handle it here. ;; it create all the (un)versioned symlinks, so we handle it here.
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(libdir (string-append out "/lib")) (libdir (string-append out "/lib"))
;; Find the actual library (e.g. "libbz2.so.1.0.6"). (soname "libbz2.so")
(lib (string-drop ;; Locate the built library (e.g. "libbz2.so.1.0.6").
(car (find-files (lib (car (scandir "."
"." (lambda (file)
(lambda (file stat) (and (string-prefix? soname file)
(and (string-prefix? "./libbz2.so" file) (eq? 'regular
(eq? 'regular (stat:type stat)))))) (stat:type (lstat file))))))))
2)) (soversion (string-drop lib (+ 1 (string-length soname)))))
(soversion (string-drop lib (string-length "libbz2.so."))))
(install-file lib libdir) (install-file lib libdir)
(with-directory-excursion libdir (with-directory-excursion libdir
;; Create symlinks libbz2.so.1 -> libbz2.so.1.0, etc. ;; Create symlinks libbz2.so.1 -> libbz2.so.1.0, etc.
(let loop ((base "libbz2.so") (let loop ((base soname)
(numbers (string-split soversion #\.))) (numbers (string-split soversion #\.)))
(unless (null? numbers) (unless (null? numbers)
(let ((so-file (string-append base "." (car numbers)))) (let ((so-file (string-append base "." (car numbers))))