From 2b786f6753b1997106462f63060bcc3cfbaf1584 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Tue, 27 Mar 2018 15:37:08 +0200 Subject: 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, 23 insertions(+), 8 deletions(-) (limited to 'gnu/packages/compression.scm') diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index d41c56f96c..77ab683127 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -13,7 +13,7 @@ ;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice ;;; Copyright © 2016 David Craven ;;; Copyright © 2016 Kei Kebreau -;;; Copyright © 2016 Marius Bakke +;;; Copyright © 2016, 2018 Marius Bakke ;;; Copyright © 2017 Nils Gillmann ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis ;;; Copyright © 2017 Theodoros Foradis @@ -269,14 +269,29 @@ file; as a result, it is often used in conjunction with \"tar\", resulting in (invoke "make" "-f" "Makefile-libbz2_so"))) (add-after 'install 'install-shared-lib (lambda* (#:key outputs #:allow-other-keys) + ;; The Makefile above does not have an 'install' target, nor does + ;; it create all the (un)versioned symlinks, so we handle it here. (let* ((out (assoc-ref outputs "out")) - (libdir (string-append out "/lib"))) - (for-each (lambda (file) - (format #t "installing `~a' to `~a'~%" - (basename file) libdir) - (install-file file libdir)) - (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" file) + (eq? 'regular (stat:type stat)))))) + 2)) + (soversion (string-drop lib (string-length "libbz2.so.")))) + (install-file lib libdir) + (with-directory-excursion libdir + ;; Create symlinks libbz2.so.1 -> libbz2.so.1.0, etc. + (let loop ((base "libbz2.so") + (numbers (string-split soversion #\.))) + (unless (null? numbers) + (let ((so-file (string-append base "." (car numbers)))) + (symlink so-file base) + (loop so-file (cdr numbers)))))) + #t))) (add-after 'install-shared-lib 'patch-scripts (lambda* (#:key outputs inputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) -- cgit 1.4.1