Re: Should contrib modules install .h files?

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should contrib modules install .h files?
Date: 2018-08-01 04:17:27
Message-ID: 871sbiburm.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Andres" == Andres Freund <andres(at)anarazel(dot)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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2018-08-01 05:09:03 Re: Kerberos test suite
Previous Message Kyotaro HORIGUCHI 2018-08-01 04:04:37 Re: Documentaion fix.