From: Marius Bakke <mbakke@fastmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 30006@debbugs.gnu.org
Subject: bug#30006: bzip2 does not provide libbz2.so
Date: Mon, 26 Mar 2018 19:36:35 +0200 [thread overview]
Message-ID: <87bmfakacc.fsf@fastmail.com> (raw)
In-Reply-To: <87zi2xjtm9.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 728 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> There’s no such function, which is unfortunate. But I agree it’s nicer
> to preserve symlinks in this case.
>
> Perhaps we should actually do:
>
> (with-directory-excursion libdir
> (symlink … "libbz2.so"))
Thanks for the feedback everyone. I settled on a slightly different
solution, that first extracts the (full) soversion from the built
library, then creates symlinks for each "sub-version".
It assumes that the major version is "1". That could be circumvented
with a regex, but I'm not sure if it's worth the effort.
As an added bonus, this also creates "libbz2.so.1" which was missing too.
WDYT of this approach? Can it be made simpler?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-bzip2-Provide-libbz2.so-and-libbz2.so.1.patch --]
[-- Type: text/x-patch, Size: 2831 bytes --]
From 6c903b1da1ab64c4f52581c7debb82b65a6afb0e Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Mon, 26 Mar 2018 19:24:59 +0200
Subject: [PATCH] gnu: bzip2: Provide libbz2.so and libbz2.so.1.
Fixes <https://bugs.gnu.org/30006>.
* 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
next prev parent reply other threads:[~2018-03-26 17:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-06 13:29 bug#30006: bzip2 does not provide libbz2.so Ludovic Courtès
2018-03-23 12:02 ` Marius Bakke
2018-03-23 12:19 ` Tobias Geerinckx-Rice
2018-03-23 12:38 ` Marius Bakke
2018-03-24 17:01 ` Ludovic Courtès
2018-03-26 17:36 ` Marius Bakke [this message]
2018-03-27 7:32 ` Ludovic Courtès
2018-03-27 20:49 ` Marius Bakke
2018-03-23 20:50 ` Mark H Weaver
2018-03-24 1:17 ` Tobias Geerinckx-Rice
2018-03-24 16:54 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmfakacc.fsf@fastmail.com \
--to=mbakke@fastmail.com \
--cc=30006@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).