postgresql80-unified stable port information

Package: postgresql80-unified
Version: 8.0.26
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),
postgresql73 (<< 7.3.4-14),
postgresql73-ssl (<< 7.3.4-14),
postgresql80 (<< %v-%r),
postgresql80-ssl (<< %v-%r)
<<
Replaces: <<
postgresql,
postgresql-shlibs,
postgresql-ssl,
postgresql-ssl-shlibs,
postgresql-python,
postgresql-ssl-python,
postgresql-perl,
postgresql-ssl-perl,
postgresql73,
postgresql73-ssl,
postgresql73-unified,
postgresql74,
postgresql74-ssl,
postgresql74-unified,
postgresql80,
postgresql80-ssl
<<
GCC: 4.0

Source: mirror:postgresql:source/v%v/postgresql-%v.tar.bz2
Source-MD5: 6ea1097fd4a57102ec023bc5cca7a35e
PatchScript: sed -e 's|@BUILDDIR@|%b|g' -e 's|@INSTPREFIX@|%p|g' < %{PatchFile} | patch -p1
PatchFile: %n.patch
PatchFile-MD5: e9ccf99481c187524edf8205ffa6a083

SetMAKEFLAGS: -j1
NoSetMAKEFLAGS: true
UseMaxBuildJobs: false
ConfigureParams: --prefix=%p --libdir=%p/lib/postgresql-8.0 --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-rendezvous --enable-syslog --with-krb5 --enable-thread-safety
CompileScript: <<
#!/bin/sh -xe

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.0 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.0 includedir=%p/include/postgresql includedir_internal=%p/include/postgresql/internal includedir_server=%p/include/postgresql DESTDIR=%d INSTALLSITEMAN3DIR=%i/share/man/man3
install -m 755 contrib/adddepend/adddepend %i/bin/adddepend

find %i/share -ls > /tmp/sharefiles-postgresql.txt
mv %i/share/doc/postgresql-8.0 %i/share/doc/%N >/dev/null 2>&1

