Re: Should contrib modules install .h files? - Mailing list pgsql-hackers
| From | Andrew Gierth |
|---|---|
| Subject | Re: Should contrib modules install .h files? |
| Date | |
| Msg-id | 87tvpinfr4.fsf@news-spur.riddles.org.uk Whole thread Raw |
| In response to | Re: Should contrib modules install .h files? (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>) |
| Responses |
Re: Should contrib modules install .h files?
|
| List | pgsql-hackers |
>>>>> "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)
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index 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.mk
index 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)
pgsql-hackers by date: