Re: Best practice for extracting information from a makefile

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

 



On Tue, Aug 16, 2011 at 11:27 AM, Michael Schwendt <mschwendt@xxxxxxxxx> wrote:
> On Tue, 16 Aug 2011 10:38:43 -0500, RS (Richard) wrote:
>
>> > cd %{buildroot}%{libdir}
>> > ldconfig -n $(pwd)
>> > ln -s %{name}.so.? %{name}.so
>> > cd -
>>
>> Wouldn't that create a symlink of a symlink?
>
> That isn't a problem, is it? All that matters is that the final symlink would
> point at a usable library the build-time linker can load

No, not a technical problem. Just inelegant :)


> Both types of symlinks exist in Fedora packages.
> You could
>
>  shopt -s failglob
>  ln -s %{name}.so.*.* %{name}.so
>
> enforcing existence of a fully versioned library, and else an error.
> All that matters is that the final symlink would point at a usable
> library.

Interesting, I've never messed with shopt before.


[snip]
> Enjoy it if it works for you. :)
> Note though that if the make command fails, you would end up with an
> empty $LIBNAME and a  %{name}.so -> %{name}.so  most likely, so some guard
> in the spec file would be beneficial.

I wanted a bit more informative error in case of failure and tried this:

# Extract library name from makefile
LIBNAME=$(make -f Makefile -f - <<<'lib_so:; @echo $(lib_so)' lib_so)
# Make sure LIBNAME is set and not null
: ${LIBNAME:?"LIBNAME variable could not be set."}

# Create symbolic link for -devel subpackage.
ldconfig -n %{buildroot}%{_libdir}
pushd %{buildroot}%{_libdir}
ln -s $LIBNAME %{name}.so
popd

Thanks,
Richard
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux