[Exherbo-dev] PostgreSQL packge split and slotting

Thomas Berger loki at lokis-chaos.de
Fri Aug 24 10:09:03 UTC 2018


After some discussion on gitlab, i now provided also an exlib, 
to support the build of PostgreSQL extensions for multiple slots.

As one of the main concerns seems to be the split of the client from the main 
postgresql package, i want to be more verbose on the reasons behind that.

PostgreSQL ships a tool `pg_config`. This is used to build server extensions 
and client applications.

An example output of pg_config ( from a gentoo system, to demonstrate why this 
is a bad idea):

> ~ # pg_config
> BINDIR = /usr/lib64/postgresql-10/bin
> [...]
> INCLUDEDIR = /usr/include/postgresql-10
> PKGINCLUDEDIR = /usr/include/postgresql-10
> INCLUDEDIR-SERVER = /usr/include/postgresql-10/server
> LIBDIR = /usr/lib64/postgresql-10/lib64
> PKGLIBDIR = /usr/lib64/postgresql-10/lib64
> [...]
> PGXS = /usr/lib64/postgresql-10/lib64/pgxs/src/makefiles/pgxs.mk
> [...]
> LIBS = -lpgcommon -lpgport -lpthread -lxslt -lxml2 -lpam -lssl -lcrypto -lz 
-lreadline -lrt -lcrypt -ldl -lm  

The most important part is the `LIBDIR`.

If we use alternatives light to handle the PostgreSQL client binaries, and 
always link to the latest version we will always link against the library in 
the version specific directory, unless we either patch every single package or 
patch pg_config. And both are bad ideas in my opinion.

We also could depend on the best installed slot during installation of a 
postgresql package, but i also would consider this bad design, as this could 
lead to issues, if multiple libraries, used together, are linked and build 
against different versions of libpq.

This is what happens in gentoo far to often. 

My proposed solution does not have this issues, as postgresql-client installs 
in version-independent locations. The `pg_config` from postgresql-client 
reflects that. 

For server-side builds the correct `pg_config` version must be chosen. This is 
done by postgresql.exlib








More information about the Exherbo-dev mailing list