aboutsummaryrefslogtreecommitdiff
path: root/databases/postgresql94-server/files
diff options
context:
space:
mode:
authorPalle Girgensohn <girgen@FreeBSD.org>2014-05-18 14:44:53 +0000
committerPalle Girgensohn <girgen@FreeBSD.org>2014-05-18 14:44:53 +0000
commit871f7f31379da1ae8158460370c610c6b52183b4 (patch)
treeb4d2c17f35990de4b12e4eb870288590f7f0eb30 /databases/postgresql94-server/files
parentab00f03fe1fb21055fccbfee645aeaef88ed1365 (diff)
downloadports-871f7f31379da1ae8158460370c610c6b52183b4.tar.gz
ports-871f7f31379da1ae8158460370c610c6b52183b4.zip
Notes
Diffstat (limited to 'databases/postgresql94-server/files')
-rw-r--r--databases/postgresql94-server/files/502.pgsql.in115
-rw-r--r--databases/postgresql94-server/files/dot.cshrc.in11
-rw-r--r--databases/postgresql94-server/files/dot.profile.in22
-rw-r--r--databases/postgresql94-server/files/patch-contrib-uuid409
-rw-r--r--databases/postgresql94-server/files/patch-doc-Makefile28
-rw-r--r--databases/postgresql94-server/files/patch-doc-src-sgml-Makefile20
-rw-r--r--databases/postgresql94-server/files/patch-plpython-Makefile11
-rw-r--r--databases/postgresql94-server/files/patch-src-Makefile.shlib11
-rw-r--r--databases/postgresql94-server/files/patch-src-backend-Makefile11
-rw-r--r--databases/postgresql94-server/files/patch-src:backend:utils:misc:postgresql.conf.sample20
-rw-r--r--databases/postgresql94-server/files/pkg-message-client.in32
-rw-r--r--databases/postgresql94-server/files/pkg-message-contrib.in3
-rw-r--r--databases/postgresql94-server/files/pkg-message-plperl.in3
-rw-r--r--databases/postgresql94-server/files/pkg-message-plpython.in3
-rw-r--r--databases/postgresql94-server/files/pkg-message-pltcl.in3
-rw-r--r--databases/postgresql94-server/files/pkg-message-server.in57
-rw-r--r--databases/postgresql94-server/files/pkgIndex.tcl.in4
-rw-r--r--databases/postgresql94-server/files/postgresql.in114
18 files changed, 877 insertions, 0 deletions
diff --git a/databases/postgresql94-server/files/502.pgsql.in b/databases/postgresql94-server/files/502.pgsql.in
new file mode 100644
index 000000000000..e92f01f992cd
--- /dev/null
+++ b/databases/postgresql94-server/files/502.pgsql.in
@@ -0,0 +1,115 @@
+#!/bin/sh
+#
+# $FreeBSD: /tmp/pcvs/ports/databases/postgresql92-server/files/502.pgsql.in,v 1.4 2011-10-18 09:03:32 girgen Exp $
+#
+# Maintenance shell script to vacuum and backup database
+# Put this in /usr/local/etc/periodic/daily, and it will be run
+# every night
+#
+# Written by Palle Girgensohn <girgen@pingpong.net>
+#
+# In public domain, do what you like with it,
+# and use it at your own risk... :)
+#
+
+# Define these variables in either /etc/periodic.conf or
+# /etc/periodic.conf.local to override the default values.
+#
+# daily_pgsql_backup_enable="YES" # do backup of all databases
+# daily_pgsql_backup_enable="foo bar db1 db2" # only do backup of a limited selection of databases
+# daily_pgsql_vacuum_enable="YES" # do vacuum
+
+daily_pgsql_user=%%PG_USER%%
+daily_pgsql_vacuum_args="-U ${daily_pgsql_user} -qaz"
+daily_pgsql_pgdump_args="-U ${daily_pgsql_user} -bF c"
+daily_pgsql_pgdumpall_globals_args="-U ${daily_pgsql_user}"
+# backupdir is relative to ~pgsql home directory unless it begins with a slash:
+daily_pgsql_backupdir="~${daily_pgsql_user}/backups"
+daily_pgsql_savedays="7"
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+# allow '~´ in dir name
+eval backupdir=${daily_pgsql_backupdir}
+
+rc=0
+
+pgsql_backup() {
+ # daily_pgsql_backupdir must be writeable by user %%PG_USER%%
+ # ~%%PG_USER%% is just that under normal circumstances,
+ # but this might not be where you want the backups...
+ if [ ! -d ${backupdir} ] ; then
+ echo Creating ${backupdir}
+ mkdir -m 700 ${backupdir}; chown ${daily_pgsql_user} ${backupdir}
+ fi
+
+ echo
+ echo "PostgreSQL backups"
+
+ # Protect the data
+ umask 077
+ rc=$?
+ now=`date "+%Y-%m-%dT%H:%M:%S"`
+ file=${daily_pgsql_backupdir}/pgglobals_${now}
+ su -l ${daily_pgsql_user} -c \
+ "umask 077; pg_dumpall -g ${daily_pgsql_pgdumpall_globals_args} | gzip -9 > ${file}.gz"
+
+ db=$1
+ while shift; do
+ echo -n " $db"
+ file=${backupdir}/pgdump_${db}_${now}
+ su -l ${daily_pgsql_user} -c "umask 077; pg_dump ${daily_pgsql_pgdump_args} -f ${file} ${db}"
+ [ $? -gt 0 ] && rc=3
+ db=$1
+ done
+
+ if [ $rc -gt 0 ]; then
+ echo
+ echo "Errors were reported during backup."
+ fi
+
+ # cleaning up old data
+ find ${backupdir} \( -name 'pgdump_*' -o -name 'pgglobals_*' \) \
+ -a -mtime +${daily_pgsql_savedays} -delete
+ echo
+}
+
+case "$daily_pgsql_backup_enable" in
+ [Yy][Ee][Ss])
+ dbnames=`su -l %%PG_USER%% -c "umask 077; psql -q -t -A -d template1 -U %%PG_USER%% -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"`
+ pgsql_backup $dbnames
+ ;;
+
+ [Nn][Oo])
+ ;;
+
+ "")
+ ;;
+
+ *)
+ pgsql_backup $daily_pgsql_backup_enable
+ ;;
+esac
+
+case "$daily_pgsql_vacuum_enable" in
+ [Yy][Ee][Ss])
+
+ echo
+ echo "PostgreSQL vacuum"
+ su -l ${daily_pgsql_user} -c "vacuumdb ${daily_pgsql_vacuum_args}"
+ if [ $? -gt 0 ]
+ then
+ echo
+ echo "Errors were reported during vacuum."
+ rc=3
+ fi
+ ;;
+esac
+
+exit $rc
diff --git a/databases/postgresql94-server/files/dot.cshrc.in b/databases/postgresql94-server/files/dot.cshrc.in
new file mode 100644
index 000000000000..4069398b376e
--- /dev/null
+++ b/databases/postgresql94-server/files/dot.cshrc.in
@@ -0,0 +1,11 @@
+setenv PGLIB %%PREFIX%%/lib
+
+# note: PGDATA can be overridden by the -D startup option
+setenv PGDATA $HOME/data
+
+#You might want to set some locale stuff here
+#setenv PGDATESTYLE ISO
+#setenv LC_ALL sv_SE.ISO_8859-1
+
+# if you want to make regression tests use this TZ
+#setenv TZ PST8PDT
diff --git a/databases/postgresql94-server/files/dot.profile.in b/databases/postgresql94-server/files/dot.profile.in
new file mode 100644
index 000000000000..954e22eae8f8
--- /dev/null
+++ b/databases/postgresql94-server/files/dot.profile.in
@@ -0,0 +1,22 @@
+PGLIB=%%PREFIX%%/lib
+
+# note: PGDATA can be overridden by the -D startup option
+PGDATA=${HOME}/data
+
+export PATH PGLIB PGDATA
+
+# if you use the periodic script from share/postgresql/502.pgsql, you
+# can set these
+#PGDUMP_ARGS="-b -F c"
+#PGBACKUPDIR=${HOME}/backups
+#PGBACKUP_SAVE_DAYS=7
+#export PGBACKUPDIR PGDUMP_ARGS PGBACKUP_SAVE_DAYS
+
+#You might want to set some locale stuff here
+#PGDATESTYLE=ISO
+#LC_ALL=sv_SE.ISO_8859-1
+#export PGDATESTYLE LC_ALL
+
+# if you want to make regression tests use this TZ
+#TZ=PST8PDT
+#export TZ
diff --git a/databases/postgresql94-server/files/patch-contrib-uuid b/databases/postgresql94-server/files/patch-contrib-uuid
new file mode 100644
index 000000000000..2c957f1c7243
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-contrib-uuid
@@ -0,0 +1,409 @@
+--- contrib/uuid-ossp/Makefile.orig 2014-03-17 20:35:47.000000000 +0100
++++ contrib/uuid-ossp/Makefile 2014-03-19 20:51:44.000000000 +0100
+@@ -1,12 +1,14 @@
+ # contrib/uuid-ossp/Makefile
++# modified using http://pgfoundry.org/projects/uuid-freebsd/
++# to actually not use ossp, since uuid methods are all
++# built in into libc in FreeBSD /girgen@
+
+ MODULE_big = uuid-ossp
+ OBJS = uuid-ossp.o
+
+ EXTENSION = uuid-ossp
+ DATA = uuid-ossp--1.0.sql uuid-ossp--unpackaged--1.0.sql
+-
+-SHLIB_LINK += $(OSSP_UUID_LIBS)
++SHLIB_LINK = -lmd
+
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+--- contrib/uuid-ossp/uuid-ossp--1.0.sql.orig 2014-03-17 20:35:47.000000000 +0100
++++ contrib/uuid-ossp/uuid-ossp--1.0.sql 2014-03-19 20:51:44.000000000 +0100
+@@ -1,5 +1,12 @@
+ /* contrib/uuid-ossp/uuid-ossp--1.0.sql */
+
++-- this module is modified by girgen@ for FreeBSD using
++-- http://pgfoundry.org/projects/uuid-freebsd/
++-- based on the work of Andrew Gierth.
++-- The name is still uuid-ossp to maintain verbatim compatibility
++-- with the original ossp based module, although the built-in libc
++-- routines are actually used instead, not ossp.
++
+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
+ \echo Use '''CREATE EXTENSION "uuid-ossp"''' to load this file. \quit
+
+--- contrib/uuid-ossp/uuid-ossp.c.orig 2014-03-17 20:35:47.000000000 +0100
++++ contrib/uuid-ossp/uuid-ossp.c 2014-03-19 21:12:11.000000000 +0100
+@@ -1,11 +1,15 @@
+ /*-------------------------------------------------------------------------
+ *
+- * UUID generation functions using the OSSP UUID library
++ * UUID generation functions for FreeBSD
+ *
+ * Copyright (c) 2007-2014, PostgreSQL Global Development Group
+ *
+ * contrib/uuid-ossp/uuid-ossp.c
+ *
++ * Modified to use FreeBSD's built in uuid instead of ossp:
++ * Copyright (c) 2009 Andrew Gierth
++ *
++ * URL: http://pgfoundry.org/projects/uuid-freebsd
+ *-------------------------------------------------------------------------
+ */
+
+@@ -14,27 +18,14 @@
+ #include "utils/builtins.h"
+ #include "utils/uuid.h"
+
+-/*
+- * There's some confusion over the location of the uuid.h header file.
+- * On Debian, it's installed as ossp/uuid.h, while on Fedora, or if you
+- * install ossp-uuid from a tarball, it's installed as uuid.h. Don't know
+- * what other systems do.
+- */
+-#ifdef HAVE_OSSP_UUID_H
+-#include <ossp/uuid.h>
+-#else
+-#ifdef HAVE_UUID_H
+-#include <uuid.h>
+-#else
+-#error OSSP uuid.h not found
+-#endif
+-#endif
+-
+-/* better both be 16 */
+-#if (UUID_LEN != UUID_LEN_BIN)
+-#error UUID length mismatch
+-#endif
++/* OS has a uuid_hash that conflicts with ours; kill it*/
++/* explicit path since we do _not_ want to get any other version */
++#define uuid_hash freebsd_uuid_hash
++#include "/usr/include/uuid.h"
++#undef uuid_hash
+
++#include <md5.h>
++#include <sha.h>
+
+ PG_MODULE_MAGIC;
+
+@@ -64,163 +55,175 @@
+ PG_FUNCTION_INFO_V1(uuid_generate_v4);
+ PG_FUNCTION_INFO_V1(uuid_generate_v5);
+
+-static void
+-pguuid_complain(uuid_rc_t rc)
+-{
+- char *err = uuid_error(rc);
+-
+- if (err != NULL)
+- ereport(ERROR,
+- (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+- errmsg("OSSP uuid library failure: %s", err)));
+- else
+- ereport(ERROR,
+- (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+- errmsg("OSSP uuid library failure: error code %d", rc)));
+-}
++/* we assume that the string representation is portable and that the
++ * native binary representation might not be. But for *ns, we assume
++ * that pg's internal storage of uuids is the simple byte-oriented
++ * binary format. */
+
+-static char *
+-uuid_to_string(const uuid_t *uuid)
+-{
+- char *buf = palloc(UUID_LEN_STR + 1);
+- void *ptr = buf;
+- size_t len = UUID_LEN_STR + 1;
+- uuid_rc_t rc;
+-
+- rc = uuid_export(uuid, UUID_FMT_STR, &ptr, &len);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+-
+- return buf;
+-}
+-
+-
+-static void
+-string_to_uuid(const char *str, uuid_t *uuid)
++static Datum
++internal_uuid_create(int v, unsigned char *ns, char *ptr, int len)
+ {
+- uuid_rc_t rc;
+-
+- rc = uuid_import(uuid, UUID_FMT_STR, str, UUID_LEN_STR + 1);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+-}
++ char strbuf[40];
+
++ switch (v)
++ {
++ case 0: /* constant-value uuids: nil, or namespace uuids */
++ strlcpy(strbuf, ptr, 37);
++ break;
++
++ case 4: default: /* random uuid */
++ {
++ sprintf(strbuf, "%08lx-%04x-%04x-%04x-%04x%08lx",
++ (unsigned long) arc4random(),
++ (unsigned) (arc4random() & 0xffff),
++ (unsigned) ((arc4random() & 0xfff) | 0x4000),
++ (unsigned) ((arc4random() & 0x3fff) | 0x8000),
++ (unsigned) (arc4random() & 0xffff),
++ (unsigned long) arc4random());
++ break;
++ }
++
++ case 1: /* time/node-based uuids */
++ {
++ uuid_t uu;
++ uint32_t status = uuid_s_ok;
++ char *str = NULL;
++
++ uuid_create(&uu, &status);
++
++ if (status == uuid_s_ok)
++ {
++ uuid_to_string(&uu, &str, &status);
++ if (status == uuid_s_ok)
++ {
++ strlcpy(strbuf, str, 37);
++
++ /* PTR, if set, replaces the trailing characters of the uuid;
++ * this is to support v1mc, where a random multicast MAC is
++ * used instead of the physical one
++ */
++
++ if (ptr && len <= 36)
++ strcpy(strbuf + (36 - len), ptr);
++ }
++ if (str)
++ free(str);
++ }
+
+-static Datum
+-special_uuid_value(const char *name)
+-{
+- uuid_t *uuid;
+- char *str;
+- uuid_rc_t rc;
+-
+- rc = uuid_create(&uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+- rc = uuid_load(uuid, name);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+- str = uuid_to_string(uuid);
+- rc = uuid_destroy(uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
++ if (status != uuid_s_ok)
++ {
++ ereport(ERROR,
++ (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
++ errmsg("FreeBSD uuid library failure: %d", (int) status)));
++ }
++
++ break;
++ }
++
++ case 3: /* namespace-based MD5 uuids */
++ {
++ /* we could use pg's md5(), but we're already pulling in libmd */
++ MD5_CTX ctx;
++ unsigned char buf[16];
++
++ MD5Init(&ctx);
++ MD5Update(&ctx, ns, 16);
++ MD5Update(&ctx, (unsigned char *)ptr, len);
++ MD5Final(buf, &ctx);
++
++ sprintf(strbuf,
++ "%02x%02x%02x%02x-"
++ "%02x%02x-%02x%02x-%02x%02x-"
++ "%02x%02x%02x%02x%02x%02x",
++ buf[0], buf[1], buf[2], buf[3],
++ buf[4], buf[5], ((buf[6] & 0xf) | 0x30), buf[7],
++ ((buf[8] & 0x3F) | 0x80), buf[9], buf[10], buf[11],
++ buf[12], buf[13], buf[14], buf[15]);
++
++ break;
++ }
++
++ case 5: /* namespace-based SHA1 uuids */
++ {
++ SHA_CTX ctx;
++ unsigned char buf[20];
++
++ SHA1_Init(&ctx);
++ SHA1_Update(&ctx, ns, 16);
++ SHA1_Update(&ctx, (unsigned char *)ptr, len);
++ SHA1_Final(buf, &ctx);
++
++ sprintf(strbuf,
++ "%02x%02x%02x%02x-"
++ "%02x%02x-%02x%02x-%02x%02x-"
++ "%02x%02x%02x%02x%02x%02x",
++ buf[0], buf[1], buf[2], buf[3],
++ buf[4], buf[5], ((buf[6] & 0xf) | 0x30), buf[7],
++ ((buf[8] & 0x3F) | 0x80), buf[9], buf[10], buf[11],
++ buf[12], buf[13], buf[14], buf[15]);
++
++ break;
++ }
++ }
+
+- return DirectFunctionCall1(uuid_in, CStringGetDatum(str));
++ return DirectFunctionCall1(uuid_in, CStringGetDatum(strbuf));
+ }
+
+
+ Datum
+ uuid_nil(PG_FUNCTION_ARGS)
+ {
+- return special_uuid_value("nil");
++ return internal_uuid_create(0, NULL, "00000000-0000-0000-0000-000000000000", 36);
+ }
+
+
+ Datum
+ uuid_ns_dns(PG_FUNCTION_ARGS)
+ {
+- return special_uuid_value("ns:DNS");
++ return internal_uuid_create(0, NULL, "6ba7b810-9dad-11d1-80b4-00c04fd430c8", 36);
+ }
+
+
+ Datum
+ uuid_ns_url(PG_FUNCTION_ARGS)
+ {
+- return special_uuid_value("ns:URL");
++ return internal_uuid_create(0, NULL, "6ba7b811-9dad-11d1-80b4-00c04fd430c8", 36);
+ }
+
+
+ Datum
+ uuid_ns_oid(PG_FUNCTION_ARGS)
+ {
+- return special_uuid_value("ns:OID");
++ return internal_uuid_create(0, NULL, "6ba7b812-9dad-11d1-80b4-00c04fd430c8", 36);
+ }
+
+
+ Datum
+ uuid_ns_x500(PG_FUNCTION_ARGS)
+ {
+- return special_uuid_value("ns:X500");
+-}
+-
+-
+-static Datum
+-uuid_generate_internal(int mode, const uuid_t *ns, const char *name)
+-{
+- uuid_t *uuid;
+- char *str;
+- uuid_rc_t rc;
+-
+- rc = uuid_create(&uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+- rc = uuid_make(uuid, mode, ns, name);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+- str = uuid_to_string(uuid);
+- rc = uuid_destroy(uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+-
+- return DirectFunctionCall1(uuid_in, CStringGetDatum(str));
++ return internal_uuid_create(0, NULL, "6ba7b814-9dad-11d1-80b4-00c04fd430c8", 36);
+ }
+
+
+ Datum
+ uuid_generate_v1(PG_FUNCTION_ARGS)
+ {
+- return uuid_generate_internal(UUID_MAKE_V1, NULL, NULL);
++ return internal_uuid_create(1, NULL, NULL, 0);
+ }
+
+
+ Datum
+ uuid_generate_v1mc(PG_FUNCTION_ARGS)
+ {
+- return uuid_generate_internal(UUID_MAKE_V1 | UUID_MAKE_MC, NULL, NULL);
+-}
+-
+-
+-static Datum
+-uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
+-{
+- uuid_t *ns_uuid;
+- Datum result;
+- uuid_rc_t rc;
+-
+- rc = uuid_create(&ns_uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
+- string_to_uuid(DatumGetCString(DirectFunctionCall1(uuid_out, UUIDPGetDatum(ns))),
+- ns_uuid);
+-
+- result = uuid_generate_internal(mode,
+- ns_uuid,
+- text_to_cstring(name));
+-
+- rc = uuid_destroy(ns_uuid);
+- if (rc != UUID_RC_OK)
+- pguuid_complain(rc);
++ char buf[20];
+
+- return result;
++ sprintf(buf, "-%04x-%04x%08lx",
++ (unsigned)((arc4random() & 0x3FFF) | 0x8000),
++ /* set IEEE802 multicast and local-admin bits */
++ (unsigned)((arc4random() & 0xffff) | 0x0300),
++ (unsigned long) arc4random());
++
++ return internal_uuid_create(1, NULL, buf, 18);
+ }
+
+
+@@ -230,14 +233,15 @@
+ pg_uuid_t *ns = PG_GETARG_UUID_P(0);
+ text *name = PG_GETARG_TEXT_P(1);
+
+- return uuid_generate_v35_internal(UUID_MAKE_V3, ns, name);
++ return internal_uuid_create(3, (unsigned char *)ns,
++ VARDATA(name), VARSIZE(name) - VARHDRSZ);
+ }
+
+
+ Datum
+ uuid_generate_v4(PG_FUNCTION_ARGS)
+ {
+- return uuid_generate_internal(UUID_MAKE_V4, NULL, NULL);
++ return internal_uuid_create(4, NULL, NULL, 0);
+ }
+
+
+@@ -247,5 +251,6 @@
+ pg_uuid_t *ns = PG_GETARG_UUID_P(0);
+ text *name = PG_GETARG_TEXT_P(1);
+
+- return uuid_generate_v35_internal(UUID_MAKE_V5, ns, name);
++ return internal_uuid_create(5, (unsigned char *)ns,
++ VARDATA(name), VARSIZE(name) - VARHDRSZ);
+ }
+--- contrib/Makefile.orig 2014-03-21 08:58:32.000000000 +0100
++++ contrib/Makefile 2014-03-21 08:59:13.000000000 +0100
+@@ -52,6 +52,7 @@
+ test_parser \
+ tsearch2 \
+ unaccent \
++ uuid-ossp \
+ vacuumlo \
+ worker_spi
+
diff --git a/databases/postgresql94-server/files/patch-doc-Makefile b/databases/postgresql94-server/files/patch-doc-Makefile
new file mode 100644
index 000000000000..a366d4ca2620
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-doc-Makefile
@@ -0,0 +1,28 @@
+--- doc/src/sgml/Makefile.orig 2010-06-12 23:40:31.000000000 +0200
++++ doc/src/sgml/Makefile 2010-09-19 22:07:11.210759927 +0200
+@@ -15,14 +15,14 @@
+
+ # Make "html" the default target, since that is what most people tend
+ # to want to use.
+-html:
++man:
+
+ subdir = doc/src/sgml
+ top_builddir = ../../..
+ include $(top_builddir)/src/Makefile.global
+
+
+-all: html man
++all: man
+
+ distprep: html distprep-man
+
+@@ -285,7 +285,7 @@
+ ## Install
+ ##
+
+-install: install-html
++##install: install-html
+
+ ifneq ($(PORTNAME), sco)
+ install: install-man
diff --git a/databases/postgresql94-server/files/patch-doc-src-sgml-Makefile b/databases/postgresql94-server/files/patch-doc-src-sgml-Makefile
new file mode 100644
index 000000000000..ee9a537b1ecc
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-doc-src-sgml-Makefile
@@ -0,0 +1,20 @@
+--- doc/src/sgml/Makefile.orig 2011-10-13 16:53:51.000000000 +0200
++++ doc/src/sgml/Makefile 2011-10-13 17:05:08.000000000 +0200
+@@ -75,8 +75,6 @@
+ ## Man pages
+ ##
+
+-man distprep-man: man-stamp
+-
+ man-stamp: stylesheet-man.xsl postgres.xml
+ $(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
+ touch $@
+@@ -303,7 +301,7 @@
+ endif
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(htmldir)'/html $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum))
++ $(MKDIR_P) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum))
+
+ uninstall:
+ rm -f '$(DESTDIR)$(htmldir)/html/'* $(addprefix '$(DESTDIR)$(mandir)'/man, 1/* 3/* $(sqlmansectnum)/*)
diff --git a/databases/postgresql94-server/files/patch-plpython-Makefile b/databases/postgresql94-server/files/patch-plpython-Makefile
new file mode 100644
index 000000000000..75e27faaa43c
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-plpython-Makefile
@@ -0,0 +1,11 @@
+--- src/pl/plpython/Makefile.orig 2013-05-06 22:57:06.000000000 +0200
++++ src/pl/plpython/Makefile 2013-05-10 19:50:09.000000000 +0200
+@@ -15,7 +15,7 @@
+ ifeq (1,$(python_enable_shared))
+ shared_libpython = yes
+ else
+-ifneq (,$(wildcard $(python_libdir)/libpython*$(DLSUFFIX)*))
++ifneq (,$(wildcard $(python_libdir)/../../libpython*$(DLSUFFIX)*))
+ shared_libpython = yes
+ endif
+ endif
diff --git a/databases/postgresql94-server/files/patch-src-Makefile.shlib b/databases/postgresql94-server/files/patch-src-Makefile.shlib
new file mode 100644
index 000000000000..2435ffe1d280
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-src-Makefile.shlib
@@ -0,0 +1,11 @@
+--- src/Makefile.shlib.bak 2013-05-06 22:57:06.000000000 +0200
++++ src/Makefile.shlib 2013-05-12 23:33:16.000000000 +0200
+@@ -87,7 +87,7 @@
+ # Testing the soname variable is a reliable way to determine whether a
+ # linkable library is being built.
+ soname = $(shlib_major)
+-pkgconfigdir = $(libdir)/pkgconfig
++pkgconfigdir = $(prefix)/libdata/pkgconfig
+ else
+ # Naming convention for dynamically loadable modules
+ shlib = $(NAME)$(DLSUFFIX)
diff --git a/databases/postgresql94-server/files/patch-src-backend-Makefile b/databases/postgresql94-server/files/patch-src-backend-Makefile
new file mode 100644
index 000000000000..6d6fb0ce660b
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-src-backend-Makefile
@@ -0,0 +1,11 @@
+--- src/backend/Makefile.orig 2009-07-07 15:58:33.000000000 +0200
++++ src/backend/Makefile 2009-07-07 15:58:57.000000000 +0200
+@@ -107,6 +107,8 @@
+ # Update the commonly used headers before building the subdirectories
+ $(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h
+
++symlinks: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h
++
+
+ # The postgres.o target is needed by the rule in Makefile.global that
+ # creates the exports file when MAKE_EXPORTS = true.
diff --git a/databases/postgresql94-server/files/patch-src:backend:utils:misc:postgresql.conf.sample b/databases/postgresql94-server/files/patch-src:backend:utils:misc:postgresql.conf.sample
new file mode 100644
index 000000000000..6b1bba5f63b5
--- /dev/null
+++ b/databases/postgresql94-server/files/patch-src:backend:utils:misc:postgresql.conf.sample
@@ -0,0 +1,20 @@
+--- src/backend/utils/misc/postgresql.conf.sample.orig 2014-02-17 20:29:55.000000000 +0100
++++ src/backend/utils/misc/postgresql.conf.sample 2014-02-20 18:01:37.000000000 +0100
+@@ -295,6 +295,7 @@
+
+ # - Where to Log -
+
++log_destination = 'syslog'
+ #log_destination = 'stderr' # Valid values are combinations of
+ # stderr, csvlog, syslog, and eventlog,
+ # depending on platform. csvlog
+@@ -432,6 +433,9 @@
+ #track_io_timing = off
+ #track_functions = none # none, pl, all
+ #track_activity_query_size = 1024 # (change requires restart)
++
++# On FreeBSD, this is a performance hog, so keep it off if you need speed
++update_process_title = off
+ #update_process_title = on
+ #stats_temp_directory = 'pg_stat_tmp'
+
diff --git a/databases/postgresql94-server/files/pkg-message-client.in b/databases/postgresql94-server/files/pkg-message-client.in
new file mode 100644
index 000000000000..3f98190bbd84
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-client.in
@@ -0,0 +1,32 @@
+The PostgreSQL port has a collection of "side orders":
+
+postgresql-docs
+ For all of the html documentation
+
+p5-Pg
+ A perl5 API for client access to PostgreSQL databases.
+
+postgresql-tcltk
+ If you want tcl/tk client support.
+
+postgresql-jdbc
+ For Java JDBC support.
+
+postgresql-odbc
+ For client access from unix applications using ODBC as access
+ method. Not needed to access unix PostgreSQL servers from Win32
+ using ODBC. See below.
+
+ruby-postgres, py-PyGreSQL
+ For client access to PostgreSQL databases using the ruby & python
+ languages.
+
+postgresql-plperl, postgresql-pltcl & postgresql-plruby
+ For using perl5, tcl & ruby as procedural languages.
+
+postgresql-contrib
+ Lots of contributed utilities, postgresql functions and
+ datatypes. There you find pg_standby, pgcrypto and many other cool
+ things.
+
+etc...
diff --git a/databases/postgresql94-server/files/pkg-message-contrib.in b/databases/postgresql94-server/files/pkg-message-contrib.in
new file mode 100644
index 000000000000..2b29ffd33041
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-contrib.in
@@ -0,0 +1,3 @@
+The PostgreSQL contrib utilities have been installed. Please see
+%%PREFIX%%/share/doc/postgresql/contrib/README
+for more information.
diff --git a/databases/postgresql94-server/files/pkg-message-plperl.in b/databases/postgresql94-server/files/pkg-message-plperl.in
new file mode 100644
index 000000000000..5d0c83920563
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-plperl.in
@@ -0,0 +1,3 @@
+PL/Perl has been installed. Check the createlang(l) manpage for more
+info. You can install PL/Perl as trusted or untrusted, by using either
+"createlang plperl" or "createlang plperlu".
diff --git a/databases/postgresql94-server/files/pkg-message-plpython.in b/databases/postgresql94-server/files/pkg-message-plpython.in
new file mode 100644
index 000000000000..c413582b6295
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-plpython.in
@@ -0,0 +1,3 @@
+PL/Python has been installed. Check the createlang(l) manpage for more
+info. You can install PL/Python by using "createlang plpythonu" (it
+exists as an untrusted language only).
diff --git a/databases/postgresql94-server/files/pkg-message-pltcl.in b/databases/postgresql94-server/files/pkg-message-pltcl.in
new file mode 100644
index 000000000000..0902b858de0b
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-pltcl.in
@@ -0,0 +1,3 @@
+PL/Tcl has been installed. Check the createlang(l) manpage for more
+info. You can install pltcl as trusted or untrusted, by using either
+"createlang pltcl" or "createlang pltclu".
diff --git a/databases/postgresql94-server/files/pkg-message-server.in b/databases/postgresql94-server/files/pkg-message-server.in
new file mode 100644
index 000000000000..82a4cffc01cd
--- /dev/null
+++ b/databases/postgresql94-server/files/pkg-message-server.in
@@ -0,0 +1,57 @@
+For procedural languages and postgresql functions, please note that
+you might have to update them when updating the server.
+
+If you have many tables and many clients running, consider raising
+kern.maxfiles using sysctl(8), or reconfigure your kernel
+appropriately.
+
+The port is set up to use autovacuum for new databases, but you might
+also want to vacuum and perhaps backup your database regularly. There
+is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
+you may find useful. You can use it to backup and perfom vacuum on all
+databases nightly. Per default, it perfoms `vacuum analyze'. See the
+script for instructions. For autovacuum settings, please review
+~pgsql/data/postgresql.conf.
+
+If you plan to access your PostgreSQL server using ODBC, please
+consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
+to get the functions required for ODBC compliance.
+
+Please note that if you use the rc script,
+%%PREFIX%%/etc/rc.d/postgresql, to initialize the database, unicode
+(UTF-8) will be used to store character data by default. Set
+postgresql_initdb_flags or use login.conf settings described below to
+alter this behaviour. See the start rc script for more info.
+
+To set limits, environment stuff like locale and collation and other
+things, you can set up a class in /etc/login.conf before initializing
+the database. Add something similar to this to /etc/login.conf:
+---
+postgres:\
+ :lang=en_US.UTF-8:\
+ :setenv=LC_COLLATE=C:\
+ :tc=default:
+---
+and run `cap_mkdb /etc/login.conf'.
+Then add 'postgresql_class="postgres"' to /etc/rc.conf.
+
+======================================================================
+
+To initialize the database, run
+
+ %%PREFIX%%/etc/rc.d/postgresql initdb
+
+You can then start PostgreSQL by running:
+
+ %%PREFIX%%/etc/rc.d/postgresql start
+
+For postmaster settings, see ~pgsql/data/postgresql.conf
+
+NB. FreeBSD's PostgreSQL port logs to syslog by default
+ See ~pgsql/data/postgresql.conf for more info
+
+======================================================================
+
+To run PostgreSQL at startup, add
+'postgresql_enable="YES"' to /etc/rc.conf
+
diff --git a/databases/postgresql94-server/files/pkgIndex.tcl.in b/databases/postgresql94-server/files/pkgIndex.tcl.in
new file mode 100644
index 000000000000..bd8329b15c69
--- /dev/null
+++ b/databases/postgresql94-server/files/pkgIndex.tcl.in
@@ -0,0 +1,4 @@
+# Package-index file for Pgtcl-package. Enables you to load PostgreSQL
+# interface functions right into you TCL-interpreter as simply as
+# package require Pgtcl
+package ifneeded Pgtcl 1.3 "load %%PREFIX%%/lib/libpgtcl.so"
diff --git a/databases/postgresql94-server/files/postgresql.in b/databases/postgresql94-server/files/postgresql.in
new file mode 100644
index 000000000000..643171a44b91
--- /dev/null
+++ b/databases/postgresql94-server/files/postgresql.in
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: postgresql
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable PostgreSQL:
+#
+# postgresql_enable="YES"
+# # optional
+# postgresql_data="%%PREFIX%%/%%PG_USER%%/data"
+# postgresql_flags="-w -s -m fast"
+# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
+# postgresql_class="default"
+# postgresql_profiles=""
+#
+# See %%PREFIX%%/share/doc/postgresql/README-server for more info
+#
+# This scripts takes one of the following commands:
+#
+# start stop restart reload status initdb
+#
+# For postmaster startup options, edit ${postgresql_data}/postgresql.conf
+
+command=%%PREFIX%%/bin/pg_ctl
+
+. /etc/rc.subr
+
+load_rc_config postgresql
+
+# set defaults
+postgresql_enable=${postgresql_enable:-"NO"}
+postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
+postgresql_user=${postgresql_user:-"%%PG_USER%%"}
+eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"}
+postgresql_class=${postgresql_class:-"default"}
+postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
+
+name=postgresql
+rcvar=postgresql_enable
+extra_commands="reload initdb"
+
+start_cmd="postgresql_command start"
+stop_cmd="postgresql_command stop"
+restart_cmd="postgresql_command restart"
+reload_cmd="postgresql_command reload"
+status_cmd="postgresql_command status"
+
+initdb_cmd="postgresql_initdb"
+
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${postgresql_profiles}" != "x" ]; then
+ eval postgresql_data="\${postgresql_${profile}_data:-}"
+ if [ "x${postgresql_data}" = "x" ]; then
+ echo "You must define a data directory (postgresql_${profile}_data)"
+ exit 1
+ fi
+ eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}
+ eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}
+ eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
+ eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
+ fi
+else
+ if [ "x${postgresql_profiles}" != "x" -a "x$1" != "x" ]; then
+ for profile in ${postgresql_profiles}; do
+ eval _enable="\${postgresql_${profile}_enable}"
+ case "x${_enable:-${postgresql_enable}}" in
+ x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+ continue
+ ;;
+ x[Yy][Ee][Ss])
+ ;;
+ *)
+ if test -z "$_enable"; then
+ _var=postgresql_enable
+ else
+ _var=postgresql_"${profile}"_enable
+ fi
+ echo "Bad value" \
+ "'${_enable:-${postgresql_enable}}'" \
+ "for ${_var}. " \
+ "Profile ${profile} skipped."
+ continue
+ ;;
+ esac
+ echo "===> postgresql profile: ${profile}"
+ %%PREFIX%%/etc/rc.d/postgresql $1 ${profile}
+ retcode="$?"
+ if [ "0${retcode}" -ne 0 ]; then
+ failed="${profile} (${retcode}) ${failed:-}"
+ else
+ success="${profile} ${success:-}"
+ fi
+ done
+ exit 0
+ fi
+fi
+
+command_args="-D ${postgresql_data} ${postgresql_flags}"
+
+postgresql_command()
+{
+ su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
+}
+
+postgresql_initdb()
+{
+ su -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data}"
+}
+
+run_rc_command "$1"