pgsql: Allow extensions to install built as well as unbuilt headers.

Started by Andrew Gierthover 7 years ago9 messages
#1Andrew Gierth
rhodiumtoad@postgresql.org

Allow extensions to install built as well as unbuilt headers.

Commit df163230b overlooked the case that an out-of-tree extension
might need to build its header files (e.g. via ./configure). If it is
also doing a VPATH build, the HEADERS_* rules in the original commit
would then fail to find the files, since they would be looking only
under $(srcdir) and not in the build directory.

Fix by adding HEADERS_built and HEADERS_built_$(MODULE) which behave
like DATA_built in that they look in the build dir rather than the
source dir (and also make the files dependencies of the "all" target).

No Windows support appears to be needed for this, since it is only
relevant to out-of-tree builds (no support exists in Mkvcbuild.pm to
build extension header files in any case).

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/be54b3777ff189e79661d8746d3f25b0564393d2

Modified Files
--------------
doc/src/sgml/extend.sgml | 16 +++++++++++++---
src/makefiles/pgxs.mk | 49 +++++++++++++++++++++++++++++++++++++++---------
2 files changed, 53 insertions(+), 12 deletions(-)

#2Michael Paquier
michael@paquier.xyz
In reply to: Andrew Gierth (#1)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

Hi Andrew,

On Wed, Sep 05, 2018 at 09:45:49PM +0000, Andrew Gierth wrote:

Allow extensions to install built as well as unbuilt headers.

Commit df163230b overlooked the case that an out-of-tree extension
might need to build its header files (e.g. via ./configure). If it is
also doing a VPATH build, the HEADERS_* rules in the original commit
would then fail to find the files, since they would be looking only
under $(srcdir) and not in the build directory.

Fix by adding HEADERS_built and HEADERS_built_$(MODULE) which behave
like DATA_built in that they look in the build dir rather than the
source dir (and also make the files dependencies of the "all" target).

No Windows support appears to be needed for this, since it is only
relevant to out-of-tree builds (no support exists in Mkvcbuild.pm to
build extension header files in any case).

prairiedog is unhappy with this commit:
make -C ../../../contrib/spi
../../src/makefiles/pgxs.mk:140: Extraneous text after `else' directive
../../src/makefiles/pgxs.mk:144: *** only one `else' per conditional.
Stop.
make[2]: *** [submake-contrib-spi] Error 2
make[2]: *** Waiting for unfinished jobs....
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prairiedog&dt=2018-09-05%2023%3A21%3A01
--
Michael

#3Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Michael Paquier (#2)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

"Michael" == Michael Paquier <michael@paquier.xyz> writes:

Michael> prairiedog is unhappy with this commit:

What version of GNU Make is on there, do you know? Tom? I don't see it
mentioned in the output anywhere.

--
Andrew.

#4Michael Paquier
michael@paquier.xyz
In reply to: Andrew Gierth (#3)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

On Thu, Sep 06, 2018 at 06:26:51AM +0100, Andrew Gierth wrote:

What version of GNU Make is on there, do you know? Tom? I don't see it
mentioned in the output anywhere.

I don't know it. What I can see is that the use of "else ifdef" is
forbidden. You could bypass the problem with more ifdef-only tweaks,
but it seems to me that it would be cleaner to somewhat reduce the level
of dependency between all the different header concepts.

By the way, when you use at least two layers in ifdef/endif in pgxs.mk,
putting a comment close to the endif to mention which part gets closed
improves readability.
--
Michael

#5Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Michael Paquier (#4)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

"Michael" == Michael Paquier <michael@paquier.xyz> writes:

What version of GNU Make is on there, do you know? Tom? I don't see
it mentioned in the output anywhere.

Michael> I don't know it.

Consulting old manuals suggests it may have version 3.80 (c. 2002),
which lacks the 'else if..' syntax introduced in 3.81 (c. 2006).

--
Andrew (irc:RhodiumToad)

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Gierth (#3)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

"Michael" == Michael Paquier <michael@paquier.xyz> writes:
Michael> prairiedog is unhappy with this commit:

What version of GNU Make is on there, do you know? Tom? I don't see it
mentioned in the output anywhere.

$ make -v
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

regards, tom lane

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Gierth (#5)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

Consulting old manuals suggests it may have version 3.80 (c. 2002),
which lacks the 'else if..' syntax introduced in 3.81 (c. 2006).

Right; I haven't updated it because that's specifically called out to
be the minimum supported version in our docs (cf installation.sgml).

regards, tom lane

#8Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Tom Lane (#7)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

"Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

Consulting old manuals suggests it may have version 3.80 (c. 2002),
which lacks the 'else if..' syntax introduced in 3.81 (c. 2006).

Tom> Right; I haven't updated it because that's specifically called out to
Tom> be the minimum supported version in our docs (cf installation.sgml).

Yeah; I checked the other constructs I used for what version they were
added in, but that one slipped through. Fix coming shortly.

--
Andrew (irc:RhodiumToad)

#9Michael Paquier
michael@paquier.xyz
In reply to: Andrew Gierth (#8)
Re: pgsql: Allow extensions to install built as well as unbuilt headers.

On Thu, Sep 06, 2018 at 05:18:10PM +0100, Andrew Gierth wrote:

Yeah; I checked the other constructs I used for what version they were
added in, but that one slipped through. Fix coming shortly.

For the sake of the archives, Andrew has pushed 7b6b167 to address the
issue, which looks fine at quick glance.
--
Michael