Re: Should contrib modules install .h files?

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

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>> How about this: it's most likely that modules that install include
>> files will also be using MODULE_big, so use that as the default
>> name; if a makefile that uses only MODULES also wants to install
>> include files, have it define MODULE_NAME (or some such variable)
>> itself.

Tom> AFAIR, you're supposed to define at most one of those macros
Tom> anyway, so I don't see why it couldn't be like "use MODULE_big if
Tom> set, else use MODULE if set, else fail if MODULE_NAME isn't set".

OK, I'm working on an updated patch, that will allow this:

if using MODULE_big:

MODULE_big = mymodule
HEADERS = whatever.h

# gets installed as mymodule/whatever.h in whatever dir we decide on
# also works if you define HEADERS_mymodule = whatever.h

if not using MODULE_big:

MODULES = foo bar baz
HEADERS_foo = foo.h
HEADERS_bar = bar.h
# baz doesn't have any headers

# foo.h installed as foo/foo.h
# bar.h installed as bar/bar.h

Two questions arise:

1) include/server has a lot of files and subdirs, so using
include/server/$(MODULE)/ looks likely to be error-prone. So it
should be something like include/server/contrib/$(MODULE)/ or
include/server/extension/$(MODULE)/. Which one, or should it use
$(MODULEDIR) to choose between the two the way that DATA and DOCS do?
Or something else?

2) Specifying HEADERS_blah for some name "blah" that's not listed in
MODULES or MODULE_big should do what:

a) install into blah/ anyway
b) be ignored with a warning
c) be silently ignored
d) be an error

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-07-02 18:25:58 Re: shared-memory based stats collector
Previous Message Robert Haas 2018-07-02 18:23:09 Re: Fix error message when trying to alter statistics on included column