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 1fkiZx-0004Am-LG for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Aug 2018 04:17:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkiZv-0002nS-FH for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Aug 2018 04:17:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkiZv-0002nK-4m for pgsql-hackers@lists.postgresql.org; Wed, 01 Aug 2018 04:17:39 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkiZn-00025Z-8V for pgsql-hackers@postgresql.org; Wed, 01 Aug 2018 04:17:37 +0000 Received: from [192.168.127.1] (port=13552 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 1fkiZk-0001sm-DZ; Wed, 01 Aug 2018 04:17:28 +0000 Received: from [127.0.0.1] (port=56738 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fkiZj-000K1m-Nm; Wed, 01 Aug 2018 04:17:27 +0000 From: Andrew Gierth To: Andres Freund Cc: Tom Lane , Peter Eisentraut , pgsql-hackers@postgresql.org Subject: Re: Should contrib modules install .h files? In-Reply-To: <20180801035515.gn45uqoqd7kwgans@alap3.anarazel.de> (Andres Freund's message of "Tue, 31 Jul 2018 20:55:15 -0700") Message-ID: <871sbiburm.fsf@news-spur.riddles.org.uk> References: <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> <86036c67-d76f-3dc0-a9f5-69e776b4ecc5@2ndquadrant.com> <87d0v3atbm.fsf@news-spur.riddles.org.uk> <27744.1533091472@sss.pgh.pa.us> <87600ubvb7.fsf@news-spur.riddles.org.uk> <20180801035515.gn45uqoqd7kwgans@alap3.anarazel.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Wed, 01 Aug 2018 05:17:27 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Andres" == Andres Freund writes: >> Sure, it works for the simple cases like hstore, but how does it >> handle the case of a pgxs extension that installs more than one >> include file, one of which includes another? Andres> I might be momentarily daft (just was on a conference call for Andres> a while ;)), but why'd that be problematic? The header files Andres> can just specify the full path, and they'll find each other Andres> because of the aforementioned -I? The #includes in the header files need to work both for the module's own build, and also for building modules depending on it. So existing practice would be that the module's own source dir (for module "foo") would look something like: ./Makefile ./foo.h (contains #include "foo_2.h") ./foo_2.h ./foo.c (contains #include "foo.h") and eventually foo.h and foo_int.h get installed as $(includedir_server)/extension/foo/foo.h and /foo_2.h To make this work with Tom's scheme means changing the directory layout of the original module. For contrib modules it's easy because the "." in the above paths is already "contrib/foo", but for PGXS the module should not be making assumptions about the name of its build dir, so you end up having to rejig the layout to something like ./Makefile ./foo ./foo/foo.h (contains #include "foo/foo_2.h") ./foo/foo_2.h ./foo.c (contains #include "foo/foo.h", compiled with -I$(srcdir)) or ./Makefile ./include/foo ./include/foo/foo.h ./include/foo/foo_2.h ./foo.c (compiled with -I$(srcdir)/include) Either way, it's a forced change to the PGXS module's file layout if it wants to install headers that work for other people using Tom's suggested approach. I'm not on board with this unless there's a better solution than I've seen so far. -- Andrew (irc:RhodiumToad)