|
|
|
|
Remove lorder(1) and tsort(1) stuff, because it is not needed on modern
|
|
|
|
|
systems and makes problems under some platforms (e.g. older Linux).
|
|
|
|
|
|
|
|
|
|
--- src/Makefile.global.in.orig Thu Sep 5 00:54:18 2002
|
|
|
|
|
+++ src/Makefile.global.in Tue Jul 1 17:17:25 2003
|
|
|
|
|
@@ -193,7 +193,7 @@
|
|
|
|
|
LDREL = -r
|
|
|
|
|
LDOUT = -o
|
|
|
|
|
RANLIB = @RANLIB@
|
|
|
|
|
-LORDER = @LORDER@
|
|
|
|
|
+MK_NO_LORDER= true
|
|
|
|
|
X = @EXEEXT@
|
|
|
|
|
|
|
|
|
|
# Perl
|
|
|
|
|
--- src/makefiles/Makefile.freebsd.orig Wed Aug 29 21:14:40 2001
|
|
|
|
|
+++ src/makefiles/Makefile.freebsd Tue Jul 1 17:23:00 2003
|
|
|
|
|
@@ -16,7 +16,7 @@
|
|
|
|
|
$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
|
|
|
|
|
@echo building shared object $@
|
|
|
|
|
@rm -f $@.pic
|
|
|
|
|
- @${AR} cq $@.pic `lorder $<.obj | tsort`
|
|
|
|
|
+ @${AR} cq $@.pic
|
|
|
|
|
${RANLIB} $@.pic
|
|
|
|
|
@rm -f $@
|
|
|
|
|
$(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
|
|
|
|
|
--- src/makefiles/Makefile.openbsd.orig Wed Aug 29 21:14:40 2001
|
|
|
|
|
+++ src/makefiles/Makefile.openbsd Tue Jul 1 17:23:12 2003
|
|
|
|
|
@@ -16,7 +16,7 @@
|
|
|
|
|
$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
|
|
|
|
|
@echo building shared object $@
|
|
|
|
|
@rm -f $@.pic
|
|
|
|
|
- @${AR} cq $@.pic `lorder $<.obj | tsort`
|
|
|
|
|
+ @${AR} cq $@.pic
|
|
|
|
|
${RANLIB} $@.pic
|
|
|
|
|
@rm -f $@
|
|
|
|
|
$(LD) -x -Bshareable -Bforcearchive \
|
|
|
|
|
--- src/makefiles/Makefile.netbsd.orig Wed Aug 29 21:14:40 2001
|
|
|
|
|
+++ src/makefiles/Makefile.netbsd Tue Jul 1 17:23:39 2003
|
|
|
|
|
@@ -18,7 +18,7 @@
|
|
|
|
|
$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
|
|
|
|
|
@echo building shared object $@
|
|
|
|
|
@rm -f $@.pic
|
|
|
|
|
- @${AR} cq $@.pic `lorder $<.obj | tsort`
|
|
|
|
|
+ @${AR} cq $@.pic
|
|
|
|
|
${RANLIB} $@.pic
|
|
|
|
|
@rm -f $@
|
|
|
|
|
$(LD) -x -Bshareable -Bforcearchive \
|
|
|
|
|
Index: src/template/freebsd
|
|
|
|
|
--- src/template/freebsd.orig 2004-12-02 19:11:40.000000000 +0100
|
|
|
|
|
+++ src/template/freebsd 2005-02-16 17:09:09.617038264 +0100
|
|
|
|
|
@@ -1,3 +1,3 @@
|
|
|
|
|
case $host_cpu in
|
|
|
|
|
- alpha*) CFLAGS="-O";; # alpha has problems with -O2
|
|
|
|
|
+ alpha*) CFLAGS=`echo "x$CFLAGS" | sed -e 's;^x;;' -e 's;-O2;-O;'`;; # alpha has problems with -O2
|
|
|
|
|
esac
|
|
|
|
|
Index: src/template/linux
|
|
|
|
|
--- src/template/linux.orig 2004-12-02 19:11:40.000000000 +0100
|
|
|
|
|
+++ src/template/linux 2005-02-16 17:08:13.160599508 +0100
|
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
|
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
|
|
|
|
|
-CPPFLAGS="-D_GNU_SOURCE"
|
|
|
|
|
+CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
A small patch to allow DSO-based PostgreSQL extensions to be more
|
|
|
|
|
flexible by providing initialization and finishing hooks. This patch was
|
|
|
|
|
contributed by Ralf S. Engelschall to the upstream vendor in August 2006
|
|
|
|
|
and taken over by the upstream vendor for inclusion into the next major
|
|
|
|
|
PostgreSQL release.
|
|
|
|
|
|
|
|
|
|
http://groups.google.com/group/pgsql.hackers/browse_frm/thread/ce7858f865a6fecd/19a3f052656f3a69?tvc=1&q=PG_init#19a3f052656f3a69
|
|
|
|
|
|
|
|
|
|
Index: src/backend/utils/fmgr/dfmgr.c
|
|
|
|
|
--- src/backend/utils/fmgr/dfmgr.c.orig 2005-10-15 04:49:32 +0200
|
|
|
|
|
+++ src/backend/utils/fmgr/dfmgr.c 2006-10-07 11:53:58 +0200
|
|
|
|
|
@@ -60,6 +60,10 @@
|
|
|
|
|
static char *expand_dynamic_library_name(const char *name);
|
|
|
|
|
static char *substitute_libpath_macro(const char *name);
|
|
|
|
|
|
|
|
|
|
+/* types for PostgreSQL-specific DSO init/fini functions */
|
|
|
|
|
+typedef void (*PG_init_t)(void);
|
|
|
|
|
+typedef void (*PG_fini_t)(void);
|
|
|
|
|
+
|
|
|
|
|
/*
|
|
|
|
|
* Load the specified dynamic-link library file, and look for a function
|
|
|
|
|
* named funcname in it. (funcname can be NULL to just load the file.)
|
|
|
|
|
@@ -77,6 +81,7 @@
|
|
|
|
|
load_external_function(char *filename, char *funcname,
|
|
|
|
|
bool signalNotFound, void **filehandle)
|
|
|
|
|
{
|
|
|
|
|
+ PG_init_t *PG_init;
|
|
|
|
|
DynamicFileList *file_scanner;
|
|
|
|
|
PGFunction retval;
|
|
|
|
|
char *load_error;
|
|
|
|
|
@@ -146,6 +151,13 @@
|
|
|
|
|
fullname, load_error)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* optionally give the DSO a chance to initialize by calling a
|
|
|
|
|
+ PostgreSQL-specific (and this way portable) "_PG_init" function
|
|
|
|
|
+ similar to what dlopen(3) implicitly does with "_init" on some
|
|
|
|
|
+ Unix platforms. */
|
|
|
|
|
+ if ((PG_init = (PG_init_t *)pg_dlsym(file_scanner->handle, "_PG_init")) != NULL)
|
|
|
|
|
+ (*PG_init)();
|
|
|
|
|
+
|
|
|
|
|
/* OK to link it into list */
|
|
|
|
|
if (file_list == NULL)
|
|
|
|
|
file_list = file_scanner;
|
|
|
|
|
@@ -187,6 +199,7 @@
|
|
|
|
|
void
|
|
|
|
|
load_file(char *filename)
|
|
|
|
|
{
|
|
|
|
|
+ PG_fini_t *PG_fini;
|
|
|
|
|
DynamicFileList *file_scanner,
|
|
|
|
|
*prv,
|
|
|
|
|
*nxt;
|
|
|
|
|
@@ -223,6 +236,14 @@
|
|
|
|
|
prv->next = nxt;
|
|
|
|
|
else
|
|
|
|
|
file_list = nxt;
|
|
|
|
|
+
|
|
|
|
|
+ /* optionally give the DSO a chance to finish by calling
|
|
|
|
|
+ a PostgreSQL-specific (and this way portable) "_PG_fini"
|
|
|
|
|
+ function similar to what dlopen(3) implicitly does with
|
|
|
|
|
+ "_fini" on some Unix platforms. */
|
|
|
|
|
+ if ((PG_fini = (PG_fini_t *)pg_dlsym(file_scanner->handle, "_PG_fini")) != NULL)
|
|
|
|
|
+ (*PG_fini)();
|
|
|
|
|
+
|
|
|
|
|
clear_external_function_hash(file_scanner->handle);
|
|
|
|
|
pg_dlclose(file_scanner->handle);
|
|
|
|
|
free((char *) file_scanner);
|