ranlib %i/lib/postgresql-8.0/*.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.0
echo "be sure to back up this database before any upgrades!" >> %i/var/postgresql-8.0/README

rm -rf %i/bin/postmaster
ln -sf postgres-8.0 %i/bin/postmaster

install -d -m 755 %i/var/log
ln -sf %p/var/postgresql-8.0/pgsql.log %i/var/log/pgsql-8.0.log

ln -sf postgresql-8.0/libecpg.5.0.dylib %i/lib/libecpg.dylib
ln -sf postgresql-8.0/libecpg_compat.2.0.dylib %i/lib/libecpg_compat.dylib
ln -sf postgresql-8.0/libpgtypes.2.0.dylib %i/lib/libpgtypes.dylib
ln -sf postgresql-8.0/libpq.4.0.dylib %i/lib/libpq.dylib

for file in `ls -1 %i/bin/`; do
mv "%i/bin/${file}" "%i/bin/${file}-8.0"
echo "${file}" >> %i/var/postgresql-8.0/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.0"
echo "${file}" >> %i/var/postgresql-8.0/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.0"
echo "${file}" >> %i/var/postgresql-8.0/man7.list
done

cat < %i/var/postgresql-8.0/remove-alternatives.sh
#!/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.0.dylib" "%p/lib/postgresql-8.0/libecpg.5.0.dylib"
update-alternatives --remove "libecpg.5.dylib" "%p/lib/postgresql-8.0/libecpg.5.0.dylib"

update-alternatives --remove "libecpg_compat.2.0.dylib" "%p/lib/postgresql-8.0/libecpg_compat.2.0.dylib"
update-alternatives --remove "libecpg_compat.2.dylib" "%p/lib/postgresql-8.0/libecpg_compat.2.0.dylib"

update-alternatives --remove "libpgtypes.2.0.dylib" "%p/lib/postgresql-8.0/libpgtypes.2.0.dylib"
update-alternatives --remove "libpgtypes.2.dylib" "%p/lib/postgresql-8.0/libpgtypes.2.0.dylib"

update-alternatives --remove "libpq.4.0.dylib" "%p/lib/postgresql-8.0/libpq.4.0.dylib"
update-alternatives --remove "libpq.4.dylib" "%p/lib/postgresql-8.0/libpq.4.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.0/\${TUPLE_FILE}\`; do
# echo update-alternatives --remove "\${file}" "\${TUPLE_PATH}/\${file}-8.0"
update-alternatives --remove "\${file}" "\${TUPLE_PATH}/\${file}-8.0"
done
done

END

cat < %i/var/postgresql-8.0/update-alternatives.sh
#!/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.0/libecpg.5.0.dylib" ]; then
update-alternatives --install "%p/lib/libecpg.5.0.dylib" "libecpg.5.0.dylib" "%p/lib/postgresql-8.0/libecpg.5.0.dylib" 0500000800
update-alternatives --install "%p/lib/libecpg.5.dylib" "libecpg.5.dylib" "%p/lib/postgresql-8.0/libecpg.5.0.dylib" 0500000800
else
echo "WARNING: %p/lib/postgresql-8.0/libecpg.5.0.dylib does not exist"
fi

if [ -e "%p/lib/postgresql-8.0/libecpg_compat.2.0.dylib" ]; then
update-alternatives --install "%p/lib/libecpg_compat.2.0.dylib" "libecpg_compat.2.0.dylib" "%p/lib/postgresql-8.0/libecpg_compat.2.0.dylib" 0200000800
update-alternatives --install "%p/lib/libecpg_compat.2.dylib" "libecpg_compat.2.dylib" "%p/lib/postgresql-8.0/libecpg_compat.2.0.dylib" 0200000800
else
echo "WARNING: %p/lib/postgresql-8.0/libecpg_compat.2.0.dylib does not exist"
fi

if [ -e "%p/lib/postgresql-8.0/libpgtypes.2.0.dylib" ]; then
update-alternatives --install "%p/lib/libpgtypes.2.0.dylib" "libpgtypes.2.0.dylib" "%p/lib/postgresql-8.0/libpgtypes.2.0.dylib" 0200000800
update-alternatives --install "%p/lib/libpgtypes.2.dylib" "libpgtypes.2.dylib" "%p/lib/postgresql-8.0/libpgtypes.2.0.dylib" 0200000800
else
echo "WARNING: %p/lib/postgresql-8.0/libpgtypes.2.0.dylib does not exist"
fi

if [ -e "%p/lib/postgresql-8.0/libpq.4.0.dylib" ]; then
update-alternatives --install "%p/lib/libpq.4.0.dylib" "libpq.4.0.dylib" "%p/lib/postgresql-8.0/libpq.4.0.dylib" 0400000800
update-alternatives --install "%p/lib/libpq.4.dylib" "libpq.4.dylib" "%p/lib/postgresql-8.0/libpq.4.0.dylib" 0400000800
else
echo "WARNING: %p/lib/postgresql-8.0/libpq.4.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.0/\${TUPLE_FILE}\`; do
if [ -e "\${TUPLE_PATH}/\${file}-8.0" ]; then
update-alternatives --install "\${TUPLE_PATH}/\${file}" "\${file}" "\${TUPLE_PATH}/\${file}-8.0" 80
fi
done
done

END

chmod 755 %i/var/postgresql-8.0/*.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: <<
postgresql-dev,
postgresql-ssl-dev,
postgresql (<< %v-%r),
postgresql-ssl (<< %v-%r),
postgresql73-dev,
postgresql73-ssl-dev,
postgresql73-unified-dev,
postgresql74-dev,
postgresql74-ssl-dev,
postgresql74-unified-dev,
postgresql80-dev (<< %v-%r),
postgresql80-ssl-dev (<< %v-%r),
postgresql81-dev,
postgresql82-dev,
postgresql83-dev
<<
Replaces: <<
postgresql-dev,
postgresql-ssl-dev,
postgresql73-dev,
postgresql73-ssl-dev,
postgresql73-unified-dev,
postgresql74-dev,
postgresql74-ssl-dev,
postgresql74-unified-dev,
postgresql80-dev,
postgresql80-ssl-dev,
%N,
postgresql74-shlibs,
postgresql74-ssl-shlibs,
postgresql74-unified-shlibs,
postgresql81-dev,
postgresql82-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.0/*.a
lib/postgresql-8.0/libecpg_compat.dylib
lib/postgresql-8.0/libecpg.dylib
lib/postgresql-8.0/libpgtypes.dylib
lib/postgresql-8.0/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.0/update-alternatives.sh ] && %p/var/postgresql-8.0/update-alternatives.sh
PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-8.0/remove-alternatives.sh ] && %p/var/postgresql-8.0/remove-alternatives.sh; fi
<<
SplitOff2: <<
Package: %N-shlibs
Description: PostgreSQL shared libraries
Conflicts: <<
postgresql-shlibs,
postgresql-ssl-shlibs,
postgresql80-shlibs (<< %v-%r),
postgresql80-ssl-shlibs (<< %v-%r)
<<
Replaces: <<
%N,
postgresql-shlibs,
postgresql-ssl-shlibs,
postgresql73-shlibs,
postgresql73-ssl-shlibs,
postgresql73-unified-shlibs,
postgresql74-shlibs,
postgresql74-ssl-shlibs,
postgresql74-unified-shlibs,
postgresql80-shlibs,
postgresql80-ssl-shlibs
<<
Files: lib/postgresql-8.0/*.dylib var/postgresql-8.0/*.sh var/postgresql-8.0/*.list
Shlibs: <<
%p/lib/postgresql-8.0/libecpg.5.dylib 5.0.0 postgresql80-unified-shlibs (>= 8.0.21-1)
%p/lib/postgresql-8.0/libecpg_compat.2.dylib 2.0.0 postgresql80-unified-shlibs (>= 8.0.21-1)
%p/lib/postgresql-8.0/libpgtypes.2.dylib 2.0.0 postgresql80-unified-shlibs (>= 8.0.21-1)
%p/lib/postgresql-8.0/libpq.4.dylib 4.0.0 postgresql80-unified-shlibs (>= 8.0.21-1)
<<
PostInstScript: [ -x %p/var/postgresql-8.0/update-alternatives.sh ] && %p/var/postgresql-8.0/update-alternatives.sh
PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-8.0/remove-alternatives.sh ] && %p/var/postgresql-8.0/remove-alternatives.sh; fi
<<
SplitOff3: <<
Package: postgresql80
Description: Upgrade package for PostgreSQL 8.0
Depends: <<
%N (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
DocFiles: COPYRIGHT HISTORY INSTALL README
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
<<
<<
SplitOff4: <<
Package: postgresql80-dev
Description: Upgrade package for PostgreSQL 8.0 development
Depends: <<
%N-dev (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
BuildDependsOnly: true
DocFiles: COPYRIGHT HISTORY INSTALL README
<<
SplitOff5: <<
Package: postgresql80-shlibs
Description: Upgrade package for PostgreSQL 8.0 libraries
Depends: <<
%N-shlibs (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
DocFiles: COPYRIGHT HISTORY INSTALL README
<<
SplitOff6: <<
Package: postgresql80-ssl
Description: Upgrade package for PostgreSQL 8.0 (SSL)
Depends: <<
%N (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
DocFiles: COPYRIGHT HISTORY INSTALL README
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
<<
<<
SplitOff7: <<
Package: postgresql80-ssl-dev
Description: Upgrade package for PostgreSQL 8.0 development (SSL)
Depends: <<
%N-dev (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
BuildDependsOnly: true
DocFiles: COPYRIGHT HISTORY INSTALL README
<<
SplitOff8: <<
Package: postgresql80-ssl-shlibs
Description: Upgrade package for PostgreSQL 8.0 libraries (SSL)
Depends: <<
%N-shlibs (>= %v-%r),
fink (>= 0.30.0-1),
fink-obsolete-packages
<<
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.0/update-alternatives.sh ] && %p/var/postgresql-8.0/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.0 start >/tmp/pgstart-8.0.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.0 -U postgres -p $PGPORT plpgsql template1 >/tmp/createlang-8.0.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.0 stop >/dev/null 2>&1 || echo "WARNING: unable to stop postgresql: run 'PGPORT=$PGPORT sudo %p/bin/pgsql.sh-8.0 stop' to try again"

else

cat < WARNING: unable to start postgresql on an alternate port, not installing plpgsql!

If you wish to install it manually, run:

sudo %p/bin/pgsql.sh-8.0 start
sudo -u postgres %p/bin/createlang-8.0 plpgsql template1

END

fi
<<
PreRmScript: <<
# clean up
daemonic remove postgresql >/dev/null 2>&1 || :
daemonic remove postgresql80-ssl >/dev/null 2>&1 || :
daemonic remove postgresql80 >/dev/null 2>&1 || :
if [ $1 != "upgrade" ]; then
[ -x %p/var/postgresql-8.0/remove-alternatives.sh ] && %p/var/postgresql-8.0/remove-alternatives.sh
daemonic remove %N >/dev/null 2>&1 || :
fi
<<
DaemonicFile: <<

PostgreSQL database server
PostgreSQL database server


%p/bin/pgsql.sh-8.0
start



<<

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 /var/postgresql-8.0/data.

When run from the startup script, logs output to
/var/postgresql-8.0/pgsql.log
<<
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).
<<

postgresql80-unified stable port .patch

diff -Nurd postgresql-8.0.24/contrib/Makefile postgresql-8.0.24-new/contrib/Makefile
--- postgresql-8.0.24/contrib/Makefile 2004-12-14 16:50:23.000000000 -0600
+++ postgresql-8.0.24-new/contrib/Makefile 2010-03-18 21:31:34.000000000 -0500
@@ -37,7 +37,6 @@
string \
tablefunc \
tips \
- tsearch \
tsearch2 \
userlock \
vacuumlo
diff -Nurd postgresql-8.0.24/pgsql.sh postgresql-8.0.24-new/pgsql.sh
--- postgresql-8.0.24/pgsql.sh 1969-12-31 18:00:00.000000000 -0600
+++ postgresql-8.0.24-new/pgsql.sh 2010-03-18 21:31:34.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.0/data"
+LOGFILE="${PREFIX}/var/postgresql-8.0/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 </etc/sysctl.conf.pg
+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.0 -E UNICODE -D "$DATADIR" >/tmp/pgsql-init-8.0.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.0"
+
+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.0.24/src/Makefile.global.in postgresql-8.0.24-new/src/Makefile.global.in
--- postgresql-8.0.24/src/Makefile.global.in 2005-03-25 12:18:39.000000000 -0600
+++ postgresql-8.0.24-new/src/Makefile.global.in 2010-03-18 21:31:34.000000000 -0500
@@ -65,21 +65,21 @@
libexecdir := @libexecdir@
ifeq "$(findstring pgsql, $(libexecdir))" ""
ifeq "$(findstring postgres, $(libexecdir))" ""
-override libexecdir := $(libexecdir)/postgresql
+override libexecdir := $(libexecdir)/postgresql-8.0
endif
endif

datadir := @datadir@
ifeq "$(findstring pgsql, $(datadir))" ""
ifeq "$(findstring postgres, $(datadir))" ""
-override datadir := $(datadir)/postgresql
+override datadir := $(datadir)/postgresql-8.0
endif
endif

sysconfdir := @sysconfdir@
ifeq "$(findstring pgsql, $(sysconfdir))" ""
ifeq "$(findstring postgres, $(sysconfdir))" ""
-override sysconfdir := $(sysconfdir)/postgresql
+override sysconfdir := $(sysconfdir)/postgresql-8.0
endif
endif

@@ -87,7 +87,7 @@
pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
+override pkglibdir := $(pkglibdir)/postgresql-8.0
endif
endif

@@ -95,7 +95,7 @@
pkgincludedir = $(includedir)
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
ifeq "$(findstring postgres, $(pkgincludedir))" ""
-override pkgincludedir := $(pkgincludedir)/postgresql
+override pkgincludedir := $(pkgincludedir)/postgresql-8.0
endif
endif
includedir_server = $(pkgincludedir)/server
@@ -109,7 +109,7 @@
ifneq (,$(docdir))
ifeq "$(findstring pgsql, $(docdir))" ""
ifeq "$(findstring postgres, $(docdir))" ""
-override docdir := $(docdir)/postgresql
+override docdir := $(docdir)/postgresql-8.0
endif
endif
endif
diff -Nurd postgresql-8.0.24/src/Makefile.shlib postgresql-8.0.24-new/src/Makefile.shlib
--- postgresql-8.0.24/src/Makefile.shlib 2005-12-03 14:16:50.000000000 -0600
+++ postgresql-8.0.24-new/src/Makefile.shlib 2010-03-18 21:31:34.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) -multiply_defined suppress
+ LINK.shared = $(CXX) $(CFLAGS) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) -multiply_defined suppress
else
# loadable module (default case)
DLSUFFIX := .so
- LINK.shared = $(COMPILER) -bundle
+ LINK.shared = $(CXX) $(CFLAGS) -bundle
endif
shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
diff -Nurd postgresql-8.0.24/src/backend/main/main.c postgresql-8.0.24-new/src/backend/main/main.c
--- postgresql-8.0.24/src/backend/main/main.c 2006-01-31 18:47:02.000000000 -0600
+++ postgresql-8.0.24-new/src/backend/main/main.c 2010-03-18 21:31:34.000000000 -0500
@@ -56,6 +56,7 @@
struct passwd *pw;
#endif
char *pw_name_persist;
+ char *progname;

/*
* Place platform-specific startup hacks here. This is the right
@@ -267,7 +268,26 @@
*/
len = strlen(argv[0]);

