]> granicus.if.org Git - postgresql/commitdiff
Fix out-of-tree build for transform modules.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Sun, 16 Sep 2018 17:46:45 +0000 (18:46 +0100)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Sun, 16 Sep 2018 17:46:45 +0000 (18:46 +0100)
Neither plperl nor plpython installed sufficient header files to
permit transform modules to be built out-of-tree using PGXS. Fix that
by installing all plperl and plpython header files (other than those
with special purposes such as generated data tables), and also install
plpython's special .mk file for mangling regression tests.

(This commit does not fix the windows install, which does not
currently install _any_ plperl or plpython headers.)

Also fix the existing transform modules for hstore and ltree so that
their cross-module #include directives work as anticipated by commit
df163230b9 et seq. This allows them to serve as working examples of
how to reference other modules when doing separate out-of-tree builds.

Discussion: https://postgr.es/m/87o9ej8bgl.fsf%40news-spur.riddles.org.uk

contrib/hstore_plperl/Makefile
contrib/hstore_plperl/hstore_plperl.c
contrib/hstore_plpython/Makefile
contrib/hstore_plpython/hstore_plpython.c
contrib/ltree_plpython/Makefile
contrib/ltree_plpython/ltree_plpython.c
src/pl/plperl/GNUmakefile
src/pl/plpython/Makefile
src/tools/msvc/Mkvcbuild.pm

index f63cba274569b08330d61b8e89b6a2e7e35d5c74..32ecaa43cbc962198f4c42ca92e2984b3ee18b53 100644 (file)
@@ -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
index c09bd38d090e89863140ef0f8910cc2d90712094..61b5557421c7d6d3c08929decd8d71c1a74fa265 100644 (file)
@@ -5,7 +5,7 @@
 #include "fmgr.h"
 #include "plperl.h"
 #include "plperl_helpers.h"
-#include "hstore.h"
+#include "hstore/hstore.h"
 
 PG_MODULE_MAGIC;
 
index b81735ab9101d262cccc05ed80de312fbfa5e059..6877e7a072c9b990e93841858c992dead9a9ecfc 100644 (file)
@@ -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
index 218e6612b14717cdd8296ab7186838b30a09c6bb..2f24090ff3eadae849fb5b0cdd8a51f1831189ec 100644 (file)
@@ -3,7 +3,7 @@
 #include "fmgr.h"
 #include "plpython.h"
 #include "plpy_typeio.h"
-#include "hstore.h"
+#include "hstore/hstore.h"
 
 PG_MODULE_MAGIC;
 
index 7e988c79935d9c26868d51dfed981080a882e431..ce2c0cd2e2fd9953925f5a07da2a224de522a9f7 100644 (file)
@@ -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
index e88636a0a965c26ab6c2a3861513b54770bf0133..b254aa558d131e85e3834c41c7c8c4039808d75d 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "fmgr.h"
 #include "plpython.h"
-#include "ltree.h"
+#include "ltree/ltree.h"
 
 PG_MODULE_MAGIC;
 
index 933abb47c498aebeae1f2df4d7513e9b7bffb3df..39dacf8b2e96614c4f67696b8a8ddd986f3e5541 100644 (file)
@@ -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)))
index c17015bbdf5ebf4c3de7387f5f0a87605f702bba..667a74469ec8782f8d2c992b9f26bbd047e7df68 100644 (file)
@@ -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)))
index 9ce03ce684e8fbd37c6dd158ccd32af70821035b..6484a67223efd8c541ecee88facdbdcee804bba7 100644 (file)
@@ -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');