I looked at the recently noted problem that pgxs builds only work
if the installation paths recorded in Makefile.global are accurate;
which pretty much breaks our claim to supporting relocatable
installations.
What I propose we do about this is change the path setup section
of Makefile.global to look like (for each path variable)
ifdef PGXS
pkglibdir = $(shell pg_config --pkglibdir)
else
# existing code to set up pkglibdir
endif
Since a pgxs build has already assumed it could use pg_config to find
pgxs.mk, this isn't introducing any new dependency, and it will allow
the existing relocatable-path code to do its thing.
Not all of the path variables set up in Makefile.global are currently
available from pg_config; the missing ones are
prefix
exec_prefix
sbindir
mandir
localedir
libexecdir
datadir
sysconfdir
pkgincludedir
docdir
The first three of these don't seem to be directly referenced anywhere
in the Makefiles, so I propose just removing them from Makefile.global.
The other ones will need to be added to pg_config's repertoire, unless
someone can make a pretty good case that no pgxs-using module would ever
need to install into that directory.
Also note that I'm assuming the following path variables can continue to
be defined as they are, ie, relative to other path variables that will
get the pg_config treatment:
includedir_server = $(pkgincludedir)/server
includedir_internal = $(pkgincludedir)/internal
pgxsdir = $(pkglibdir)/pgxs
Comments?
The other open issue in this area was that on Windows, pg_config needs
to return space-free path names to avoid breaking the makefiles. It was
suggested that this could be handled by passing pg_config's result path
names through GetShortPathName() on that platform. That sounds OK to me
but I'm not in a position to write or test such a patch; can someone
take care of that?
regards, tom lane