the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: postgresql82
Version: 8.2.21
Revision: 2
Distribution: 10.4, 10.5, 10.6
Description: PostgreSQL open-source database
License: BSD
Maintainer: Benjamin Reed
Depends: <<
daemonic (>= 20010902-1),
libxml2-shlibs,
libxslt-shlibs,
passwd (>= 20030906-1),
readline5-shlibs,
%N-shlibs (>= %v-%r)
<<
BuildDepends: <<
bison,
fink (>= 0.30.0-1),
fink-mirrors (>= 0.28.7.1-2),
libxml2,
libxslt,
passwd (>= 20030906-1),
readline5,
system-openssl-dev
<<
Provides: postgresql-server
Conflicts: <<
postgresql (<< %v-%r),
postgresql-ssl (<< %v-%r)
<<
Replaces: <<
postgresql (<< %v-%r),
postgresql-ssl (<< %v-%r),
postgresql-shlibs,
postgresql-ssl-shlibs,
postgresql-python,
postgresql-ssl-python,
postgresql-perl,
postgresql-ssl-perl,
postgresql73,
postgresql73-ssl,
postgresql74 (<< %v-%r),
postgresql74-ssl (<< %v-%r)
<<
GCC: 4.0
Source: mirror:postgresql:source/v%v/postgresql-%v.tar.bz2
Source-MD5: 6f61c428e6c4acf8619a5534d0c283ac
PatchScript: <<
sed -e 's|@BUILDDIR@|%b|g' -e 's|@INSTPREFIX@|%p|g' < %{PatchFile} | patch -p1
perl -pi -e 's,^enum,static enum,' contrib/pgcrypto/pgp.h
<<
PatchFile: %n.patch
PatchFile-MD5: 964107a0f601e15937e79df17ffea814
UseMaxBuildJobs: true
ConfigureParams: --prefix=%p --libdir=%p/lib/postgresql-8.2 --with-docdir=%p/share/doc --mandir=%p/share/man --enable-multibyte --enable-recode --with-CXX --without-perl --without-python --with-openssl --with-libraries=%p/lib --with-includes=%p/include --without-tcl --without-tk --without-java --enable-odbc --with-pam --with-bonjour --enable-syslog --with-krb5 --enable-thread-safety
CompileScript: <<
#!/bin/sh -xe
export DYLD_LIBRARY_PATH="`pwd`/src/interfaces/libpq:`pwd`/src/interfaces/ecpg:$DYLD_LIBRARY_PATH"
export lt_cv_sys_max_cmd_len=65536
export CPPFLAGS="-I%p/lib/system-openssl/include -I%p/include -DHAVE_OPTRESET -fno-common"
export LDFLAGS="-L%p/lib/system-openssl/lib -L%p/lib"
export SHELL="/bin/sh -xe"
if [ -x /usr/bin/gcc-4.2 ]; then
export CC=gcc-4.2
export CXX=g++-4.2
export CPP=cpp-4.2
fi
# postgresql
perl -pi -e 's,hardcode_direct=yes,hardcode_direct=no,g' configure && \
./configure %c && \
make includedir=%p/include/postgresql includedir_internal=%p/include/postgresql/internal includedir_server=%p/include/postgresql && \
make -C contrib
<<
InstallScript: <<
#!/bin/sh -xe
export SHELL="/bin/sh -xe"
# postgresql
make install libdir=%p/lib/postgresql-8.2 includedir=%p/include/postgresql includedir_internal=%p/include/postgresql/internal includedir_server=%p/include/postgresql DESTDIR=%d INSTALLSITEMAN3DIR=%i/share/man/man3 || exit 10
make -C contrib install libdir=%p/lib/postgresql-8.2 includedir=%p/include/postgresql includedir_internal=%p/include/postgresql/internal includedir_server=%p/include/postgresql DESTDIR=%d INSTALLSITEMAN3DIR=%i/share/man/man3
ranlib %i/lib/postgresql-8.2/*.a
install -d -m 755 %i/share/doc/%N
find contrib -name README.\* -exec cp {} %i/share/doc/%N/ \;
install -d -m 755 %i/bin
install -c -m 755 pgsql.sh %i/bin/
install -d -m 755 %i/var/postgresql-8.2
echo "be sure to back up this database before any upgrades!" >> %i/var/postgresql-8.2/README
rm -rf %i/bin/postmaster
ln -sf postgres-8.2 %i/bin/postmaster
install -d -m 755 %i/var/log
ln -sf %p/var/postgresql-8.2/pgsql.log %i/var/log/pgsql-8.2.log
ln -sf postgresql-8.2/libecpg.5.2.dylib %i/lib/libecpg.dylib
ln -sf postgresql-8.2/libecpg_compat.2.2.dylib %i/lib/libecpg_compat.dylib
ln -sf postgresql-8.2/libpgtypes.2.2.dylib %i/lib/libpgtypes.dylib
ln -sf postgresql-8.2/libpq.5.0.dylib %i/lib/libpq.dylib
for file in `ls -1 %i/bin/`; do
mv "%i/bin/${file}" "%i/bin/${file}-8.2"
echo "${file}" >> %i/var/postgresql-8.2/binary.list
done
for file in `ls -1 %i/share/man/man1/`; do
mv "%i/share/man/man1/${file}" "%i/share/man/man1/${file}-8.2"
echo "${file}" >> %i/var/postgresql-8.2/man1.list
done
for file in `ls -1 %i/share/man/man7/`; do
mv "%i/share/man/man7/${file}" "%i/share/man/man7/${file}-8.2"
echo "${file}" >> %i/var/postgresql-8.2/man7.list
done
cat <
#!/bin/sh
for arg in "\$@"; do
case \$arg in
-h|--h|--he|--hel|--help)
echo "usage: \$0 [-h]"
echo ""
echo " -h, --help this help"
echo ""
exit 0;
;;
*)
echo "\$0: unknown argument '\$arg'"
exit 1;
;;
esac
done
update-alternatives --remove "libecpg.5.2.dylib" "%p/lib/postgresql-8.2/libecpg.5.2.dylib"
update-alternatives --remove "libecpg.5.dylib" "%p/lib/postgresql-8.2/libecpg.5.2.dylib"
update-alternatives --remove "libecpg_compat.2.2.dylib" "%p/lib/postgresql-8.2/libecpg_compat.2.2.dylib"
update-alternatives --remove "libecpg_compat.2.dylib" "%p/lib/postgresql-8.2/libecpg_compat.2.2.dylib"
update-alternatives --remove "libpgtypes.2.2.dylib" "%p/lib/postgresql-8.2/libpgtypes.2.2.dylib"
update-alternatives --remove "libpgtypes.2.dylib" "%p/lib/postgresql-8.2/libpgtypes.2.2.dylib"
update-alternatives --remove "libpq.5.0.dylib" "%p/lib/postgresql-8.2/libpq.5.0.dylib"
update-alternatives --remove "libpq.5.dylib" "%p/lib/postgresql-8.2/libpq.5.0.dylib"
for tuple in %p/bin:binary.list %p/share/man/man1:man1.list %p/share/man/man7:man7.list; do
TUPLE_PATH=\`echo \$tuple | cut -d: -f1\`
TUPLE_FILE=\`echo \$tuple | cut -d: -f2\`
for file in \`cat %p/var/postgresql-8.2/\${TUPLE_FILE}\`; do
update-alternatives --remove "\${file}" "\${TUPLE_PATH}/\${file}-8.2"
done
done
END
cat <
#!/bin/sh
FORCE=0
for arg in "\$@"; do
case \$arg in
-h|--h|--he|--hel|--help)
echo "usage: \$0 [-h] [-f]"
echo ""
echo " -h, --help this help"
# echo " -f, --force force this version of PostgreSQL, even if there is a newer one"
echo ""
exit 0;
;;
# -f|--f|--fo|--for|--forc|--force)
# FORCE=1
# ;;
*)
echo "\$0: unknown argument '\$arg'"
exit 1;
;;
esac
done
if [ -e "%p/lib/postgresql-8.2/libecpg.5.2.dylib" ]; then
update-alternatives --install "%p/lib/libecpg.5.2.dylib" "libecpg.5.2.dylib" "%p/lib/postgresql-8.2/libecpg.5.2.dylib" 0502000802
update-alternatives --install "%p/lib/libecpg.5.dylib" "libecpg.5.dylib" "%p/lib/postgresql-8.2/libecpg.5.2.dylib" 0502000802
else
echo "WARNING: %p/lib/postgresql-8.2/libecpg.5.2.dylib does not exist"
fi
if [ -e "%p/lib/postgresql-8.2/libecpg_compat.2.2.dylib" ]; then
update-alternatives --install "%p/lib/libecpg_compat.2.2.dylib" "libecpg_compat.2.2.dylib" "%p/lib/postgresql-8.2/libecpg_compat.2.2.dylib" 0202000802
update-alternatives --install "%p/lib/libecpg_compat.2.dylib" "libecpg_compat.2.dylib" "%p/lib/postgresql-8.2/libecpg_compat.2.2.dylib" 0202000802
else
echo "WARNING: %p/lib/postgresql-8.2/libecpg_compat.2.2.dylib does not exist"
fi
if [ -e "%p/lib/postgresql-8.2/libpgtypes.2.2.dylib" ]; then
update-alternatives --install "%p/lib/libpgtypes.2.2.dylib" "libpgtypes.2.2.dylib" "%p/lib/postgresql-8.2/libpgtypes.2.2.dylib" 0202000802
update-alternatives --install "%p/lib/libpgtypes.2.dylib" "libpgtypes.2.dylib" "%p/lib/postgresql-8.2/libpgtypes.2.2.dylib" 0202000802
else
echo "WARNING: %p/lib/postgresql-8.2/libpgtypes.2.2.dylib does not exist"
fi
if [ -e "%p/lib/postgresql-8.2/libpq.5.0.dylib" ]; then
update-alternatives --install "%p/lib/libpq.5.0.dylib" "libpq.5.0.dylib" "%p/lib/postgresql-8.2/libpq.5.0.dylib" 0500000802
update-alternatives --install "%p/lib/libpq.5.dylib" "libpq.5.dylib" "%p/lib/postgresql-8.2/libpq.5.0.dylib" 0500000802
else
echo "WARNING: %p/lib/postgresql-8.2/libpq.5.0.dylib does not exist"
fi
for tuple in %p/bin:binary.list %p/share/man/man1:man1.list %p/share/man/man7:man7.list; do
TUPLE_PATH=\`echo \$tuple | cut -d: -f1\`
TUPLE_FILE=\`echo \$tuple | cut -d: -f2\`
for file in \`cat %p/var/postgresql-8.2/\${TUPLE_FILE}\`; do
if [ -e "\${TUPLE_PATH}/\${file}-8.2" ]; then
update-alternatives --install "\${TUPLE_PATH}/\${file}" "\${file}" "\${TUPLE_PATH}/\${file}-8.2" 82
fi
done
done
END
chmod 755 %i/var/postgresql-8.2/*.sh
perl -pi -e 's,^%d,,' %i/bin/pg_config*
<<
DocFiles: COPYRIGHT HISTORY INSTALL README
SplitOff: <<
Package: %N-dev
Description: PostgreSQL development headers and libraries
Depends: %N (>= %v-%r)
Conflicts: <<
postgresql73-dev,
postgresql73-ssl-dev,
postgresql73-unified-dev,
postgresql74-dev,
postgresql74-ssl-dev,
postgresql74-unified-dev,
postgresql80-dev,
postgresql80-ssl-dev,
postgresql80-unified-dev,
postgresql81-dev,
postgresql83-dev
<<
Replaces: <<
postgresql73-dev,
postgresql73-ssl-dev,
postgresql73-unified-dev,
postgresql74-dev,
postgresql74-ssl-dev,
postgresql74-unified-dev,
postgresql80-dev,
postgresql80-ssl-dev,
postgresql80-unified-dev,
postgresql81-dev,
postgresql83-dev
<<
BuildDependsOnly: true
Files: <<
bin/pg_config*
include
lib/libecpg_compat.dylib
lib/libecpg.dylib
lib/libpgtypes.dylib
lib/libpq.dylib
lib/postgresql-8.2/*.a
lib/postgresql-8.2/libecpg.dylib
lib/postgresql-8.2/libecpg_compat.dylib
lib/postgresql-8.2/libpgtypes.dylib
lib/postgresql-8.2/libpq.dylib
share/man/man1/pg_config*
<<
PreInstScript: <<
PG_ID=`id -u postgres 2>/dev/null || true`
if [ -z "$PG_ID" ]; then
echo "Whoa there! You must have a postgres user to install this package."
echo "Please do a 'fink reinstall passwd' and make sure you hit 'y' when it"
echo "asks if you want to update your users."
exit 1
fi
<<
PostInstScript: [ -x %p/var/postgresql-8.2/update-alternatives.sh ] && %p/var/postgresql-8.2/update-alternatives.sh
PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-8.2/remove-alternatives.sh ] && %p/var/postgresql-8.2/remove-alternatives.sh; fi
<<
SplitOff2: <<
Package: %N-shlibs
Description: PostgreSQL shared libraries
Replaces: <<
postgresql73-shlibs,
postgresql73-ssl-shlibs,
postgresql73-unified-shlibs,
postgresql74-shlibs,
postgresql74-ssl-shlibs,
postgresql74-unified-shlibs,
postgresql,
postgresql-shlibs,
postgresql80-unified-shlibs,
postgresql81-shlibs
<<
Files: lib/postgresql-8.2/*.dylib var/postgresql-8.2/*.sh var/postgresql-8.2/*.list
Shlibs: <<
%p/lib/postgresql-8.2/libecpg.5.dylib 5.0.0 postgresql82-shlibs (>= 8.2.13-1)
%p/lib/postgresql-8.2/libecpg_compat.2.dylib 2.0.0 postgresql82-shlibs (>= 8.2.13-1)
%p/lib/postgresql-8.2/libpgtypes.2.dylib 2.0.0 postgresql82-shlibs (>= 8.2.13-1)
%p/lib/postgresql-8.2/libpq.5.dylib 5.0.0 postgresql82-shlibs (>= 8.2.13-1)
<<
PostInstScript: [ -x %p/var/postgresql-8.2/update-alternatives.sh ] && %p/var/postgresql-8.2/update-alternatives.sh
PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-8.2/remove-alternatives.sh ] && %p/var/postgresql-8.2/remove-alternatives.sh; fi
<<
SplitOff3: <<
Package: postgresql
Description: Upgrade package for PostgreSQL
Depends: %N (>= %v-%r)
Replaces: postgresql-ssl
DocFiles: COPYRIGHT HISTORY INSTALL README
<<
SplitOff4: <<
Package: postgresql-ssl
Description: Upgrade package for PostgreSQL
Depends: %N (>= %v-%r)
Replaces: postgresql
DocFiles: COPYRIGHT HISTORY INSTALL README
<<
PreInstScript: <<
PG_ID=`id -u postgres 2>/dev/null || true`
if [ -z "$PG_ID" ]; then
echo "Whoa there! You must have a postgres user to install this package."
echo "Please do a 'fink reinstall passwd' and make sure you hit 'y' when it"
echo "asks if you want to update your users."
exit 1
fi
<<
PostInstScript: <<
INSTALL_PHASE="$1"
[ -x %p/var/postgresql-8.2/update-alternatives.sh ] && %p/var/postgresql-8.2/update-alternatives.sh
# remove the old "pgsql" entries from netinfo; the username was switched to
# "postgres" but the old ones hang around because of the way niload works
niutil -destroy . /users/pgsql >/dev/null 2>&1 || true
niutil -destroy . /groups/pgsql >/dev/null 2>&1 || true
die () {
echo "failed"
echo ""
echo "*** bailing because an error ocurred:"
echo ""
echo "$*"
exit 1
}
# update daemonic init script if necessary
daemonic install %N >/dev/null 2>&1 || :
# get a nice port to run on
while true; do
PGPORT=$RANDOM;
if [ "$PGPORT" -gt 10000 ] && [ "$PGPORT" -lt 20000 ]; then
break
fi
done
export PGPORT
echo "- starting PostgreSQL on port $PGPORT"
if %p/bin/pgsql.sh-8.2 start >/tmp/pgstart-8.2.log 2>&1; then
sleep 5
ERROR=0
# install the plpgsql language if possible
printf -- "- attempting to install the plpgsql language in the template1 database... "
%p/bin/createlang-8.2 -U postgres -p $PGPORT plpgsql template1 >/tmp/createlang-8.2.log 2>&1 || ERROR="$?"
if [ $ERROR -eq 0 ]; then
echo "done"
elif [ $ERROR -gt 0 ] && [ $ERROR -ne 2 ]; then
echo "WARNING: an unknown error occurred inserting the plpgsql language"
else
:
fi
sleep 5
%p/bin/pgsql.sh-8.2 stop >/dev/null 2>&1 || echo "WARNING: unable to stop postgresql: run 'PGPORT=$PGPORT sudo %p/bin/pgsql.sh-8.2 stop' to try again"
else
cat <
If you wish to install it manually, run:
sudo %p/bin/pgsql.sh-8.2 start
sudo -u postgres %p/bin/createlang-8.2 plpgsql template1
END
fi
<<
PreRmScript: <<
# clean up
if [ $1 != "upgrade" ]; then
[ -x %p/var/postgresql-8.2/remove-alternatives.sh ] && %p/var/postgresql-8.2/remove-alternatives.sh
daemonic remove %N >/dev/null 2>&1 || :
fi
<<
DaemonicFile: <<
<<
Homepage: http://www.postgresql.org/
DescUsage: <<
The package runs initdb on installation as the user 'postgres'.
The best way to run it is using the supplied pgsql.sh script, i.e.
'sudo pgsql.sh start'. Or, you can run
'sudo daemonic enable %N' as root to create a
StartupItem for it.
Unless you set up admin users in the database, the easiest way to
run psql commands with administrator access is to prefix them with
the command "sudo -u postgres". This will ask you your administrator
password, and then run the command as the postgres user.
For example, to create a new database, you would run:
sudo -u postgres createdb mydb
<<
DescPackaging: <<
IMPORTANT: The location of the data files has changed from early
revisions of this package. If you're upgrading from an earlier
revision, note that this one expects the data files to be installed
at
When run from the startup script, logs output to
<<
DescPort: <<
Rearranged a lot of the PostgreSQL build to be more "correct" on
Darwin, including making proper dylibs (instead of bundles, which
ended up creating static binaries).
<<
diff -Nurd postgresql-8.2.16/contrib/Makefile postgresql-8.2.16-new/contrib/Makefile
--- postgresql-8.2.16/contrib/Makefile 2006-09-08 23:07:51.000000000 -0500
+++ postgresql-8.2.16-new/contrib/Makefile 2010-03-18 22:59:44.000000000 -0500
@@ -30,7 +30,8 @@
spi \
tablefunc \
tsearch2 \
- vacuumlo
+ vacuumlo \
+ xml2
ifeq ($(with_openssl),yes)
WANTED_DIRS += sslinfo
diff -Nurd postgresql-8.2.16/pgsql.sh postgresql-8.2.16-new/pgsql.sh
--- postgresql-8.2.16/pgsql.sh 1969-12-31 18:00:00.000000000 -0600
+++ postgresql-8.2.16-new/pgsql.sh 2010-03-18 22:59:44.000000000 -0500
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+die () {
+ echo "failed"
+ echo ""
+ echo "*** bailing because an error ocurred:"
+ echo ""
+ echo "$*"
+ exit 1
+}
+
+PREFIX="@INSTPREFIX@"
+DATADIR="${PREFIX}/var/postgresql-8.2/data"
+LOGFILE="${PREFIX}/var/postgresql-8.2/pgsql.log"
+
+export LANG=C
+unset LC_ALL
+
+SHMMAX=`sysctl kern.sysv.shmmax | cut -d' ' -f2-`
+SHMMNI=`sysctl kern.sysv.shmmni | cut -d' ' -f2-`
+SHMALL=`sysctl kern.sysv.shmall | cut -d' ' -f2-`
+
+if [ "$SHMMAX" -lt "8388608" ] || [ "$SHMMNI" -lt "64" ] || [ "$SHMALL" -lt "32768" ]; then
+ echo "WARNING: You probably need to set your shared memory resources higher for"
+ echo " PostgreSQL to function. For more information on raising your shared"
+ echo " memory settings, see:"
+ echo " http://wiki.finkproject.org/index.php/Shared_Memory_Regions_on_Darwin"
+ echo ""
+ echo " I am also creating a default configuration in /etc/sysctl.conf.pg"
+ echo " that contains values that will work with the default PostgreSQL "
+ echo " memory settings. To use it, rename it to /etc/sysctl.conf (if you"
+ echo " don't have one already) and reboot."
+ echo ""
+ echo " For now, I'll try setting your sysctl to something higher and then"
+ echo " running things anyways. Good luck! =)"
+ echo ""
+ sysctl -w kern.sysv.shmmax=8388608
+ sysctl -w kern.sysv.shmmin=1
+ sysctl -w kern.sysv.shmmni=64
+ sysctl -w kern.sysv.shmseg=8
+ sysctl -w kern.sysv.shmall=32768
+ echo ""
+ cat <
+kern.sysv.shmmax=8388608
+kern.sysv.shmmin=1
+kern.sysv.shmmni=64
+kern.sysv.shmseg=8
+kern.sysv.shmall=32768
+END
+fi
+
+if [ ! -d "$DATADIR" ]; then
+ printf -- "- making postgresql directories: "
+ sudo mkdir -p "$DATADIR"
+ sudo chown -R postgres "$DATADIR/.."
+ echo "ok"
+
+ printf -- "- initializing database in $DATADIR: "
+ sudo -u postgres ${PREFIX}/bin/initdb-8.2 -E UNICODE -D "$DATADIR" >/tmp/pgsql-init-8.2.log 2>&1 || die "couldn't initialize database"
+ echo "ok"
+fi
+
+PG_COMMAND="sudo -u postgres env"
+if [ -n "$PGPORT" ]; then
+ PG_COMMAND="$PG_COMMAND PGPORT=$PGPORT"
+fi
+PG_COMMAND="$PG_COMMAND ${PREFIX}/bin/pg_ctl-8.2"
+
+case "$1" in
+ init)
+ ;;
+ start)
+ $PG_COMMAND start -D "$DATADIR" -l "$LOGFILE"
+ ;;
+ restart)
+ $PG_COMMAND restart -D "$DATADIR" -m fast
+ ;;
+ stop)
+ $PG_COMMAND stop -D "$DATADIR" -m fast
+ ;;
+esac
diff -Nurd postgresql-8.2.16/src/Makefile.global.in postgresql-8.2.16-new/src/Makefile.global.in
--- postgresql-8.2.16/src/Makefile.global.in 2006-10-08 12:15:33.000000000 -0500
+++ postgresql-8.2.16-new/src/Makefile.global.in 2010-03-18 22:59:44.000000000 -0500
@@ -73,14 +73,14 @@
datadir := @datadir@
ifeq "$(findstring pgsql, $(datadir))" ""
ifeq "$(findstring postgres, $(datadir))" ""
-override datadir := $(datadir)/postgresql
+override datadir := $(datadir)/postgresql-8.2
endif
endif
sysconfdir := @sysconfdir@
ifeq "$(findstring pgsql, $(sysconfdir))" ""
ifeq "$(findstring postgres, $(sysconfdir))" ""
-override sysconfdir := $(sysconfdir)/postgresql
+override sysconfdir := $(sysconfdir)/postgresql-8.2
endif
endif
@@ -89,7 +89,7 @@
pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
+override pkglibdir := $(pkglibdir)/postgresql-8.2
endif
endif
@@ -109,7 +109,7 @@
ifneq (,$(docdir))
ifeq "$(findstring pgsql, $(docdir))" ""
ifeq "$(findstring postgres, $(docdir))" ""
-override docdir := $(docdir)/postgresql
+override docdir := $(docdir)/postgresql-8.2
endif
endif
endif
diff -Nurd postgresql-8.2.16/src/Makefile.shlib postgresql-8.2.16-new/src/Makefile.shlib
--- postgresql-8.2.16/src/Makefile.shlib 2006-09-19 10:36:07.000000000 -0500
+++ postgresql-8.2.16-new/src/Makefile.shlib 2010-03-18 22:59:44.000000000 -0500
@@ -107,11 +107,11 @@
ifeq ($(DLTYPE), library)
# linkable library
DLSUFFIX := .dylib
- LINK.shared = $(COMPILER) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) $(exported_symbols_list) -multiply_defined suppress
+ LINK.shared = $(CXX) $(CFLAGS) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) $(exported_symbols_list) -multiply_defined suppress
else
# loadable module (default case)
DLSUFFIX := .so
- LINK.shared = $(COMPILER) -bundle -multiply_defined suppress
+ LINK.shared = $(CXX) $(CFLAGS) -bundle -multiply_defined suppress
endif
shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
diff -Nurd postgresql-8.2.16/src/backend/storage/file/fd.c postgresql-8.2.16-new/src/backend/storage/file/fd.c
--- postgresql-8.2.16/src/backend/storage/file/fd.c 2009-12-03 05:03:55.000000000 -0600
+++ postgresql-8.2.16-new/src/backend/storage/file/fd.c 2010-03-18 22:59:44.000000000 -0500
@@ -52,6 +52,7 @@
#include "storage/ipc.h"
#include "utils/resowner.h"
+#include
/*
* We must leave some file descriptors free for system(), the dynamic loader,
@@ -346,15 +347,21 @@
int used = 0;
int highestfd = 0;
int j;
+ struct rlimit rlim;
size = 1024;
fd = (int *) palloc(size * sizeof(int));
+ getrlimit(RLIMIT_NOFILE, &rlim);
/* dup until failure or probe limit reached */
for (;;)
{
int thisfd;
+ /* Don't go beyond RLIMIT_NOFILE */
+ if (highestfd >= rlim.rlim_cur - 1)
+ break;
+
thisfd = dup(0);
if (thisfd < 0)
{
diff -Nurd postgresql-8.2.16/src/backend/utils/misc/postgresql.conf.sample postgresql-8.2.16-new/src/backend/utils/misc/postgresql.conf.sample
--- postgresql-8.2.16/src/backend/utils/misc/postgresql.conf.sample 2010-02-25 07:26:19.000000000 -0600
+++ postgresql-8.2.16-new/src/backend/utils/misc/postgresql.conf.sample 2010-03-18 22:59:44.000000000 -0500
@@ -73,7 +73,7 @@
# - Security & Authentication -
#authentication_timeout = 1min # 1s-600s
-#ssl = off # (change requires restart)
+ssl = off # (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
#password_encryption = on
#db_user_namespace = off
diff -Nurd postgresql-8.2.16/src/bin/initdb/initdb.c postgresql-8.2.16-new/src/bin/initdb/initdb.c
--- postgresql-8.2.16/src/bin/initdb/initdb.c 2009-11-19 19:28:18.000000000 -0600
+++ postgresql-8.2.16-new/src/bin/initdb/initdb.c 2010-03-18 22:59:44.000000000 -0500
@@ -119,7 +119,7 @@
/* defaults */
static int n_connections = 10;
-static int n_buffers = 50;
+static int n_buffers = 20;
static int n_fsm_pages = 20000;
/*
@@ -2679,7 +2679,7 @@
sprintf(pgdenv, "PGDATA=%s", pg_data);
putenv(pgdenv);
- if ((ret = find_other_exec(argv[0], "postgres", PG_VERSIONSTR,
+ if ((ret = find_other_exec(argv[0], "postgres-8.2", PG_VERSIONSTR,
backend_exec)) < 0)
{
char full_path[MAXPGPATH];
@@ -2689,14 +2689,14 @@
if (ret == -1)
fprintf(stderr,
- _("The program \"postgres\" is needed by %s "
+ _("The program \"postgres-8.2\" is needed by %s "
"but was not found in the\n"
"same directory as \"%s\".\n"
"Check your installation.\n"),
progname, full_path);
else
fprintf(stderr,
- _("The program \"postgres\" was found by \"%s\"\n"
+ _("The program \"postgres-8.2\" was found by \"%s\"\n"
"but was not the same version as %s.\n"
"Check your installation.\n"),
full_path, progname);
@@ -2975,9 +2975,9 @@
get_parent_directory(bin_dir);
printf(_("\nSuccess. You can now start the database server using:\n\n"
- " %s%s%spostgres%s -D %s%s%s\n"
+ " %s%s%spostgres-8.2%s -D %s%s%s\n"
"or\n"
- " %s%s%spg_ctl%s -D %s%s%s -l logfile start\n\n"),
+ " %s%s%spg_ctl-8.2%s -D %s%s%s -l logfile start\n\n"),
QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,
QUOTE_PATH, pg_data_native, QUOTE_PATH,
QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,
diff -Nurd postgresql-8.2.16/src/bin/pg_ctl/pg_ctl.c postgresql-8.2.16-new/src/bin/pg_ctl/pg_ctl.c
--- postgresql-8.2.16/src/bin/pg_ctl/pg_ctl.c 2009-11-19 19:28:18.000000000 -0600
+++ postgresql-8.2.16-new/src/bin/pg_ctl/pg_ctl.c 2010-03-18 22:59:44.000000000 -0500
@@ -629,7 +629,7 @@
postmaster_path = pg_malloc(MAXPGPATH);
- if ((ret = find_other_exec(argv0, "postgres", PM_VERSIONSTR,
+ if ((ret = find_other_exec(argv0, "postgres-8.2", PM_VERSIONSTR,
postmaster_path)) < 0)
{
char full_path[MAXPGPATH];
@@ -638,13 +638,13 @@
StrNCpy(full_path, progname, MAXPGPATH);
if (ret == -1)
- write_stderr(_("The program \"postgres\" is needed by %s "
+ write_stderr(_("The program \"postgres-8.2\" is needed by %s "
"but was not found in the\n"
"same directory as \"%s\".\n"
"Check your installation.\n"),
progname, full_path);
else
- write_stderr(_("The program \"postgres\" was found by \"%s\"\n"
+ write_stderr(_("The program \"postgres-8.2\" was found by \"%s\"\n"
"but was not the same version as %s.\n"
"Check your installation.\n"),
full_path, progname);
@@ -985,10 +985,10 @@
}
else
{
- ret = find_other_exec(argv0, "postgres", PM_VERSIONSTR, cmdLine);
+ ret = find_other_exec(argv0, "postgres-8.2", PM_VERSIONSTR, cmdLine);
if (ret != 0)
{
- write_stderr(_("%s: could not find postgres program executable\n"), progname);
+ write_stderr(_("%s: could not find postgres-8.2 program executable\n"), progname);
exit(1);
}
}
diff -Nurd postgresql-8.2.16/src/interfaces/ecpg/compatlib/Makefile postgresql-8.2.16-new/src/interfaces/ecpg/compatlib/Makefile
--- postgresql-8.2.16/src/interfaces/ecpg/compatlib/Makefile 2006-09-10 17:07:02.000000000 -0500
+++ postgresql-8.2.16-new/src/interfaces/ecpg/compatlib/Makefile 2010-03-18 22:59:44.000000000 -0500
@@ -20,6 +20,7 @@
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
+override LDFLAGS := -L../ecpglib -L../pgtypeslib -L../../libpq $(LDFLAGS)
SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) -lm \
$(PTHREAD_LIBS)
diff -Nurd postgresql-8.2.16/src/interfaces/ecpg/ecpglib/Makefile postgresql-8.2.16-new/src/interfaces/ecpg/ecpglib/Makefile
--- postgresql-8.2.16/src/interfaces/ecpg/ecpglib/Makefile 2006-09-28 09:48:45.000000000 -0500
+++ postgresql-8.2.16-new/src/interfaces/ecpg/ecpglib/Makefile 2010-03-18 22:59:44.000000000 -0500
@@ -20,6 +20,7 @@
override CPPFLAGS := -DFRONTEND \
-I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
+override LDFLAGS := -L../ecpglib -L../pgtypeslib -L../../libpq $(LDFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
# Need to recompile any libpgport object files
diff -Nurd postgresql-8.2.16/src/interfaces/ecpg/test/Makefile.regress postgresql-8.2.16-new/src/interfaces/ecpg/test/Makefile.regress
--- postgresql-8.2.16/src/interfaces/ecpg/test/Makefile.regress 2006-09-19 10:36:08.000000000 -0500
+++ postgresql-8.2.16-new/src/interfaces/ecpg/test/Makefile.regress 2010-03-18 22:59:44.000000000 -0500
@@ -2,7 +2,7 @@
-I$(libpq_srcdir) $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
-override LDFLAGS := -L../../ecpglib -L../../pgtypeslib $(LDFLAGS)
+override LDFLAGS := -L../../ecpglib -L../../pgtypeslib -L../../../libpq $(LDFLAGS)
override LIBS := -lecpg -lpgtypes $(libpq) $(LIBS) $(PTHREAD_LIBS)
ECPG = ../../preproc/ecpg -I$(srcdir)/../../include
diff -Nurd postgresql-8.2.16/src/makefiles/Makefile.darwin postgresql-8.2.16-new/src/makefiles/Makefile.darwin
--- postgresql-8.2.16/src/makefiles/Makefile.darwin 2006-11-27 23:45:43.000000000 -0600
+++ postgresql-8.2.16-new/src/makefiles/Makefile.darwin 2010-03-18 22:59:44.000000000 -0500
@@ -13,6 +13,6 @@
# Rule for building shared libs (currently used only for regression test
# shlib ... should go away, since this is not really enough knowledge)
%.so: %.o
- $(CC) $(CFLAGS) -bundle -o $@ $< $(BE_DLLLIBS)
+ $(CXX) $(CFLAGS) -bundle -undefined dynamic_lookup -o $@ $< $(BE_DLLLIBS)
sqlmansect = 7
diff -Nurd postgresql-8.2.16/src/template/darwin postgresql-8.2.16-new/src/template/darwin
--- postgresql-8.2.16/src/template/darwin 2006-03-10 22:38:40.000000000 -0600
+++ postgresql-8.2.16-new/src/template/darwin 2010-03-18 22:59:44.000000000 -0500
@@ -1,8 +1,5 @@
# $PostgreSQL: pgsql/src/template/darwin,v 1.10 2006/03/11 04:38:40 momjian Exp $
-# Apple's cpp-precomp seems a tad broken, so don't use it
-# (Note: on OS X before 10.2, you might need -traditional-cpp instead)
-CC="$CC -no-cpp-precomp"
# Select appropriate semaphore support
USE_NAMED_POSIX_SEMAPHORES=1