[pgpool-hackers: 1611] Optionally Read PG_CONFIG Environment Variable
Aaron W. Swenson
titanofold at gentoo.org
Wed Jun 8 19:59:54 JST 2016
Hello all!
I’m the maintainer of the pgpool-II package on Gentoo Linux.
Like most other distros, our users are able to emerge/install multiple
major versions of PostgreSQL side-by-side; they can have 9.4 and 9.5
available and running on the system at the same time. This is known as
slotting.
One of the things I’m currently working on is an eclass (a kind of
helper library) that allows a package to install to all versions of
PostgreSQL installed.
One of the ways the eclass conveys which slot to build and install
against is by setting the PG_CONFIG variable to the absolute path of
pg_config, (e.g., /usr/lib64/postgresql-9.5/bin/pg_config).
Another way is through string manipulation. It’ll find specific tokens
in a string, replace them with the values relevant for the particular
slot it’s working on, then pass the manipulated string on to whatever it
needs to be passed to. For example:
pg_multi_foreach econf --with-pgsql=…@PG_SLOT@…
Becomes:
configure --with-pgsql=…9.5…
In the course of working with this eclass and the pgpool-II package I’ve
run into an issue with pgpool-II only building and installing against
one PostgreSQL slot, whichever one is set by the user as the default.
As a result, this prevents pgpool-II from being installed to, and usable
by, all PostgreSQL slots. This poses several problems, chief of which is
ease of migrating databases.
The solution to this particular problem is simple: Instruct GNU make to
not ignore and override the value of the environment variable
PG_CONFIG. Right now, the Makefiles set PG_CONFIG to pg_config, which
when called within $(shell) just finds the first pg_config in PATH.
I have opened a bug about this at:
http://www.pgpool.net/mantisbt/view.php?id=178
And I’ve attached the patch as well.
It just makes the following change:
-PG_CONFIG = pg_config
+PG_CONFIG ?= pg_config
Throughout the Makefiles. This allows GNU make to set PG_CONFIG if it
hasn’t already been set in the environment.
This would benefit more than just Gentoo as others may want to build and
install pgpool-II against a PostgreSQL that resides outside the default
path.
Thank you for your consideration.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgpool-3.5.0-respect-pg-config-envvar.patch
Type: text/x-diff
Size: 2217 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20160608/904a7bdf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 345 bytes
Desc: Digital signature
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20160608/904a7bdf/attachment.sig>
More information about the pgpool-hackers
mailing list