Le jeudi 20 juin 2013 05:26:21, Peter Eisentraut a écrit :
> On Wed, 2013-06-19 at 20:58 +0200, Cédric Villemain wrote:
> > I believe he answered the proposal to put all headers on the same flat
> > directory, instead of a tree.
>
> The headers are used as
>
> #include "hstore.h"
> #include "ltree.h"
> etc.
>
> in the existing source code.
>
> If you want to install the for use by others, you can do one of three
> things:
>
> 1) Install them into $(pg_config --includedir-server), so other users
> will just include them in the same way as shown above.
I don't like this one because extension can overwrite sever headers.
> 2) Install them in a different directory, but keep the same #include
> lines. That would require PGXS changes, perhaps a new pg_config option,
> or something that produces the right -I option to find them.
Patch of PGXS is not a problem.
pg_config patch is a requirement only if users set their own
$(includedir_contrib) variable. I didn't though about it, but it is probably
better to add that. This looks trivial too.
To include hstore header we write «#include "hstore.h"» but we add :-I$(includedir_contrib)/hstore to the FLAGS in the
extensionmakefile which
does require hstore. It changes nothing to hstore Makefile itself.
The main difference is that before we had to -I$(top_srcdir)/../contrib/hstore
*iff* we are not building with PGXS (else we need to have the hstore source
available somewhere), now we can do -I$(includedir_contrib)/hstore with PGXS
(hstore need to be installed first, as we USE_PGXS)
Then PGXS offers to catch both case transparently so we can do :
-I${include_contrib_header) in Makefile
and pgxs.mk takes care of adjusting include_contrib_header (or whatever its
name) according to USE_PGXS value.
> 3) Install them in a different directory and require a different
> #include line. But then you have to change the existing uses as well,
> which would probably require moving files around.
Having to change existing source code do keep the same behavior is not
attractive at all.
> Both 2 and 3 require a lot of work, possibly compatibility breaks, for
> no obvious reason.
2 is a good solution and not a lot of work, IMO.
Removing the need of setting -I$(include...) in the contrib Makefile can be
done later by adding a PGXS variable to define the contrib requirements, this
is something different from the current feature (build contrib depending on
another(s) without full source tree)
--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation