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 1fZvh6-0006Vh-Ud for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Jul 2018 10:04:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fZvh4-0003yN-Tz for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Jul 2018 10:04:26 +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 1fZvh4-0003yG-NJ for pgsql-hackers@lists.postgresql.org; Mon, 02 Jul 2018 10:04:26 +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 1fZvh0-0005S1-SQ for pgsql-hackers@postgresql.org; Mon, 02 Jul 2018 10:04:26 +0000 Received: from [192.168.127.1] (port=64980 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 1fZvgv-0002zJ-5i; Mon, 02 Jul 2018 10:04:17 +0000 Received: from [127.0.0.1] (port=49689 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fZvgt-0003Rx-Vj; Mon, 02 Jul 2018 10:04:16 +0000 From: Andrew Gierth To: Peter Eisentraut Cc: pgsql-hackers@postgresql.org, Andres Freund Subject: Re: Should contrib modules install .h files? In-Reply-To: (Peter Eisentraut's message of "Mon, 2 Jul 2018 10:42:21 +0200") Message-ID: <87tvpinfr4.fsf@news-spur.riddles.org.uk> References: <87y3euomjh.fsf@news-spur.riddles.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Mon, 02 Jul 2018 11:04:14 +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 >>>>> "Peter" == Peter Eisentraut 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) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=contrib_includes_1.patch Content-Description: contrib module includes 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) --=-=-=--