pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Should contrib modules install .h files?
Date: Sat, 15 Sep 2018 21:03:47 +0100
Message-ID: <87va76jzu1.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <87zhwik1gm.fsf@news-spur.riddles.org.uk>
References: <87h8lhoevw.fsf@news-spur.riddles.org.uk>
	<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>
	<CAH2-Wz=imVrbydSkBH95y3w7ZU7XffE7-LW0R+LjfZrXnyz-dw@mail.gmail.com>
	<11978.1533073999@sss.pgh.pa.us>
	<CA+TgmoZB9fVOd-8ZSWLaKX_TVAV9y0+7YrUn8vbpAPL_4XmGPw@mail.gmail.com>
	<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>
	<87ftzs8prv.fsf@news-spur.riddles.org.uk>
	<87bmag8o41.fsf@news-spur.riddles.org.uk>
	<87zhwik1gm.fsf@news-spur.riddles.org.uk>

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

 Andrew> So what I propose to do is to commit a cleaned-up version of
 Andrew> the patch posted above, with these changes:

 Andrew>  - install all the plpy_*.h headers, not just a few; I know of no reason
 Andrew>    to exclude any of them, and in the absence of feedback it seems
 Andrew>    better to install them all;

 Andrew>  - tidy up the makefile variables in the python transform modules to
 Andrew>    remove some duplication

 Andrew>  - fix Mkvcbuild.pm to account for the changes

 Andrew> This will allow hstore_plperl etc. to stand as examples of how
 Andrew> to do cross-module #includes both in and out of tree.

 Andrew> I'll post the patch for review shortly.

And here it is.

-- 
Andrew (irc:RhodiumToad)

Attachments:

plxs.patch (text/x-patch, 7.8K) download 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..6877e7a072 100644 --- a/contrib/hstore_plpython/Makefile +++ b/contrib/hstore_plpython/Makefile @@ -4,19 +4,21 @@ 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 REGRESS = hstore_plpython REGRESS_PLPYTHON3_MANGLE := $(REGRESS) +PG_CPPFLAGS = $(python_includespec) -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' + 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/plpython -I$(top_srcdir)/contrib 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..ce2c0cd2e2 100644 --- a/contrib/ltree_plpython/Makefile +++ b/contrib/ltree_plpython/Makefile @@ -4,19 +4,21 @@ 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 REGRESS = ltree_plpython REGRESS_PLPYTHON3_MANGLE := $(REGRESS) +PG_CPPFLAGS = $(python_includespec) -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"' + 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/plpython -I$(top_srcdir)/contrib 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..667a74469e 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -39,6 +39,21 @@ ifeq ($(python_majorversion),2) DATA += plpythonu.control plpythonu--1.0.sql plpythonu--unpackaged--1.0.sql endif +# header files to install - it's not clear which of these might be needed +# so install them all. +INCS = plpython.h \ + plpy_cursorobject.h \ + plpy_elog.h \ + plpy_exec.h \ + plpy_main.h \ + plpy_planobject.h \ + plpy_plpymodule.h \ + plpy_procedure.h \ + plpy_resultobject.h \ + plpy_spi.h \ + plpy_subxactobject.h \ + plpy_typeio.h \ + plpy_util.h # Python on win32 ships with import libraries only for Microsoft Visual C++, # which are not compatible with mingw gcc. Therefore we need to build a @@ -105,13 +120,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) $(addprefix $(srcdir)/, $(INCS)) '$(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))) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 9ce03ce684..6484a67223 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -506,7 +506,7 @@ sub mkvcbuild my $hstore_plpython = AddTransformModule( 'hstore_plpython' . $pymajorver, 'contrib/hstore_plpython', 'plpython' . $pymajorver, 'src/pl/plpython', - 'hstore', 'contrib/hstore'); + 'hstore', 'contrib'); $hstore_plpython->AddDefine( 'PLPYTHON_LIBNAME="plpython' . $pymajorver . '"'); my $jsonb_plpython = AddTransformModule( @@ -517,7 +517,7 @@ sub mkvcbuild my $ltree_plpython = AddTransformModule( 'ltree_plpython' . $pymajorver, 'contrib/ltree_plpython', 'plpython' . $pymajorver, 'src/pl/plpython', - 'ltree', 'contrib/ltree'); + 'ltree', 'contrib'); $ltree_plpython->AddDefine( 'PLPYTHON_LIBNAME="plpython' . $pymajorver . '"'); } @@ -753,7 +753,7 @@ sub mkvcbuild my $hstore_plperl = AddTransformModule( 'hstore_plperl', 'contrib/hstore_plperl', 'plperl', 'src/pl/plperl', - 'hstore', 'contrib/hstore'); + 'hstore', 'contrib'); my $jsonb_plperl = AddTransformModule( 'jsonb_plperl', 'contrib/jsonb_plperl', 'plperl', 'src/pl/plperl');

view thread (81+ messages)

Message-ID: <87va76jzu1.fsf@news-spur.riddles.org.uk>
Permalink:  ../87va76jzu1.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87va76jzu1.fsf@news-spur.riddles.org.uk

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, robertmhaas@gmail.com, pg@bowt.ie, andres@anarazel.de
  Subject: Re: Should contrib modules install .h files?
  In-Reply-To: <87va76jzu1.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox