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

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

From
Andrew Gierth
Date:
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(-)


Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment

Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment

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

From
Andrew Gierth
Date:
>>>>> "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.


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

From
Andrew Gierth
Date:
>>>>> "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.


Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment

Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment

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

From
Andrew Gierth
Date:
>>>>> "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)


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

From
Andrew Gierth
Date:
>>>>> "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)


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

From
Tom Lane
Date:
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


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

From
Tom Lane
Date:
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


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

From
Tom Lane
Date:
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


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

From
Tom Lane
Date:
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


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

From
Andrew Gierth
Date:
>>>>> "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)


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

From
Andrew Gierth
Date:
>>>>> "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)


Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment

Re: pgsql: Allow extensions to install built as well as unbuiltheaders.

From
Michael Paquier
Date:
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

Attachment