On 08.04.2012 11:59, Guillaume Lelarge wrote:
Hi,

I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
to make it easier to compile the plugin, but I eventually found that I
can't do that because the plpgsql.h file is not available in the include
directory.

I'm wondering if we shouldn't put the header files of plpgsql source
code in the include directory. It would help compiling the PL/pgsql
debugger, and profiler (and of course my own plugin).

Yep, I just bumped into this myself, while trying to make pldebugger module compilable with pgxs.

There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.

Me neither, except a general desire to keep internals hidden. I propose the attached.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 751a98d..f21d28e 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -27,19 +27,26 @@ all: all-lib
 include $(top_srcdir)/src/Makefile.shlib
 
 
-install: all install-lib install-data
+install: all install-lib install-data install-headers
 
 installdirs: installdirs-lib
 	$(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
 
-uninstall: uninstall-lib uninstall-data
+uninstall: uninstall-lib uninstall-data uninstall-headers
 
 install-data: installdirs
 	$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
 
+# The plpgsql.h header file is needed by instrumentation plugins
+install-headers: installdirs
+	$(INSTALL_DATA) '$(srcdir)/plpgsql.h' '$(DESTDIR)$(includedir_server)'
+
 uninstall-data:
 	rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
 
+uninstall-headers:
+	rm -f '$(DESTDIR)$(includedir_server)/plpgsql.h'
+
 .PHONY: install-data uninstall-data
 
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to