Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fmR80-0004Mu-Bh for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Aug 2018 22:03:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fmR7x-0005LQ-5P for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Aug 2018 22:03:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fmR7w-0005LJ-Uc for pgsql-hackers@lists.postgresql.org; Sun, 05 Aug 2018 22:03:52 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fmR7n-00071p-0N for pgsql-hackers@postgresql.org; Sun, 05 Aug 2018 22:03:50 +0000 Received: from [192.168.127.1] (port=56080 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1fmR7i-000Ajz-E3; Sun, 05 Aug 2018 22:03:38 +0000 Received: from [127.0.0.1] (port=37337 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fmR7h-000PiU-O1; Sun, 05 Aug 2018 22:03:37 +0000 From: Andrew Gierth To: Tom Lane Cc: Robert Haas , Peter Geoghegan , Andres Freund , PostgreSQL Hackers Subject: Re: Should contrib modules install .h files? In-Reply-To: <11318.1533487874@sss.pgh.pa.us> (Tom Lane's message of "Sun, 05 Aug 2018 12:51:14 -0400") Message-ID: <87ftzs8prv.fsf@news-spur.riddles.org.uk> References: <87h8lhoevw.fsf@news-spur.riddles.org.uk> <63819.1530544945@sss.pgh.pa.us> <878t6to8j9.fsf@news-spur.riddles.org.uk> <874lhho071.fsf@news-spur.riddles.org.uk> <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> <20180731201700.zfscje7clxiljvjl@alap3.anarazel.de> <11978.1533073999@sss.pgh.pa.us> <1836.1533221640@sss.pgh.pa.us> <87lg9oaghh.fsf@news-spur.riddles.org.uk> <25706.1533229991@sss.pgh.pa.us> <87o9ej8bgl.fsf@news-spur.riddles.org.uk> <11318.1533487874@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Sun, 05 Aug 2018 23:03:37 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain >>>>> "Tom" == Tom Lane writes: >> This logic could perhaps be best moved into the pgxs makefile >> itself, either unconditionally adding -I options to CPPFLAGS, or >> conditionally adding them based on a WANT_EXTENSION_HEADERS flag of >> some sort set by the module makefile. Tom> I think we'd want to press forward on making that happen, so that Tom> hstore_plperl and friends can serve as copy-and-pasteable Tom> prototype code for out-of-tree transform modules. Do you have an Tom> idea how to fix the other problem you mentioned with the plpython Tom> makefiles? Here's a patch that fixes (not necessarily in the best way) the PGXS builds of all the contrib/*_pl{perl,python} modules. Open questions: - is there a better way of doing the conditional setting of PG_CPPFLAGS? - the choice of which .h files to install from plperl and plpython is not principled - I just installed the ones needed for the contrib modules to work. Particularly for plpython this list needs to be reviewed - but I'm not a pythonist and that should be done by someone who is. -- Andrew (irc:RhodiumToad) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=c.patch Content-Description: contrib pgxs transforms build patch diff --git a/contrib/hstore_plperl/Makefile b/contrib/hstore_plperl/Makefile index f63cba2745..32ecaa43cb 100644 --- a/contrib/hstore_plperl/Makefile +++ b/contrib/hstore_plperl/Makefile @@ -4,7 +4,6 @@ MODULE_big = hstore_plperl OBJS = hstore_plperl.o $(WIN32RES) PGFILEDESC = "hstore_plperl - hstore transform for plperl" -PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plperl -I$(top_srcdir)/contrib/hstore EXTENSION = hstore_plperl hstore_plperlu DATA = hstore_plperl--1.0.sql hstore_plperlu--1.0.sql @@ -13,10 +12,12 @@ REGRESS = hstore_plperl hstore_plperlu create_transform EXTRA_INSTALL = contrib/hstore ifdef USE_PGXS +PG_CPPFLAGS = -I$(includedir_server)/extension PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else +PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plperl -I$(top_srcdir)/contrib subdir = contrib/hstore_plperl top_builddir = ../.. include $(top_builddir)/src/Makefile.global diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c index c09bd38d09..61b5557421 100644 --- a/contrib/hstore_plperl/hstore_plperl.c +++ b/contrib/hstore_plperl/hstore_plperl.c @@ -5,7 +5,7 @@ #include "fmgr.h" #include "plperl.h" #include "plperl_helpers.h" -#include "hstore.h" +#include "hstore/hstore.h" PG_MODULE_MAGIC; diff --git a/contrib/hstore_plpython/Makefile b/contrib/hstore_plpython/Makefile index b81735ab91..93f3507130 100644 --- a/contrib/hstore_plpython/Makefile +++ b/contrib/hstore_plpython/Makefile @@ -4,7 +4,6 @@ MODULE_big = hstore_plpython$(python_majorversion) OBJS = hstore_plpython.o $(WIN32RES) PGFILEDESC = "hstore_plpython - hstore transform for plpython" -PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plpython $(python_includespec) -I$(top_srcdir)/contrib/hstore -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' EXTENSION = hstore_plpythonu hstore_plpython2u hstore_plpython3u DATA = hstore_plpythonu--1.0.sql hstore_plpython2u--1.0.sql hstore_plpython3u--1.0.sql @@ -13,10 +12,12 @@ REGRESS = hstore_plpython REGRESS_PLPYTHON3_MANGLE := $(REGRESS) ifdef USE_PGXS +PG_CPPFLAGS = $(python_includespec) -I$(includedir_server)/extension -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else +PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plpython $(python_includespec) -I$(top_srcdir)/contrib -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' subdir = contrib/hstore_plpython top_builddir = ../.. include $(top_builddir)/src/Makefile.global diff --git a/contrib/hstore_plpython/hstore_plpython.c b/contrib/hstore_plpython/hstore_plpython.c index 218e6612b1..2f24090ff3 100644 --- a/contrib/hstore_plpython/hstore_plpython.c +++ b/contrib/hstore_plpython/hstore_plpython.c @@ -3,7 +3,7 @@ #include "fmgr.h" #include "plpython.h" #include "plpy_typeio.h" -#include "hstore.h" +#include "hstore/hstore.h" PG_MODULE_MAGIC; diff --git a/contrib/ltree_plpython/Makefile b/contrib/ltree_plpython/Makefile index 7e988c7993..f9e9e8d734 100644 --- a/contrib/ltree_plpython/Makefile +++ b/contrib/ltree_plpython/Makefile @@ -4,8 +4,6 @@ MODULE_big = ltree_plpython$(python_majorversion) OBJS = ltree_plpython.o $(WIN32RES) PGFILEDESC = "ltree_plpython - ltree transform for plpython" -PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plpython $(python_includespec) -I$(top_srcdir)/contrib/ltree -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' - EXTENSION = ltree_plpythonu ltree_plpython2u ltree_plpython3u DATA = ltree_plpythonu--1.0.sql ltree_plpython2u--1.0.sql ltree_plpython3u--1.0.sql @@ -13,10 +11,12 @@ REGRESS = ltree_plpython REGRESS_PLPYTHON3_MANGLE := $(REGRESS) ifdef USE_PGXS +PG_CPPFLAGS = $(python_includespec) -I$(includedir_server)/extension -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else +PG_CPPFLAGS = -I$(top_srcdir)/src/pl/plpython $(python_includespec) -I$(top_srcdir)/contrib -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' subdir = contrib/ltree_plpython top_builddir = ../.. include $(top_builddir)/src/Makefile.global diff --git a/contrib/ltree_plpython/ltree_plpython.c b/contrib/ltree_plpython/ltree_plpython.c index e88636a0a9..b254aa558d 100644 --- a/contrib/ltree_plpython/ltree_plpython.c +++ b/contrib/ltree_plpython/ltree_plpython.c @@ -2,7 +2,7 @@ #include "fmgr.h" #include "plpython.h" -#include "ltree.h" +#include "ltree/ltree.h" PG_MODULE_MAGIC; diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index 933abb47c4..39dacf8b2e 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -100,7 +100,7 @@ uninstall: uninstall-lib uninstall-data install-data: installdirs $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/' - $(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/ppport.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/ppport.h $(srcdir)/plperl_helpers.h '$(DESTDIR)$(includedir_server)' uninstall-data: rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA))) diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile index c17015bbdf..dcc0b07583 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -105,13 +105,14 @@ $(OBJS): | submake-generated-headers install: all install-lib install-data installdirs: installdirs-lib - $(MKDIR_P) '$(DESTDIR)$(datadir)/extension' '$(DESTDIR)$(includedir_server)' + $(MKDIR_P) '$(DESTDIR)$(datadir)/extension' '$(DESTDIR)$(includedir_server)' '$(DESTDIR)$(pgxsdir)/src/pl/plpython' uninstall: uninstall-lib uninstall-data install-data: installdirs $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/' - $(INSTALL_DATA) $(srcdir)/plpython.h $(srcdir)/plpy_util.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) $(srcdir)/plpython.h $(srcdir)/plpy_util.h $(srcdir)/plpy_typeio.h $(srcdir)/plpy_elog.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) $(srcdir)/regress-python3-mangle.mk '$(DESTDIR)$(pgxsdir)/src/pl/plpython' uninstall-data: rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA))) --=-=-=--