From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org, Andres Freund <andres@anarazel.de>
Subject: Re: Should contrib modules install .h files?
Date: Mon, 02 Jul 2018 11:04:14 +0100
Message-ID: <87tvpinfr4.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <ee05ea4c-3d5b-0ec6-8daa-3ec66f021076@2ndquadrant.com>
References: <87y3euomjh.fsf@news-spur.riddles.org.uk>
<ee05ea4c-3d5b-0ec6-8daa-3ec66f021076@2ndquadrant.com>
>>>>> "Peter" == Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> So I have this immediate problem: a PGXS build of a module,
>> specifically an hstore transform for a non-core PL, is much harder
>> than it should be because it has no way to get at hstore.h since
>> that file is never installed anywhere.
>>
>> Should that be changed?
Peter> Yes, just install it, I think.
I'm thinking that $(includedir_server)/$(MODULEDIR) would be a
reasonable place? MODULEDIR defaults to either "contrib" or "extension"
depending on whether EXTENSION is set.
Something like the attached patch seem reasonable?
--
Andrew (irc:RhodiumToad)
Attachments:contrib_includes_1.patch (text/x-patch, 2.2K) downloaddiff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefileindex ab7fef3979..470474b062 100644--- a/contrib/hstore/Makefile+++ b/contrib/hstore/Makefile@@ -11,6 +11,8 @@ DATA = hstore--1.4.sql hstore--1.4--1.5.sql \
hstore--unpackaged--1.0.sql
PGFILEDESC = "hstore - key/value pair data type"
+INCLUDES = hstore.h+
REGRESS = hstore
ifdef USE_PGXS
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mkindex bfae02f90c..f6662be2b8 100644--- a/src/makefiles/pgxs.mk+++ b/src/makefiles/pgxs.mk@@ -38,6 +38,7 @@
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
# which need to be built first
+# INCLUDES -- files to install into $PREFIX/include/server/$MODULEDIR
# REGRESS -- list of regression test cases (without suffix)
# REGRESS_OPTS -- additional switches to pass to pg_regress
# NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
@@ -94,13 +95,16 @@ endif
ifdef MODULEDIR
datamoduledir := $(MODULEDIR)
docmoduledir := $(MODULEDIR)
+incmoduledir := $(MODULEDIR)
else
ifdef EXTENSION
datamoduledir := extension
docmoduledir := extension
+incmoduledir := extension
else
datamoduledir := contrib
docmoduledir := contrib
+incmoduledir := contrib
endif
endif
@@ -154,6 +158,9 @@ endif # SCRIPTS
ifdef SCRIPTS_built
$(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
endif # SCRIPTS_built
+ifdef INCLUDES+ $(INSTALL_DATA) $(addprefix $(srcdir)/, $(INCLUDES)) '$(DESTDIR)$(includedir_server)/$(incmoduledir)/'+endif # INCLUDES
ifdef MODULE_big
ifeq ($(with_llvm), yes)
$(call install_llvm_module,$(MODULE_big),$(OBJS))
@@ -184,6 +191,9 @@ endif # DOCS
ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
$(MKDIR_P) '$(DESTDIR)$(bindir)'
endif
+ifdef INCLUDES+ $(MKDIR_P) '$(DESTDIR)$(includedir_server)/$(incmoduledir)'+endif
ifdef MODULE_big
installdirs: installdirs-lib
@@ -218,6 +228,9 @@ endif
ifdef SCRIPTS_built
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS_built))
endif
+ifdef INCLUDES+ rm -f $(addprefix '$(DESTDIR)$(includedir_server)/$(incmoduledir)'/, $(INCLUDES))+endif
ifdef MODULE_big
ifeq ($(with_llvm), yes)
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, peter.eisentraut@2ndquadrant.com, andres@anarazel.de
Subject: Re: Should contrib modules install .h files?
In-Reply-To: <87tvpinfr4.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