pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Cédric Villemain <cedric@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Craig Ringer <craig@2ndquadrant.com>
Subject: Re: Bugfix and new feature for PGXS
Date: Thu, 20 Jun 2013 13:12:32 +0200
Message-ID: <201306201312.35493.cedric@2ndquadrant.com> (raw)
In-Reply-To: <1371698781.13762.48.camel@vanquo.pezone.net>
References: <201306181552.36673.cedric@2ndquadrant.com>
	<201306192058.23832.cedric@2ndquadrant.com>
	<1371698781.13762.48.camel@vanquo.pezone.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

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 extension makefile 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

Attachments:

  signature.asc (application/pgp-signature, 489B) download

view thread (68+ messages)  latest in thread

Message-ID: <201306201312.35493.cedric@2ndquadrant.com>
Permalink:  ../201306201312.35493.cedric@2ndquadrant.com/
Also on:    postgresql.org/message-id/201306201312.35493.cedric@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: cedric@2ndquadrant.com, peter_e@gmx.net, andrew@dunslane.net, craig@2ndquadrant.com
  Subject: Re: Bugfix and new feature for PGXS
  In-Reply-To: <201306201312.35493.cedric@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox