Re: PLUGINS Functionlity in Win32 build scripts

Started by MUHAMMAD ASIFover 17 years ago1 messages
#1MUHAMMAD ASIF
anaeem.it@hotmail.com
1 attachment(s)

Please checkout the patch that adds the PLUGINS functionality in src/makefiles/pgxs.mk it covers the Unix side of functionality. Thanks.

Date: Sat, 13 Sep 2008 10:33:30 +0300
To: anaeem.it@hotmail.com
CC: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] PLUGINS Functionlity in Win32 build scripts
From: heikki.linnakangas@enterprisedb.com

MUHAMMAD ASIF wrote:

During the integration of pldebugger ( http://pgfoundry.org/projects/edb-debugger ) with postgres on windows I faced a problem that plugins are not being copied to the lib/plugins directory. Plugins should be copied in (Installation dir)lib/plugins to work properly.
To solve this problem I added PLUGINS logic in the Windows Perl build scripts of PostgreSQL 8.3.3. It searches for PLUGINS variable in the contrib Makefile and processes 'PLUGINS' as 'MODULES' and copies the generated plugin library to the (Installation dir)lib/plugins.
Please find the attached plugin.patch file. Thanks.

We'll need the same logic on Unix-platforms as well.

I've added this to the November commitfest Wiki page.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

Attachments:

plugins-unix.patchapplication/octet-streamDownload
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index a4263a6..a803be8 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -19,6 +19,8 @@
 #
 #   MODULES -- list of shared objects to be build from source file with
 #     same stem (do not include suffix in this list)
+#   PLUGINS -- list of shared plugin objects to be build from source file
+#     with same stem, shared objects will be installed under $PREFIX/lib/plugins
 #   DATA -- random files to install into $PREFIX/share/contrib
 #   DATA_built -- random files to install into $PREFIX/share/contrib,
 #     which need to be built first
@@ -66,7 +68,7 @@ endif
 
 override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
 
-ifdef MODULES
+ifneq (,$(MODULES)$(PLUGINS))
 override CFLAGS += $(CFLAGS_SL)
 SHLIB_LINK += $(BE_DLLLIBS)
 endif
@@ -75,7 +77,7 @@ ifdef PG_CPPFLAGS
 override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
 endif
 
-all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES))
+all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix $(DLSUFFIX), $(PLUGINS))
 
 ifdef MODULE_big
 # shared library parameters
@@ -110,6 +112,12 @@ ifdef MODULES
 	  $(INSTALL_SHLIB) $$file '$(DESTDIR)$(pkglibdir)'; \
 	done
 endif # MODULES
+ifdef PLUGINS
+	@for file in $(addsuffix $(DLSUFFIX), $(PLUGINS)); do \
+	  echo "$(INSTALL_SHLIB) $$file '$(DESTDIR)$(pkglibdir)/plugins'"; \
+	  $(INSTALL_SHLIB) $$file '$(DESTDIR)$(pkglibdir)/plugins'; \
+	done
+endif # PLUGINS
 ifdef DOCS
 ifdef docdir
 	@for file in $(addprefix $(srcdir)/, $(DOCS)); do \
@@ -148,6 +156,9 @@ endif
 ifneq (,$(MODULES)$(MODULE_big))
 	$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
 endif
+ifdef PLUGINS
+	$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)/plugins'
+endif
 ifdef DOCS
 ifdef docdir
 	$(mkinstalldirs) '$(DESTDIR)$(docdir)/contrib'
@@ -168,6 +179,9 @@ endif
 ifdef MODULES
 	rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/, $(addsuffix $(DLSUFFIX), $(MODULES)))
 endif
+ifdef PLUGINS
+	rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/plugins/, $(addsuffix $(DLSUFFIX), $(PLUGINS)))
+endif
 ifdef DOCS
 	rm -f $(addprefix '$(DESTDIR)$(docdir)'/contrib/, $(DOCS))
 endif
@@ -189,6 +203,9 @@ clean:
 ifdef MODULES
 	rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES))
 endif
+ifdef PLUGINS
+	rm -f $(addsuffix $(DLSUFFIX), $(PLUGINS)) $(addsuffix .o, $(PLUGINS))
+endif
 ifdef DATA_built
 	rm -f $(DATA_built)
 endif
@@ -269,7 +286,7 @@ endif # REGRESS
 
 # STANDARD RULES
 
-ifneq (,$(MODULES)$(MODULE_big))
+ifneq (,$(MODULES)$(MODULE_big)$(PLUGINS))
 %.sql: %.sql.in
 	sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@
 endif