From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Should contrib modules install .h files?
Date: Wed, 01 Aug 2018 05:17:27 +0100
Message-ID: <871sbiburm.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <20180801035515.gn45uqoqd7kwgans@alap3.anarazel.de>
References: <67427.1530738056@sss.pgh.pa.us>
<87po02m0bh.fsf@news-spur.riddles.org.uk>
<87in5tnafh.fsf@news-spur.riddles.org.uk>
<87efghn7js.fsf@news-spur.riddles.org.uk>
<87a7r5n4n2.fsf@news-spur.riddles.org.uk>
<87o9enb4h7.fsf@news-spur.riddles.org.uk>
<86036c67-d76f-3dc0-a9f5-69e776b4ecc5@2ndquadrant.com>
<87d0v3atbm.fsf@news-spur.riddles.org.uk>
<27744.1533091472@sss.pgh.pa.us>
<87600ubvb7.fsf@news-spur.riddles.org.uk>
<20180801035515.gn45uqoqd7kwgans@alap3.anarazel.de>
>>>>> "Andres" == Andres Freund <andres@anarazel.de> writes:
>> Sure, it works for the simple cases like hstore, but how does it
>> handle the case of a pgxs extension that installs more than one
>> include file, one of which includes another?
Andres> I might be momentarily daft (just was on a conference call for
Andres> a while ;)), but why'd that be problematic? The header files
Andres> can just specify the full path, and they'll find each other
Andres> because of the aforementioned -I?
The #includes in the header files need to work both for the module's own
build, and also for building modules depending on it.
So existing practice would be that the module's own source dir (for
module "foo") would look something like:
./Makefile
./foo.h (contains #include "foo_2.h")
./foo_2.h
./foo.c (contains #include "foo.h")
and eventually foo.h and foo_int.h get installed as
$(includedir_server)/extension/foo/foo.h and /foo_2.h
To make this work with Tom's scheme means changing the directory layout
of the original module. For contrib modules it's easy because the "." in
the above paths is already "contrib/foo", but for PGXS the module should
not be making assumptions about the name of its build dir, so you end up
having to rejig the layout to something like
./Makefile
./foo
./foo/foo.h (contains #include "foo/foo_2.h")
./foo/foo_2.h
./foo.c (contains #include "foo/foo.h", compiled with -I$(srcdir))
or
./Makefile
./include/foo
./include/foo/foo.h
./include/foo/foo_2.h
./foo.c (compiled with -I$(srcdir)/include)
Either way, it's a forced change to the PGXS module's file layout if it
wants to install headers that work for other people using Tom's
suggested approach. I'm not on board with this unless there's a better
solution than I've seen so far.
--
Andrew (irc:RhodiumToad)
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: andrew@tao11.riddles.org.uk, andres@anarazel.de, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com
Subject: Re: Should contrib modules install .h files?
In-Reply-To: <871sbiburm.fsf@news-spur.riddles.org.uk>
* 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