- if ((len >= 10 && strcmp(argv[0] + len - 10, "postmaster") == 0)
+ /*
+ * Find the program name, which is after the final slash in the
+ * program argument.
+ */
+ progname = strrchr(argv[0], '/');
+ if (progname != NULL)
+ {
+ progname = progname + 1;
+ }
+ else
+ {
+ progname = argv[0];
+ }
+
+ /*
+ * Now check if the program name starts with the
+ * word "postmaster", in which case PostmasterMain is called.
+ */
+ len = strlen(progname);
+ if ((len >= 10 && strncmp(progname, "postmaster", 10) == 0)
#ifdef WIN32
|| (len >= 14 && strcmp(argv[0] + len - 14, "postmaster.exe") == 0)
#endif
diff -Nurd postgresql-8.0.24/src/backend/utils/fmgr/dfmgr.c postgresql-8.0.24-new/src/backend/utils/fmgr/dfmgr.c
--- postgresql-8.0.24/src/backend/utils/fmgr/dfmgr.c 2004-12-31 16:01:31.000000000 -0600
+++ postgresql-8.0.24-new/src/backend/utils/fmgr/dfmgr.c 2010-03-18 21:31:34.000000000 -0500
@@ -305,6 +305,26 @@
pfree(full);
}

+ new = palloc(strlen(name) + strlen(".so") + 1);
+ strcpy(new, name);
+ strcat(new, ".so");
+
+ if (!have_slash)
+ {
+ full = find_in_dynamic_libpath(new);
+ pfree(new);
+ if (full)
+ return full;
+ }
+ else
+ {
+ full = substitute_libpath_macro(new);
+ pfree(new);
+ if (file_exists(full))
+ return full;
+ pfree(full);
+ }
+
new = palloc(strlen(name) + strlen(DLSUFFIX) + 1);
strcpy(new, name);
strcat(new, DLSUFFIX);
diff -Nurd postgresql-8.0.24/src/backend/utils/misc/postgresql.conf.sample postgresql-8.0.24-new/src/backend/utils/misc/postgresql.conf.sample
--- postgresql-8.0.24/src/backend/utils/misc/postgresql.conf.sample 2010-02-25 17:45:04.000000000 -0600
+++ postgresql-8.0.24-new/src/backend/utils/misc/postgresql.conf.sample 2010-03-18 21:31:34.000000000 -0500
@@ -61,7 +61,7 @@
# - Security & Authentication -

#authentication_timeout = 60 # 1-600, in seconds
-#ssl = false
+ssl = false
#ssl_renegotiation_limit = 524288 # amount of data between renegotiations
# in kilobytes
#password_encryption = true
diff -Nurd postgresql-8.0.24/src/bin/initdb/initdb.c postgresql-8.0.24-new/src/bin/initdb/initdb.c
--- postgresql-8.0.24/src/bin/initdb/initdb.c 2009-03-31 13:58:20.000000000 -0500
+++ postgresql-8.0.24-new/src/bin/initdb/initdb.c 2010-03-18 21:31:35.000000000 -0500
@@ -117,7 +117,7 @@

/* defaults */
int n_connections = 10;
-int n_buffers = 50;
+int n_buffers = 20;

/*
* Warning messages for authentication methods
@@ -2324,7 +2324,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.0", PG_VERSIONSTR,
backend_exec)) < 0)
{
char full_path[MAXPGPATH];
@@ -2334,14 +2334,14 @@

if (ret == -1)
fprintf(stderr,
- _("The program \"postgres\" is needed by %s "
+ _("The program \"postgres-8.0\" 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.0\" was found by \"%s\"\n"
"but was not the same version as %s.\n"
"Check your installation.\n"),
full_path, progname);
@@ -2628,7 +2628,7 @@
get_parent_directory(bin_dir);

printf(_("\nSuccess. You can now start the database server using:\n\n"
- " %s%s%s%spostmaster -D %s%s%s\n"
+ " %s%s%s%spostmaster-8.0 -D %s%s%s\n"
"or\n"
" %s%s%s%spg_ctl -D %s%s%s -l logfile start\n\n"),
QUOTE_PATH, bin_dir, QUOTE_PATH, (strlen(bin_dir) > 0) ? DIR_SEP : "",
diff -Nurd postgresql-8.0.24/src/bin/pg_ctl/pg_ctl.c postgresql-8.0.24-new/src/bin/pg_ctl/pg_ctl.c
--- postgresql-8.0.24/src/bin/pg_ctl/pg_ctl.c 2009-09-01 21:41:27.000000000 -0500
+++ postgresql-8.0.24-new/src/bin/pg_ctl/pg_ctl.c 2010-03-18 21:31:35.000000000 -0500
@@ -570,7 +570,7 @@

postmaster_path = xmalloc(MAXPGPATH);

- if ((ret = find_other_exec(argv0, "postmaster", PM_VERSIONSTR,
+ if ((ret = find_other_exec(argv0, "postmaster-8.0", PM_VERSIONSTR,
postmaster_path)) < 0)
{
char full_path[MAXPGPATH];
@@ -579,13 +579,13 @@
StrNCpy(full_path, progname, MAXPGPATH);

if (ret == -1)
- write_stderr(_("The program \"postmaster\" is needed by %s "
+ write_stderr(_("The program \"postmaster-8.0\" 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 \"postmaster\" was found by \"%s\"\n"
+ write_stderr(_("The program \"postmaster-8.0\" was found by \"%s\"\n"
"but was not the same version as %s.\n"
"Check your installation.\n"),
full_path, progname);
@@ -924,7 +924,7 @@
}
else
{
- ret = find_other_exec(argv0, "postmaster", PM_VERSIONSTR, cmdLine);
+ ret = find_other_exec(argv0, "postmaster-8.0", PM_VERSIONSTR, cmdLine);
if (ret != 0)
{
write_stderr(_("%s: could not find postmaster program executable\n"), progname);
diff -Nurd postgresql-8.0.24/src/interfaces/ecpg/compatlib/Makefile postgresql-8.0.24-new/src/interfaces/ecpg/compatlib/Makefile
--- postgresql-8.0.24/src/interfaces/ecpg/compatlib/Makefile 2005-03-13 16:04:45.000000000 -0600
+++ postgresql-8.0.24-new/src/interfaces/ecpg/compatlib/Makefile 2010-03-18 21:31:35.000000000 -0500
@@ -20,6 +20,7 @@
override CPPFLAGS := -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) \
$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

diff -Nurd postgresql-8.0.24/src/interfaces/ecpg/ecpglib/Makefile postgresql-8.0.24-new/src/interfaces/ecpg/ecpglib/Makefile
--- postgresql-8.0.24/src/interfaces/ecpg/ecpglib/Makefile 2005-03-13 16:04:45.000000000 -0600
+++ postgresql-8.0.24-new/src/interfaces/ecpg/ecpglib/Makefile 2010-03-18 21:31:35.000000000 -0500
@@ -19,6 +19,7 @@

override CPPFLAGS := -DFRONTEND -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 recomple any libpgport object files
diff -Nurd postgresql-8.0.24/src/makefiles/Makefile.darwin postgresql-8.0.24-new/src/makefiles/Makefile.darwin
--- postgresql-8.0.24/src/makefiles/Makefile.darwin 2006-01-19 15:20:32.000000000 -0600
+++ postgresql-8.0.24-new/src/makefiles/Makefile.darwin 2010-03-18 21:31:35.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) -bundle -o $@ $< $(BE_DLLLIBS)
+ $(CXX) -bundle -undefined dynamic_lookup -o $@ $< $(BE_DLLLIBS)

sqlmansect = 7
diff -Nurd postgresql-8.0.24/src/template/darwin postgresql-8.0.24-new/src/template/darwin
--- postgresql-8.0.24/src/template/darwin 2004-04-25 23:04:42.000000000 -0500
+++ postgresql-8.0.24-new/src/template/darwin 2010-03-18 21:31:35.000000000 -0500
@@ -1,6 +1,2 @@
-# 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

postgresql80-unified _unstable_ port .patch