pgxs: build infrastructure for extensions v1

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: pgxs: build infrastructure for extensions v1
Date: 2004-05-24 15:52:12
Message-ID: Pine.LNX.4.58.0405241745510.25555@sablons.cri.ensmp.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Dear patchers,

Please find attached a patch which provides a working infrastructure for
pg extensions such as new gist-based indexes, functions, types...

The infrastructure is a simple reworking of the already available internal
infrastructure for contrib, so that it can be used outside of the
postgresql source tree after installation, without gory details being in
sight of the user...

As a test case and show how, I provided new Makefile.pgxs for most contrib
subdirectories. After postgresql has been configure, compiled and
installed, simply try them with:

"cd contrib/foo ; make -f Makefile.pgxs install"

BEWARE: The patch does not include an update of "configure", as I do not
have the same version of "autoconf". So configure must be regenerated:
"autoconf configure.in > configure"

There is an initial documentation in "pgxs.sgml".

How it works:

- necessary files (includes, scripts, makefiles...) are copied in lib/build
on the initial "make install". The adds 2MB of stuff. The former
installation can be obtained with "make light-install", but then
no extensions could be added to the installation, so this is more for
packagers that would like to provide a separate -dev package, IMHO.

Due to gnu-make restriction on how its includes work, these files must
be copied with the same directory structure as the pg source tree.
The fact does not appear at all in the actual infrastructure from the
user point of view, but it explains why subdirectories are necessary
under the build subdir...

- the makefile of any extension is expected to set macro PGXS to
"pg_config --pgxs", to include a special pgxs.mk makefile, and to
set some macros depending on what is to be built, just like in
current contrib. See the examples under contrib.

- I've added two PGXS-triggered conditionnals in Makefile.global,
so that includes and libraries are taken where needed...

It works for me.

Questions and thoughts:

- maybe more files should be copied? if so, which ones?

- should this actually replace the current "contrib" infrastructure?

I would tend to say "yes"... that would require to replace all makefiles
there by the Makefile.pgxs version, to remove "contrib-global.mk", and
also possibly to update some documentations.

- more documentation?
integration of the documentation wrt pg doc?

- validation? one could thing of installing some contribs
when "make check" is performed, so as to validate that the
extension infrastructure is not broken?

Have a nice day,

--
Fabien Coelho - coelho(at)cri(dot)ensmp(dot)fr

Attachment Content-Type Size
install_build.patch text/plain 40.6 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message ssinger 2004-05-24 16:32:21 contrib/dbmirror typo fix
Previous Message Oliver Jowett 2004-05-24 15:03:29 delayed planning of unnamed statements