bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30006: bzip2 does not provide libbz2.so


From: Ludovic Courtès
Subject: bug#30006: bzip2 does not provide libbz2.so
Date: Tue, 27 Mar 2018 09:32:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello Marius,

Marius Bakke <address@hidden> skribis:

> Ludovic Courtès <address@hidden> 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?

Sounds reasonable to me.  I have a suggestion:

> From 6c903b1da1ab64c4f52581c7debb82b65a6afb0e Mon Sep 17 00:00:00 2001
> From: Marius Bakke <address@hidden>
> 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.

[...]

> +               (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)))

To avoid ‘set!’, I’d write it along these lines:

  ;; Create symlinks libbz2.so.1.2 -> libbz2.so.1, 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)))))

Otherwise LGTM.

Thank you!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]