You are not logged in.

#1 2023-08-08 00:01:29

Poisson Aerohead
Member
Registered: 2013-04-09
Posts: 8

Run ldconfig for a library package

Hi, this may be a bit noobish to ask, but I am installing an open source math tool onto my machine. I always install everything that goes somewhere other than my home directory via a pacman package for ease of tracking and removal. I am trying to get the conventions right for shared libraries.

I gave the executable a real name as described here. My understanding is that running ldconfig will add the "soname" as a symlink. I can then add the linker name myself with ln -s.

I have found this example from the Archlinux glibc package. I can see how there is a post_upgrade() function that theoretically is calling ldconfig (I am not quite sure what the "-r ." argument to change the root is for). The file glibc.install is referred to in the PKGBUILD during the package_glibc() function by install=glibc.install, but I do not see any other usage in the file.

I guess my question is how I get the install scripts into the package and get them to run upon installation? In particular, what is best practices for the packaging and installation of a shared library? Lastly, what is the best way to get the linker name set up after installation? I figured out how to parse the Major.Minor from the pkgver variable, but then realized that pkgver is defined for makepkg run time, not pacman run time.

I guess I have experience with using makepkg to make a package for myself, but I have never needed to modify any of the default behavior, so I don't know how to get pacman to do things like run ldconfig or set up certain symlinks.

Thank you for any help.

Offline

#2 2023-08-08 00:16:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,923
Website

Re: Run ldconfig for a library package

I think you're asking all the wrong questions and approaching this completely wrong.

Your makefile (or similar build tools) creates the library and any links to it.  That's it.  The soname is embeded in the libary by the linker at compile time (well, link time really).  This would typically also then be used as the file name for that library.

The major / minor version numbers are determined by the software itself, not the PKGBUILD.  These would typically be the first components in the package version, but these come from the upstream source to be used in the package version, not vice versa.

What library are you trying to package?

Last edited by Trilby (2023-08-08 00:19:18)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-08-08 00:47:35

Poisson Aerohead
Member
Registered: 2013-04-09
Posts: 8

Re: Run ldconfig for a library package

Trilby wrote:

Your makefile (or similar build tools) creates the library and any links to it.  That's it.

OK, I certainly can do that. I know it is a bit dated, but I was referring to the linked description given at TLDP. This seemed to complicate things a bit. Age aside, the fact that the Archlinux glibc package is running ldconfig does support what TLDP says somewhat.

That said, I can certainly have the makefile put all the symlinks in place and skip any post installation hooks (ldconfig or otherwise). I already know how to do that. I was curious whether this was considered bad form or not.

Offline

#4 2023-08-08 01:46:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,923
Website

Re: Run ldconfig for a library package

I can't speak to why that command is used in glibc's post install script, but why are you focused on that singular example?  Look at pretty much any other library package and you will not see that.  That is not a standard requirement / expectation of packaging libraries.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2023-08-08 01:59:08

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,439
Website

Re: Run ldconfig for a library package

Glibc is special and needs ldconfig run immediately so that any new processes use the new cache.

For all other libraries, pacman handles this.

Online

#6 2023-08-08 17:08:33

Poisson Aerohead
Member
Registered: 2013-04-09
Posts: 8

Re: Run ldconfig for a library package

I'm not really focusing on it, I was searching for "pacman ldconfig" and that is what I found. Like I said, everything is easier if I can have my Makefile handle generating the symlinks. What is described at TLDP is a bit confusing,

Does pacman always know to run ldconfig, or is there something I have to do during packaging to cause that to happen?

Offline

#7 2023-08-09 19:04:04

loqs
Member
Registered: 2014-03-06
Posts: 17,764

Re: Run ldconfig for a library package

Poisson Aerohead wrote:

Like I said, everything is easier if I can have my Makefile handle generating the symlinks.

There will be no issues with doing that.

Poisson Aerohead wrote:

Does pacman always know to run ldconfig, or is there something I have to do during packaging to cause that to happen?

Nothing needs to be done during packaging and nothing special in the PKGBUILD.

Offline

Board footer

Powered by FluxBB