From 6c903b1da1ab64c4f52581c7debb82b65a6afb0e Mon Sep 17 00:00:00 2001
From: Marius Bakke
Date: Mon, 26 Mar 2018 19:24:59 +0200
Subject: [PATCH] gnu: bzip2: Provide libbz2.so and libbz2.so.1.
Fixes .
* gnu/packages/compression.scm (bzip2)[arguments]: Rework
INSTALL-SHARED-LIBS-PHASE to manage all library symlinks.
---
gnu/packages/compression.scm | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 3bcc09bd3..7c853e432 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -271,15 +271,28 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in
(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))
+ (libdir (string-append out "/lib"))
+ ;; Find the actual library (e.g. "libbz2.so.1.0.6").
+ (lib (string-drop
+ (car (find-files
+ "."
+ (lambda (file stat)
+ (and (string-prefix? "./libbz2.so.1" file)
+ (eq? 'regular (stat:type stat))))))
+ 2))
+ (soversion (string-drop lib (string-length "libbz2.so."))))
+ ;; The Makefile above does not have an 'install' target, nor
+ ;; does it create the versioned symlinks, so we handle it here.
+ (install-file lib libdir)
+ (with-directory-excursion libdir
+ (let ((libs (string-split soversion #\.))
+ (base "libbz2.so"))
+ (map (lambda (so)
+ (let ((next (string-append base "." so)))
+ (symlink next base)
+ (set! base next)))
+ libs)))
+ #t)))
(add-after 'install-shared-lib 'patch-scripts
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
--
2.16.2