Info4: << Package: postgresql91 Version: 9.1.16 Revision: 3 Epoch: 1 Description: PostgreSQL open-source database License: BSD Maintainer: Benjamin Reed Depends: << daemonic (>= 20010902-1), libxml2-shlibs, libxslt-shlibs, openssl100-shlibs, passwd-postgres, readline6-shlibs, %N-shlibs (>= 1:%v-%r) << BuildDepends: << bison, fink-mirrors (>= 0.28.7.1-2), libxml2, libxslt, readline6, openssl100-dev, system-perl, tcltk, tcltk-dev << Provides: postgresql-server GCC: 4.0 #Source: mirror:postgresql:source/v%v/postgresql-%v.tar.bz2 Source: http://ftp.postgresql.org/pub/source/v%v/postgresql-%v.tar.bz2 Source-MD5: db77f7ca6123ec6b71fee983a896a24b PatchScript: << #!/bin/sh -ex sed -e 's|@BUILDDIR@|%b|g' -e 's|@INSTPREFIX@|%p|g' -e 's|@PGVERSION@|9.1|g' < %{PatchFile} | patch -p1 # If we have fink ExtUtils::ParseXS, it is early in PERL5LIB; # therefore we need the xsubpp program (also part of that # pkg). Handcoded makefiles for perl modules are bad, m'kay? fink_XSUBPP="%p/lib/perl5/ExtUtils/xsubpp" if [ -x $fink_XSUBPP ]; then perl -pi -e "s,\S+xsubpp,${fink_XSUBPP},g" src/pl/plperl/GNUmakefile fi << PatchFile: %n.patch PatchFile-MD5: ca800eba11497ef264f1ca93f9509f46 SetCPPFLAGS: -DHAVE_OPTRESET -fno-common SetLDFLAGS: -F/System/Library/Frameworks CompileScript: << #!/bin/sh -xe export PERL=/usr/bin/perl export PYTHON=/usr/bin/python ./configure \ --prefix='%p/opt/postgresql-9.1' \ --docdir='%p/share/doc/%N' \ --mandir='${prefix}/share/man' \ --infodir='${prefix}/share/info' \ --with-libraries=%p/lib \ --with-includes=%p/include \ \ --with-perl \ --with-python \ --with-tcl \ --with-tclconfig=%p/lib \ \ --enable-thread-safety \ --with-openssl \ --with-pam \ --with-bonjour \ --with-krb5 \ --with-gssapi \ \ --with-libxml \ --with-libxslt perl -pi -e 's,-arch x86_64,,g; s,-arch i386,,g; s,-arch ppc,,g' src/Makefile.global make make -C contrib << InstallScript: << #!/bin/sh -xe # postgresql make -j1 install DESTDIR="%d" BE_DLLLIBS=%p/opt/postgresql-9.1/bin/postgres make -j1 -C contrib install DESTDIR="%d" BE_DLLLIBS=%p/opt/postgresql-9.1/bin/postgres ranlib %i/opt/postgresql-9.1/lib/*.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/pgsql.sh-9.1 install -d -m 755 %i/var/postgresql-9.1 echo "be sure to back up this database before any upgrades!" >> %i/var/postgresql-9.1/README install -d -m 755 %i/var/log ln -sf %p/var/postgresql-9.1/pgsql.log %i/var/log/pgsql-9.1.log for file in `ls -1 %i/opt/postgresql-9.1/bin/`; do echo "${file}" >> %i/var/postgresql-9.1/binary.list done cat < %i/var/postgresql-9.1/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 "pgsql.sh" "%p/bin/pgsql.sh-9.1" for tuple in %p/opt/postgresql-9.1/bin:binary.list; do TUPLE_PATH=\`echo \$tuple | cut -d: -f1\` TUPLE_FILE=\`echo \$tuple | cut -d: -f2\` for file in \`cat %p/var/postgresql-9.1/\${TUPLE_FILE}\`; do update-alternatives --remove "\${file}" "\${TUPLE_PATH}/\${file}" done done END cat < %i/var/postgresql-9.1/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 update-alternatives --install "%p/bin/pgsql.sh" "pgsql.sh" "%p/bin/pgsql.sh-9.1" 91 for tuple in bin:binary.list; do TUPLE_PATH=\`echo \$tuple | cut -d: -f1\` TUPLE_FILE=\`echo \$tuple | cut -d: -f2\` for file in \`cat %p/var/postgresql-9.1/\${TUPLE_FILE}\`; do if [ -e "%p/opt/postgresql-9.1/\${TUPLE_PATH}/\${file}" ]; then #echo update-alternatives --install "%p/\${TUPLE_PATH}/\${file}" "\${file}" "%p/opt/postgresql-9.1/\${TUPLE_PATH}/\${file}" 91 update-alternatives --install "%p/\${TUPLE_PATH}/\${file}" "\${file}" "%p/opt/postgresql-9.1/\${TUPLE_PATH}/\${file}" 91 fi done done END chmod 755 %i/var/postgresql-9.1/*.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 (>= 1:%v-%r) # Even though the files are all buried to prevent filename # collisions and require special -I/-L to make them visible, # update-alternatives exposes them (and therefore maybe *other # libversions of them*) in default (visible) locations, which # would often lead to the compiler mixing both together! # --dmacks, as of Epoch 1, cleaning up u-a set by RangerRick # as of postgresql84 (only have >= 90 in 10.7 tree) Conflicts: << postgresql90-dev, postgresql91-dev, postgresql92-dev, postgresql93-dev, postgresql94-dev << Replaces: << postgresql90-dev, postgresql91-dev, postgresql92-dev, postgresql93-dev, postgresql94-dev << BuildDependsOnly: true Files: << opt/postgresql-9.1/bin/pg_config* opt/postgresql-9.1/include opt/postgresql-9.1/lib/*.a opt/postgresql-9.1/lib/libecpg_compat.dylib opt/postgresql-9.1/lib/libecpg.dylib opt/postgresql-9.1/lib/libpgtypes.dylib opt/postgresql-9.1/lib/libpq.dylib << 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-postgres' and make sure you hit" echo "'y' when it asks if you want to update your users." exit 1 fi << PostInstScript: [ -x %p/var/postgresql-9.1/update-alternatives.sh ] && %p/var/postgresql-9.1/update-alternatives.sh PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-9.1/remove-alternatives.sh ] && %p/var/postgresql-9.1/remove-alternatives.sh; fi << SplitOff2: << Package: %N-shlibs Description: PostgreSQL shared libraries Depends: openssl100-shlibs Files: << opt/postgresql-9.1/lib/lib*.*.dylib var/postgresql-9.1/*.sh var/postgresql-9.1/*.list << Shlibs: << %p/opt/postgresql-9.1/lib/libecpg.6.dylib 6.0.0 postgresql91-shlibs (>= 9.1.0-1) %p/opt/postgresql-9.1/lib/libecpg_compat.3.dylib 3.0.0 postgresql91-shlibs (>= 9.1.0-1) %p/opt/postgresql-9.1/lib/libpgtypes.3.dylib 3.0.0 postgresql91-shlibs (>= 9.1.0-1) %p/opt/postgresql-9.1/lib/libpq.5.dylib 5.0.0 postgresql91-shlibs (>= 9.1.0-1) << PostInstScript: [ -x %p/var/postgresql-9.1/update-alternatives.sh ] && %p/var/postgresql-9.1/update-alternatives.sh PreRmScript: if [ "$1" != "upgrade" ]; then [ -x %p/var/postgresql-9.1/remove-alternatives.sh ] && %p/var/postgresql-9.1/remove-alternatives.sh; fi << 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-postgres' and make sure you hit" echo "'y' when it asks if you want to update your users." exit 1 fi << PostInstScript: << INSTALL_PHASE="$1" [ -x %p/var/postgresql-9.1/update-alternatives.sh ] && %p/var/postgresql-9.1/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-9.1 start >/tmp/pgstart-9.1.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/opt/postgresql-9.1/bin/createlang -U postgres -p $PGPORT plpgsql template1 >/tmp/createlang-9.1.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-9.1 stop >/dev/null 2>&1 || echo "WARNING: unable to stop postgresql: run 'PGPORT=$PGPORT sudo %p/bin/pgsql.sh-9.1 stop' to try again" else cat </dev/null 2>&1 || : fi << DaemonicFile: << PostgreSQL database server PostgreSQL database server %p/bin/pgsql.sh-9.1 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 %p/opt/postgresql-9.1/bin/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-9.1/data. When run from the startup script, logs output to /var/postgresql-9.1/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). << <<