[csw-devel] SF.net SVN: gar:[16858] csw/mgar/pkg/postgresql/trunk

guengel at users.sourceforge.net guengel at users.sourceforge.net
Fri Jan 20 16:02:39 CET 2012


Revision: 16858
          http://gar.svn.sourceforge.net/gar/?rev=16858&view=rev
Author:   guengel
Date:     2012-01-20 15:02:39 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
postgresql/trunk: Merged with branches/postgresql-9.1-raos.

Modified Paths:
--------------
    csw/mgar/pkg/postgresql/trunk/Makefile
    csw/mgar/pkg/postgresql/trunk/checksums
    csw/mgar/pkg/postgresql/trunk/files/cswusergroup.tmpl
    csw/mgar/pkg/postgresql/trunk/files/postgresql.conf.tmpl

Added Paths:
-----------
    csw/mgar/pkg/postgresql/trunk/files/0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch
    csw/mgar/pkg/postgresql/trunk/files/0000-Use-plain-rpath.patch
    csw/mgar/pkg/postgresql/trunk/files/0000-ecpg-usr-local-include-replacement.patch
    csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-server.postinstall.tmpl
    csw/mgar/pkg/postgresql/trunk/files/README.CSW
    csw/mgar/pkg/postgresql/trunk/files/cswpostgresql.tmpl

Removed Paths:
-------------
    csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-84.postinstall
    csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt
    csw/mgar/pkg/postgresql/trunk/files/cswpostgres.tmpl

Property Changed:
----------------
    csw/mgar/pkg/postgresql/trunk/


Property changes on: csw/mgar/pkg/postgresql/trunk
___________________________________________________________________
Added: svn:mergeinfo
   + /csw/mgar/pkg/postgresql/branches/postgresql-8.3:12252-16277
/csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos:16278-16563
/csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos:16564-16625
/csw/mgar/pkg/postgresql/branches/postgresql-9.0:11032-12251
/csw/mgar/pkg/postgresql/branches/postgresql-9.0-raos:16626
/csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos:16629-16856

Modified: csw/mgar/pkg/postgresql/trunk/Makefile
===================================================================
--- csw/mgar/pkg/postgresql/trunk/Makefile	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/Makefile	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1,264 +1,699 @@
-# Copyright 2009 OpenCSW
-# Distributed under the terms of the GNU General Public License v2
 # $Id$
-
-# This BUILD is NOT READY!  It needs work before it's usable.
-
-# TODO: Initialize the database cluster during installation if not already
-# there.
 #
-# TODO: Migration plan from 8.3: Installing 8.3 and 8.4 at the same time, and
-# migrating
+# Note 1
+# ------
 #
-# TODO: The isaexec part in GAR doesn't work very well.  Let's write a minimal
-# example of it.   (gmake repackage may produce the right output)
+# A word of caution: PostgreSQL does use autoconf, but it does *not* use
+# automake. That said, it `misses' many features found in pure
+# autoconf/automake builds, e.g. --program-suffix is not available. This also
+# explains some quirks of this recipe.
+#
+#
+# Note 2
+# ------
+#
+# The idea is to make it possible to install different major/minor versions of
+# PostgreSQL at the same time but without installing them to distinct --prefix
+# directories, which in turn makes linking against PostgreSQL easier. This has
+# been achieved as follows:
+#
+#  * libraries go into $(libdir)
+#
+#  * binaries go into $(libexec)/postgres/XY/ and alternatives are used to
+#    bring the binaries into $(prefix)/bin
+#
+# Generally, putting libraries in $(libdir) should not pose a problem, but in
+# the case of PostgresSQL, there is also a directory $(libdir)/postgres which
+# is unversioned and cannot be changed by passing arguments to configure. This
+# shortcoming can be lifted by adjusting $(pkglibdir) in
+# $(WORKSRC)/src/Makefile.global.in which is what we do.
+#
+#
+# Note 3: Alternatives
+# ------
+#
+# I was unable to get the alternatives system to work with using, for
+# instance,
+#
+#  ALTERNATIVES_CSWpostgresql83-server = server_amd64 server_pentium_pro
+#
+# and then defining those alternatives. /opt/csw/sbin/alternatives choked on
+# the one file generated for server containing two distinct alternatives. So I
+# cooked my own soup:
+#
+#  1. Create for server, client, contrib, devel separate files containing the
+#     alternatives for the ISAs
+#
+#  2. Adjust the prototype to add include the class 'cswalternatives' for the
+#     files in question.
+#
+# The problem appeared to be having two lines in the same file. So my approach
+# is to generate one file per line of alternatives.
+#
+#
+# Note 4:  New upstream releases
+# ------
+#
+# 1. Adjust BASE_VERSION and/or PATCHLEVEL.
+#
+# 2. Comment out 'post-install-modulated:'. So we can identify changes in the
+#    server/client environment.
+#
+# 3. `mgar package`
+#
+# 4. If step 3 succeeded, check the prototype of
+#    CSW$(NAME)$(BASE_VERSION_NODOT) for files that have slipped by and put
+#    them in the proper place.
+#
+# 5. Uncomment 'post-install-modulated:'. This will shed light on changes in
+#    the contrib environment.
+#
+# 6. `mgar spotless package`
+#
+# 7. If step 6 succeeded, check the prototype of
+#    CSW$(NAME)$(BASE_VERSION_NODOT) for files that have slipped by and put
+#    them in the proper place.
+#
+#
+# Note 5: Development package
+# ------
+#
+# The development package is not versioned, i.e. named CSW$(NAME)-dev,
+# since we can only support one set of header files with a reasonable
+# amount of effort.
+#
+# Further, it does not use alternatives and puts binaries in $(bindir)
+# (see 'post-merge-modulated:'). This will make it easier for
+# maintainers to use `pg_config'.
 
 NAME = postgresql
-BASE_VERSION = 8.4
-# How to make one automatically?
-VERSION_NODOT = 8_4
-BASE_VERSION_G = 84
-PATCHLEVEL = 4
+BASE_VERSION = 9.1
+VERSION_NODOT = $(subst .,_,$(BASE_VERSION))
+BASE_VERSION_NODOT = $(subst .,,$(BASE_VERSION))
+PATCHLEVEL = 2
 VERSION = $(BASE_VERSION).$(PATCHLEVEL)
 CATEGORIES = apps
 
 # Useful when making a series of builds on the same day
 # GARFLAVOR ?= DBG
 
-DESCRIPTION = An advanced open source database
-SPKG_SOURCEURL = http://www.postgresql.org/
+VENDOR_URL = http://www.postgresql.org/
 
 define BLURB
+	PostgreSQL is a powerful, open source object-relational database system.
+	It has more than 15 years of active development and a proven architecture
+	that has earned it a strong reputation for reliability, data integrity,
+	and correctness.
 endef
 
-pgsubdir = $(NAME)$(BASE_VERSION_G)
-bindir_install = $(exec_prefix)/bin/$(pgsubdir)
-sbindir_install = $(exec_prefix)/sbin/$(pgsubdir)
-libdir_install = $(exec_prefix)/lib/$(pgsubdir)
-# libdir = $(prefix)$(version_dependent)/lib
-# Otherwise initdb can't find the right libraries, see:
-# http://archives.postgresql.org/pgsql-general/2010-01/msg00422.php
-localstatedir = /var$(prefix)/$(pgsubdir)
-sysconfdir = /etc$(prefix)/$(pgsubdir)
-datadir = $(prefix)/share/$(pgsubdir)
-docdir = $(prefix)/share/doc/$(NAME)-$(BASE_VERSION)
-includedir = $(prefix)/include/$(pgsubdir)
-infodir = $(datadir)/info
-libexecdir_install = $(exec_prefix)/libexec/$(pgsubdir)
-lispdir = $(datadir)/emacs/site-lisp
-mandir = $(datadir)/man
-sharedstatedir = $(prefix)/share/$(pgsubdir)
-sourcedir = $(prefix)/src/$(pgsubdir)
+#
+# These variables control many aspects of the build
+#
+sysconfdir-suffix-64	= /64
+sysconfdir		= /etc/opt/csw$(sysconfdir-suffix-$(MEMORYMODEL))
+PGSYSCONFDIR		= $(sysconfdir)/$(NAME)/$(BASE_VERSION_NODOT)
+PGBINDIR		= $(libexecdir)/$(NAME)/$(BASE_VERSION_NODOT)
+PGSBINDIR		= $(libexecdir)/$(NAME)/$(BASE_VERSION_NODOT)
+PGDATADIR		= $(datadir)/$(NAME)/$(BASE_VERSION_NODOT)
+PGDOCDIR		= $(datadir)/doc/$(NAME)/$(BASE_VERSION_NODOT)
+PGLOCALSTATEDIR_BASE	= $(localstatedir)/$(NAME)
+PGDATA			= $(PGLOCALSTATEDIR_BASE)/$(BASE_VERSION_NODOT)
+# This variable has been introduced for using in EXPANDVARS files
+PGNAMEVERSIONED		= $(NAME)$(BASE_VERSION_NODOT)
+# This variable has been introduced for using in EXPANDVARS files
+PGNAME_VERSIONED	= $(NAME)-$(BASE_VERSION_NODOT)
+# Those BIN_NAMES_* are used both, for package creation and alternatives.
+# 8.4 has removed ipcclean
+BIN_NAMES_SERVER	= initdb pg_controldata pg_ctl pg_resetxlog postmaster postgres
+BIN_NAMES_DEVEL		= ecpg pg_config
+BIN_NAMES_CLIENT	= clusterdb createdb createlang createuser dropdb droplang dropuser pg_dump pg_dumpall pg_restore psql reindexdb vacuumdb pg_basebackup clusterdb
+BIN_NAMES_CONTRIB	= oid2name pgbench pg_standby vacuumlo pg_upgrade pg_archivecleanup pg_test_fsync
+# These are shared objects used by the server. Please note, contrib installs
+# also shared object in the same place, so make sure you don't mix up things
+SO_NAMES_SERVER		 = ascii_and_mic.so cyrillic_and_mic.so dict_snowball.so euc_cn_and_mic.so
+SO_NAMES_SERVER 	+= euc_jp_and_sjis.so euc_kr_and_mic.so utf8_and_euc2004.so utf8_and_sjis2004.so
+SO_NAMES_SERVER		+= euc_tw_and_big5.so latin2_and_win1250.so latin_and_mic.so plpgsql.so
+SO_NAMES_SERVER		+= utf8_and_ascii.so utf8_and_big5.so utf8_and_cyrillic.so utf8_and_euc_cn.so
+SO_NAMES_SERVER		+= utf8_and_euc_jp.so utf8_and_euc_kr.so utf8_and_euc_tw.so euc2004_sjis2004.so
+SO_NAMES_SERVER		+= utf8_and_gb18030.so utf8_and_gbk.so utf8_and_iso8859.so utf8_and_iso8859_1.so
+SO_NAMES_SERVER		+= utf8_and_johab.so utf8_and_sjis.so utf8_and_uhc.so utf8_and_win.so
+# This has been introduced with 9.0
+SO_NAMES_SERVER		+= libpqwalreceiver.so
+# Those are the extension provided by the server.
+#
+# This has been introduced with 9.1
+EXT_NAMES_SERVER	 = plpgsql--1.0.sql plpgsql--unpackaged--1.0.sql plpgsql.control
+# These are shared object used by contrib. Please note, the server installs
+# also shared object in the same place, so make sure you don't mix up things
+SO_NAMES_CONTRIB 	 = _int.so adminpack.so autoinc.so btree_gist.so chkpass.so passwordcheck.so
+SO_NAMES_CONTRIB	+= cube.so dblink.so dict_int.so dict_xsyn.so earthdistance.so
+SO_NAMES_CONTRIB	+= fuzzystrmatch.so hstore.so insert_username.so pg_upgrade_support.so
+SO_NAMES_CONTRIB	+= isn.so lo.so ltree.so moddatetime.so pageinspect.so pg_buffercache.so
+SO_NAMES_CONTRIB	+= pg_freespacemap.so pg_trgm.so pgcrypto.so pgrowlocks.so pgstattuple.so
+SO_NAMES_CONTRIB	+= pgxml.so refint.so seg.so sslinfo.so tablefunc.so test_parser.so timetravel.so tsearch2.so
+SO_NAMES_CONTRIB	+= auto_explain.so btree_gin.so citext.so pg_stat_statements.so unaccent.so dummy_seclabel.so
+SO_NAMES_CONTRIB	+= auth_delay.so file_fdw.so
+# Those are the extension provided by contrib.
+#
+# This has been introduced with 9.1
+EXT_NAMES_CONTRIB	 = adminpack--1.0.sql adminpack.control
+EXT_NAMES_CONTRIB	+= autoinc--1.0.sql autoinc.control autoinc--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= btree_gin--1.0.sql btree_gin.control btree_gin--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= btree_gist--1.0.sql btree_gist.control btree_gist--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= chkpass--1.0.sql chkpass.control chkpass--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= citext--1.0.sql citext.control citext--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= cube--1.0.sql cube.control cube--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= dblink--1.0.sql dblink.control dblink--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= dict_int--1.0.sql dict_int.control dict_int--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= dict_xsyn--1.0.sql dict_xsyn.control dict_xsyn--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= earthdistance--1.0.sql earthdistance.control earthdistance--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= file_fdw--1.0.sql file_fdw.control 
+EXT_NAMES_CONTRIB	+= fuzzystrmatch--1.0.sql fuzzystrmatch.control fuzzystrmatch--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= hstore--1.0.sql hstore.control hstore--unpackaged--1.0.sql 
+EXT_NAMES_CONTRIB	+= insert_username--1.0.sql insert_username.control insert_username--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= intagg--1.0.sql intagg.control intagg--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= intarray--1.0.sql intarray.control intarray--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= isn--1.0.sql isn.control isn--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= lo--1.0.sql lo.control lo--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= ltree--1.0.sql ltree.control ltree--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= moddatetime--1.0.sql moddatetime.control moddatetime--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pageinspect--1.0.sql pageinspect.control pageinspect--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pg_buffercache--1.0.sql pg_buffercache.control pg_buffercache--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pgcrypto--1.0.sql pgcrypto.control pgcrypto--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pg_freespacemap--1.0.sql pg_freespacemap.control pg_freespacemap--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pgrowlocks--1.0.sql pgrowlocks.control pgrowlocks--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pg_stat_statements--1.0.sql pg_stat_statements.control pg_stat_statements--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pgstattuple--1.0.sql pgstattuple.control pgstattuple--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= pg_trgm--1.0.sql pg_trgm.control pg_trgm--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= refint--1.0.sql refint.control refint--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= seg--1.0.sql seg.control seg--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= sslinfo--1.0.sql sslinfo.control sslinfo--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= tablefunc--1.0.sql tablefunc.control tablefunc--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= test_parser--1.0.sql test_parser.control test_parser--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= timetravel--1.0.sql timetravel.control timetravel--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= tsearch2--1.0.sql tsearch2.control tsearch2--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= unaccent--1.0.sql unaccent.control unaccent--unpackaged--1.0.sql
+EXT_NAMES_CONTRIB	+= xml2--1.0.sql xml2.control xml2--unpackaged--1.0.sql
+# Miscellaneous files
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/conversion_create.sql
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/information_schema.sql
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/pg_hba.conf.sample
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/pg_ident.conf.sample
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/pg_service.conf.sample
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/postgres.bki
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/postgres.description
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/postgres.shdescription
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/postgresql.conf.sample
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/recovery.conf.sample
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/snowball_create.sql
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/sql_features.txt
+MISC_NAMES_SERVER	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/system_views.sql
+MISC_NAMES_CLIENT	+= .*/share/$(NAME)/$(BASE_VERSION_NODOT)/psqlrc.sample
 
-MIGRATE_FILES_CSWpostgresql-$(BASE_VERSION_G)    = postgresql.conf
-MIGRATE_DEST_DIR_CSWpostgresql-$(BASE_VERSION_G) = $(sysconfdir)
+# Used for the PostgreSQL user. Please note, although the file does not feature
+# a version number here, it will be installed with $(BASE_VERSION_NODOT)
+# appended.
+USERGROUPDIR		= $(sysconfdir)/pkg/$(NAME)
+USERGROUPFILE		= cswusergroup
+USERGROUPFILETMPL	= $(USERGROUPFILE).tmpl
+USERGROUPFILE_VERSIONED = $(USERGROUPFILE)-$(BASE_VERSION_NODOT)
 
-MASTER_SITES = http://wwwmaster.postgresql.org/redir/53/h/source/v$(VERSION)/
-DISTFILES  = $(NAME)-$(VERSION).tar.bz2
-DISTFILES += cswpostgres.tmpl
-DISTFILES += cswusergroup.tmpl
-DISTFILES += postgresql.conf.tmpl
-DISTFILES += README-CSW.txt
-# DISTFILES += CSWpostgresql-$(BASE_VERSION_G).postinstall
-include files/CSWpostgresql-$(BASE_VERSION_G).postinstall
+# The configuration file for the init.d script. Please note, although the file
+# does not feature a version number here, it will be installed with
+# $(BASE_VERSION_NODOT) inserted.
+CSWPGSQLCONFFILE	= postgresql.conf
+CSWPGSQLCONFFILETMPL    = $(CSWPGSQLCONFFILE).tmpl
+CSWPGSQLCONFFILE_VERSIONED = $(subst $(suffix $(CSWPGSQLCONFFILE)),,$(CSWPGSQLCONFFILE))-$(BASE_VERSION_NODOT).conf
 
-PACKAGES += CSWpostgresql
-PACKAGES += CSWlibpq-$(BASE_VERSION_G)
-PACKAGES += CSWpostgresql-$(BASE_VERSION_G)
-PACKAGES += CSWpostgresql-$(BASE_VERSION_G)-dev
-PACKAGES += CSWpostgresql-$(BASE_VERSION_G)-doc
+# The initscript. Please note, although the file does not feature a version
+# number here, it will be installed with $(BASE_VERSION_NODOT) appended
+INITSCRIPTFILE		= cswpostgresql
+INITSCRIPTFILETMPL	= $(INITSCRIPTFILE).tmpl
+INITSCRIPTFILE_VERSIONED = $(INITSCRIPTFILE)-$(BASE_VERSION_NODOT)
 
-CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)      = postgresql_$(BASE_VERSION_G)
-CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)-doc  = postgresql_$(BASE_VERSION_G)_doc
-CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)-dev  = postgresql_$(BASE_VERSION_G)_devel
-CATALOGNAME_CSWlibpq-$(BASE_VERSION_G)           = libpq$(BASE_VERSION_G)
-CATALOGNAME_CSWpostgresql                        = postgresql
+# The postinstall script for the postgreSQL server
+SERVERPOSTINSTTMPL  = CSWpostgresql-server.postinstall.tmpl
+SERVERPOSTINST_VERSIONED = CSW$(NAME)$(BASE_VERSION_NODOT)-server.postinstall
 
-SPKG_DEST_CSWpostgresql                       = An advanced open source database, a metapackage
-SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)     = An advanced open source database, version $(BASE_VERSION).x
-SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)-doc = PostgreSQL $(BASE_VERSION).x Documentation
-SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)-dev = PostgreSQL $(BASE_VERSION).x Developer Files
-SPKG_DESC_CSWlibpq-$(BASE_VERSION_G)          = PostgreSQL $(BASE_VERSION).x Libraries
 
-RUNTIME_DEP_PKGS_CSWpostgresql                        = CSWpostgresql-$(BASE_VERSION_G)
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWkrb5lib
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibgnugetopt
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibpq-$(BASE_VERSION_G)
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibxml2
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibxslt
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWosslrt
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWreadline
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWzlib
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWkrb5lib
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWosslrt
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)-dev  = CSWpostgresql-$(BASE_VERSION_G)
+# These are the alternatives provided for the packages.  I use them in the
+# recipe to iterate over all possible alternatives (see 'post-merge:')
+#
+# Please note that these should correspond to the package suffixes.
+myALTERNATIVES = server client contrib
 
-CHECKPKG_OVERRIDES_CSWpostgresql += surplus-dependency|CSWpostgresql-84
-CHECKPKG_OVERRIDES_CSWpostgresql-84-dev += surplus-dependency|CSWpostgresql-84
+POSTMSG = $(foreach n,$(myALTERNATIVES),\
+	$(docdir)/$(NAME)$(BASE_VERSION_NODOT)_$(n)/CSW$(NAME)$(BASE_VERSION_NODOT)-$(n).postmsg\
+)
 
-ARCHALL_CSWpostgresql                       = 1
-ARCHALL_CSWpostgresql-$(BASE_VERSION_G)-doc = 1
-ARCHALL_CSWpostgresql-$(BASE_VERSION_G)-doc = 1
+MASTER_SITES = http://ftp.postgresql.org/pub/source/v$(VERSION)/
+DISTFILES  = $(NAME)-$(VERSION).tar.bz2
+DISTFILES += README.CSW
+DISTFILES += $(SERVERPOSTINSTTMPL)
+DISTFILES += $(INITSCRIPTFILETMPL)
+DISTFILES += $(USERGROUPFILETMPL)
+DISTFILES += $(CSWPGSQLCONFFILETMPL)
+DISTFILES += $(notdir $(POSTMSG))
+NOCHECKSUM = $(notdir $(POSTMSG))
 
+EXPANDVARS  = $(CSWPGSQLCONFFILETMPL)
+EXPANDVARS += $(INITSCRIPTFILETMPL)
+EXPANDVARS += $(CSWPGSQLCONFFILETMPL)
+EXPANDVARS += $(SERVERPOSTINSTTMPL)
+EXPANDVARS += $(USERGROUPFILETMPL)
+EXPANDVARS += README.CSW
+
+# This patch will replace /usr/local/include by /opt/csw/include in
+# ecpg.c and thus silence a checkpkg error.
+PATCHFILES += 0000-ecpg-usr-local-include-replacement.patch
+# Test running on a NFS may fail. Thus we let the test run in
+# /var/tmp/pgsql/tmp_check
+PATCHFILES += 0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch
+# By default, src/makefiles/Makefile.solaris uses -Wl,-R'$(rpathdir)'
+# which isn't properly digested by Sun's ld
+PATCHFILES += 0000-Use-plain-rpath.patch
+
+INITSMF = $(sysconfdir)/init\.d/$(INITSCRIPTFILE_VERSIONED)
+USERGROUP = $(USERGROUPDIR)/$(USERGROUPFILE_VERSIONED)
+PRESERVECONF = $(sysconfdir)/$(CSWPGSQLCONFFILE_VERSIONED)
+
 LICENSE = COPYRIGHT
 
-EXTRA_INC = $(BUILD_PREFIX)/include
-EXTRA_LIB = $(BUILD_PREFIX)/lib
+# The alternatives modifier should stay in place, until I figured out
+# how to properly employ the ALTERNATIVES system in this build.
+PROTOTYPE_MODIFIERS = pgdata alternatives
+PROTOTYPE_FILES_pgdata = $(PGLOCALSTATEDIR_BASE).*
+PROTOTYPE_USER_pgdata = postgres
+PROTOTYPE_GROUP_pgdata = sys
+PROTOTYPE_PERMS_pgdata = 0700
+PROTOTYPE_CLASS_pgdata = ugfiles
+PROTOTYPE_FILES_alternatives = .*/alternatives/$(NAME)$(BASE_VERSION_NODOT).*
+PROTOTYPE_CLASS_alternatives = cswalternatives
 
-EXTRA_LD_OPTIONS  = -R$(prefix)/lib/\$$ISALIST
+# This is the catchall package. It should not contain any files from
+# $(PKGROOT). After building all the packages, I check the prototype of this
+# package to make sure there are no files slipped by.
+PACKAGES = CSW$(NAME)$(BASE_VERSION_NODOT)
+SPKG_DESC_CSW$(NAME)$(BASE_VERSION_NODOT) = PostgreSQL $(VERSION), Meta Package
+ARCHALL_CSW$(NAME)$(BASE_VERSION_NODOT) = 1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)  = CSW$(NAME)$(BASE_VERSION_NODOT)-server
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT) += CSW$(NAME)$(BASE_VERSION_NODOT)-client
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT) += CSW$(NAME)$(BASE_VERSION_NODOT)-contrib
+CHECKPKG_OVERRIDES_CSW$(NAME)$(BASE_VERSION_NODOT) += surplus-dependency|CSW$(NAME)$(BASE_VERSION_NODOT)-client
+CHECKPKG_OVERRIDES_CSW$(NAME)$(BASE_VERSION_NODOT) += surplus-dependency|CSW$(NAME)$(BASE_VERSION_NODOT)-server
+CHECKPKG_OVERRIDES_CSW$(NAME)$(BASE_VERSION_NODOT) += surplus-dependency|CSW$(NAME)$(BASE_VERSION_NODOT)-contrib
 
-BUILD64 = 1
+PACKAGES += CSW$(NAME)$(BASE_VERSION_NODOT)-server
+SPKG_DESC_CSW$(NAME)$(BASE_VERSION_NODOT)-server = PostgreSQL $(VERSION), Server
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server  = $(foreach n,$(BIN_NAMES_SERVER),.*$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += $(foreach n,$(BIN_NAMES_SERVER),.*/man1/$(n)-$(BASE_VERSION_NODOT)\.1$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += $(foreach n,$(SO_NAMES_SERVER),.*/$(NAME)/$(BASE_VERSION_NODOT)/*$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += $(foreach n,$(EXT_NAMES_SERVER),.*/$(NAME)/$(BASE_VERSION_NODOT)/extension/$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += $(MISC_NAMES_SERVER)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*/$(NAME)/$(BASE_VERSION_NODOT)/timezone(sets|)/.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*/$(NAME)/$(BASE_VERSION_NODOT)/tsearch_.*/.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += $(PGLOCALSTATEDIR_BASE).*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*$(USERGROUP)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*$(sysconfdir)/init\.d/.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*$(sysconfdir)/$(CSWPGSQLCONFFILE_VERSIONED).CSW
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*/alternatives/$(NAME)$(BASE_VERSION_NODOT)_server.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*/CSW$(NAME)$(BASE_VERSION_NODOT)-server.postmsg
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-server += .*$(docdir)/$(NAME)$(BASE_VERSION_NODOT)_server/README.CSW
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibreadline6
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWosslrt
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibz1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibpq5
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibgnugetopt0
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibxslt1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibxml2-2
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-server += CSWlibgssapi-krb5-2
+#ALTERNATIVES_CSW$(NAME)$(BASE_VERSION_NODOT)-server = $(foreach i,$(NEEDED_ISAS), server_$(i))
 
-# There was a discussion about whether to use ISAEXEC by default.  The argument
-# is that enabling 64-bit by default where possible (using isaexec) is a waste.
-# I'm not completely convinced.  Leaving this line commented out for future
-# consideration.
-#
-# References:
-# - http://lists.opencsw.org/pipermail/maintainers/2009-November/004903.html
-#
-# I'd like to get some hard data though.  What is the difference in the memory
-# footprint, and what is the difference in execution speed between 32 and
-# 64-bit versions?
-#
-# NOISAEXEC = 1
+PACKAGES += CSW$(NAME)$(BASE_VERSION_NODOT)-client
+SPKG_DESC_CSW$(NAME)$(BASE_VERSION_NODOT)-client = PostgreSQL $(VERSION), Client
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client = $(foreach n,$(BIN_NAMES_CLIENT),.*$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client += $(foreach n,$(BIN_NAMES_CLIENT),.*/man1/$(n)-$(BASE_VERSION_NODOT)\.1$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client += $(MISC_NAMES_CLIENT)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client += .*/alternatives/$(NAME)$(BASE_VERSION_NODOT)_client.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client += .*/CSW$(NAME)$(BASE_VERSION_NODOT)-client.postmsg
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-client += .*$(docdir)/$(NAME)$(BASE_VERSION_NODOT)_client/README.CSW
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibreadline6
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWosslrt
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibz1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibpq5
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibgnugetopt0
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibxslt1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibxml2-2
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-client += CSWlibgssapi-krb5-2
+#ALTERNATIVES_CSW$(NAME)$(BASE_VERSION_NODOT)-client = $(foreach i,$(NEEDED_ISAS), client_$(i))
 
-CONFIGURE_ARGS  = $(DIRPATHS)
-CONFIGURE_ARGS += --with-includes=/opt/csw/include
+PACKAGES += CSW$(NAME)$(BASE_VERSION_NODOT)-contrib
+SPKG_DESC_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib = PostgreSQL $(VERSION), Contrib
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib = $(foreach n,$(BIN_NAMES_CONTRIB),.*$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += $(foreach n,$(BIN_NAMES_CONTRIB),.*/man1/$(n)-$(BASE_VERSION_NODOT)\.1$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += $(foreach n,$(SO_NAMES_CONTRIB),.*/$(NAME)/$(BASE_VERSION_NODOT)/*$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += $(foreach n,$(EXT_NAMES_CONTRIB),.*/$(NAME)/$(BASE_VERSION_NODOT)/extension/$(n)$$)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += .*$(docdir)/$(NAME)/$(BASE_VERSION_NODOT)/extension/.*
+# This has been removed as of 9.1
+#PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += .*/$(NAME)/$(BASE_VERSION_NODOT)/contrib.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += .*/alternatives/$(NAME)$(BASE_VERSION_NODOT)_contrib.*
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += .*/CSW$(NAME)$(BASE_VERSION_NODOT)-contrib.postmsg
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += .*$(docdir)/$(NAME)$(BASE_VERSION_NODOT)_contrib/README.CSW
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWosslrt
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibz1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibpq5
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibgnugetopt0
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibxslt1
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibxml2-2
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibgssapi-krb5-2
+RUNTIME_DEP_PKGS_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib += CSWlibreadline6
+#ALTERNATIVES_CSW$(NAME)$(BASE_VERSION_NODOT)-contrib = $(foreach i,$(NEEDED_ISAS), contrib_$(i))
 
-# # Perl support only in the 32-bit version
-# CONFIGURE_ARGS_isa-sparcv8 += --with-perl
-# CONFIGURE_ARGS_isa-i386 += --with-perl
+PACKAGES += CSW$(NAME)-dev
+SPKG_DESC_CSW$(NAME)-dev = PostgreSQL $(VERSION), Development Files
+PKGFILES_CSW$(NAME)-dev  = .*/pgxs/.*
+PKGFILES_CSW$(NAME)-dev += $(PKGFILES_DEVEL)
+PKGFILES_CSW$(NAME)-dev += $(foreach n,$(BIN_NAMES_DEVEL),.*$(n)$$)
+PKGFILES_CSW$(NAME)-dev += $(foreach n,$(BIN_NAMES_DEVEL),.*/man1/$(n)\.1$$)
+PKGFILES_CSW$(NAME)-dev += .*/CSW$(NAME)-dev.postmsg
+PKGFILES_CSW$(NAME)-dev += .*$(docdir)/$(NAME)_dev/README.CSW
+# See `post-merge-modulated:'
+PKGFILES_CSW$(NAME)-dev += .*/libpgport\.a$
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibecpg-compat3
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibecpg6
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibpq5
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibpgtypes3
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibz1
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibgssapi-krb5-2
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibgnugetopt0
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibxslt1
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibxml2-2
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWlibreadline6
+RUNTIME_DEP_PKGS_CSW$(NAME)-dev += CSWosslrt
+# Those '/usr/local' are ok, they are in a HPUX section of the file
+CHECKPKG_OVERRIDES_CSW$(NAME)-dev += $(foreach i,$(NEEDED_ISAS), $(subst $(ISA_DEFAULT)/,,file-with-bad-content|/usr/local|root$(libdir)/$(i)/$(NAME)/$(BASE_VERSION_NODOT)/pgxs/src/Makefile.shlib) )
+# That's ok too, it's docbook stuff which we don't use in this build
+CHECKPKG_OVERRIDES_CSW$(NAME)-dev += $(foreach i,$(NEEDED_ISAS), $(subst $(ISA_DEFAULT)/,,file-with-bad-content|/usr/share|root$(libdir)/$(i)/$(NAME)/$(BASE_VERSION_NODOT)/pgxs/src/Makefile.global) )
+# See `post-merge-modulated:' for those overrides
+CHECKPKG_OVERRIDES_CSWpostgresql-dev += discouraged-path-in-pkgmap|/opt/csw/lib/libpgport.a
+CHECKPKG_OVERRIDES_CSWpostgresql-dev += discouraged-path-in-pkgmap|/opt/csw/lib/$(ISA_DEFAULT64)/libpgport.a
 
-# # Python support in 32-bit only
-# CONFIGURE_ARGS_isa-sparcv8 += --with-python
-# CONFIGURE_ARGS_isa-i386 += --with-python
+PACKAGES += CSW$(NAME)$(BASE_VERSION_NODOT)-doc
+ARCHALL_CSW$(NAME)$(BASE_VERSION_NODOT)-doc = 1
+SPKG_DESC_CSW$(NAME)$(BASE_VERSION_NODOT)-doc = PostgreSQL $(VERSION), Documentation Files
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-doc  = .*/doc/$(NAME)/$(BASE_VERSION_NODOT)/.*\.(html|css)
+PKGFILES_CSW$(NAME)$(BASE_VERSION_NODOT)-doc += .*/man5/.*
 
-CONFIGURE_ARGS += --with-gssapi
-# CONFIGURE_ARGS += --with-krb5
-CONFIGURE_ARGS += --with-pam
-# CONFIGURE_ARGS += --with-bonjour
-CONFIGURE_ARGS += --with-openssl
-CONFIGURE_ARGS += --with-libxml
-CONFIGURE_ARGS += --with-libxslt
-CONFIGURE_ARGS += $(CONFIGURE_ARGS_$(MODULATION))
+PACKAGES += CSWlibecpg-compat3
+SPKG_DESC_CSWlibecpg-compat3 = PostgreSQL $(VERSION), libecpg_compat
+PKGFILES_CSWlibecpg-compat3  = $(call pkgfiles_lib,libecpg_compat.so.3)
+RUNTIME_DEP_PKGS_CSWlibecpg-compat3  = CSWlibecpg6
+RUNTIME_DEP_PKGS_CSWlibecpg-compat3 += CSWlibpgtypes3
+RUNTIME_DEP_PKGS_CSWlibecpg-compat3 += CSWlibpq5
 
-# Skipping tests to save time during packaging, and to enable x86 builds.
-SKIPTEST ?= 1
-TEST_TARGET = check
+PACKAGES += CSWlibecpg6
+SPKG_DESC_CSWlibecpg6 = PostgreSQL $(VERSION), libecpg
+PKGFILES_CSWlibecpg6  = $(call pkgfiles_lib,libecpg.so.6)
+RUNTIME_DEP_PKGS_CSWlibecpg6 += CSWlibpgtypes3
+RUNTIME_DEP_PKGS_CSWlibecpg6 += CSWlibpq5
 
-# CSWpostgresql is a generic wrapper always pointing to the latest release
-PKGFILES_CSWpostgresql                        = NOFILES
-PKGFILES_CSWpostgresql-$(BASE_VERSION_G)-doc  = $(PKGFILES_DOC)
-PKGFILES_CSWpostgresql-$(BASE_VERSION_G)-dev  = $(PKGFILES_DEVEL)
+PACKAGES += CSWlibpgtypes3
+SPKG_DESC_CSWlibpgtypes3 = PostgreSQL $(VERSION), libpgtypes
+PKGFILES_CSWlibpgtypes3  = $(call pkgfiles_lib,libpgtypes.so.3)
 
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)           = $(call baseisadirs,$(libdir),libpq\.so(\.\d+)*)
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)          += $(call baseisadirs,$(libpath_install),libpq\.so(\.\d+)*)
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)          += $(libdir)/64
+PACKAGES += CSWlibpq5
+SPKG_DESC_CSWlibpq5 = PostgreSQL $(VERSION), libpq
+PKGFILES_CSWlibpq5  = $(call pkgfiles_lib,libpq.so.5)
+RUNTIME_DEP_PKGS_CSWlibpq5  = CSWosslrt
+RUNTIME_DEP_PKGS_CSWlibpq5 += CSWlibgssapi-krb5-2
 
-# initscript_base_name = cswpostgres_$(subst .,_,$(BASE_VERSION))
-initscript_base_name = cswpostgres_$(VERSION_NODOT)
-INITSMF = /etc$(prefix)/init\.d/$(initscript_base_name)
-USERGROUP = /etc/opt/csw/pkg/postgresql/cswusergroup_$(VERSION_NODOT)
-PRESERVECONF = $(sysconfdir)/postgresql\.conf
+BUILD_DEP_PKGS  = CSWlibxml2-dev
+BUILD_DEP_PKGS += CSWlibxslt-dev
+BUILD_DEP_PKGS += CSWperl
+BUILD_DEP_PKGS += CSWpython-dev
+BUILD_DEP_PKGS += CSWossldevel
+BUILD_DEP_PKGS += CSWlibreadline-dev
+BUILD_DEP_PKGS += CSWgsed # gsed is used in this recipe
+BUILD_DEP_PKGS += CSWlibz-dev
+BUILD_DEP_PKGS += CSWlibgnugetopt-dev
 
-BIN_NAMES  = clusterdb
-BIN_NAMES += createdb
-BIN_NAMES += createlang
-BIN_NAMES += createuser
-BIN_NAMES += dropdb
-BIN_NAMES += droplang
-BIN_NAMES += dropuser
-BIN_NAMES += ecpg
-BIN_NAMES += initdb
-BIN_NAMES += oid2name
-BIN_NAMES += pg_config
-BIN_NAMES += pg_controldata
-BIN_NAMES += pg_ctl
-BIN_NAMES += pg_dump
-BIN_NAMES += pg_dumpall
-BIN_NAMES += pg_resetxlog
-BIN_NAMES += pg_restore
-BIN_NAMES += pg_standby
-BIN_NAMES += pgbench
-BIN_NAMES += postgres
-BIN_NAMES += postmaster
-BIN_NAMES += psql
-BIN_NAMES += reindexdb
-BIN_NAMES += vacuumdb
-BIN_NAMES += vacuumlo
+# See comment on the test-custom target.
+TEST_SCRIPTS = custom
 
-PGDATA = $(localstatedir)/pgdata
+EXTRA_LD_OPTIONS  = -R$(prefix)/lib/\$$ISALIST
+# Needed for thread safety check by configure
+LIBS		= -lrt
+EXTRA_CONFIGURE_ENV = LIBS=$(LIBS)
 
-PROTOTYPE_MODIFIERS = pgdata
-PROTOTYPE_FILES_pgdata = $(PGDATA)
-PROTOTYPE_USER_pgdata = postgres
-PROTOTYPE_GROUP_pgdata = sys
-PROTOTYPE_PERMS_pgdata = 0700
-PROTOTYPE_CLASS_pgdata = ugfiles
+BUILD64 = 1
+#ISAEXEC = 0
+MERGE_DIRS_isa-extra = $(bindir) $(libdir) $(libexecdir)
 
-# This is one of the rare cases where a protoype filter is needed.
-# Do not copy this for other Makefiles unless you understand exactly what it does!!
-# (explanation: It adds -isaexec to the isaexec-name of the binaries to be isaexec'ed)
-PROTOTYPE_FILTER = perl -npe 's,=/opt/csw/bin/isaexec,-isaexec=/opt/csw/bin/isaexec,'
+CONFIGURE_ARGS  = $(DIRPATHS)
+# This is one of the quirks mentioned at the beginning: --program-suffix is not
+# supported, so IMHO, binaries should go to --libexecdir
+CONFIGURE_ARGS += --bindir=$(PGBINDIR)
+CONFIGURE_ARGS += --sbindir=$(PGSBINDIR)
+CONFIGURE_ARGS += --sysconfdir=$(PGSYSCONFDIR)
+CONFIGURE_ARGS += --datadir=$(PGDATADIR)
+CONFIGURE_ARGS += --localstatedir=$(PGDATA)
+CONFIGURE_ARGS += --with-includes=$(includedir)
+CONFIGURE_ARGS += --with-libraries=$(libdir)
+CONFIGURE_ARGS += --docdir=$(PGDOCDIR)
 
-# ISAEXEC_FILES = $(addsuffix -isaexec,$(foreach B,$(BIN_NAMES),$(bindir_install)/$B))
-ALTERNATIVES_CSWpostgresql-$(BASE_VERSION_G) = $(NAME)$(BASE_VERSION_G)-32 $(NAME)$(BASE_VERSION_G)-64 $(NAME)$(BASE_VERSION_G)-auto
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-32 = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(ISA_DEFAULT)/$(firstword $(BIN_NAMES)) 100
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-32 += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$(ISA_DEFAULT)/$B)
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-64 = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(ISA_DEFAULT64)/$(firstword $(BIN_NAMES)) 200
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-64 += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$(ISA_DEFAULT64)/$B)
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-auto = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(firstword $(BIN_NAMES))-isaexec 300
-ALTERNATIVE_$(NAME)$(BASE_VERSION_G)-auto += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$B-isaexec)
+CONFIGURE_ARGS += --with-gssapi
+CONFIGURE_ARGS += --with-pam
+CONFIGURE_ARGS += --with-openssl
+CONFIGURE_ARGS += --with-libxml
+CONFIGURE_ARGS += --with-libxslt
+CONFIGURE_ARGS += --without-krb5
+CONFIGURE_ARGS += --without-bonjour
 
-# checkpkg does not detect this dependency automatically
-CHECKPKG_OVERRIDES_CSWpostgresql-84 += surplus-dependency|CSWalternatives
+#SKIPTEST ?= 1
 
 include gar/category.mk
 
-CFLAGS := $(filter-out -I%,$(CFLAGS))
+# If the check is not called from within the $(WORKSRC) dir, it
+# fails. This behavior appeared with version 9.1.
+test-custom:
+	cd $(WORKSRC) ; $(BUILD_ENV) gmake check
+	@$(MAKECOOKIE)
 
+# This will generate the ALTERNATIVEs for the binaries in
+# $(libexecdir)/postgresql/XY.
+#
+# The uppercase_* variables are used to translate the lowercase
+# $(myALTERNATIVES) to uppercase.
+#
+# How it does create the alternatives:
+#
+# for pkg in $(myALTERNATIVES)
+#   -- set alternative priority to 20
+#   for alt in $(NEEDED_ISAS)
+#     -- increment alternative priority by 10
+#     -- create master alternative for pkg, remove default isa from path,
+#	 store alternative in $(ALTERNATIVE_$(pkg)_$(alt)
+#     -- create slave alternatives for pkg, remove default isa from path,
+#	 append slave alternative to $(ALTERNATIVE_$(pkg)_$(alt)
+#   end alt
+# end pkg
+#
+# In the post-merge target, the alternatives are written to their
+# respective files
+
+uppercase_server = SERVER
+uppercase_client = CLIENT
+uppercase_contrib = CONTRIB
+$(foreach pkg,$(myALTERNATIVES),\
+	$(eval alt_priority = 20) \
+	$(foreach alt,$(NEEDED_ISAS), \
+		$(eval alt_priority=$(shell expr $(alt_priority) + 10)) \
+		$(eval ALTERNATIVE_$(pkg)_$(alt) = $(subst /$(ISA_DEFAULT)/,/,$(foreach n,$(firstword $(BIN_NAMES_$(uppercase_$(pkg)))),$(bindir)/$(n)-$(BASE_VERSION_NODOT) $(NAME)$(BASE_VERSION_NODOT)-$(pkg) $(libexecdir)/$(alt)/$(NAME)/$(BASE_VERSION_NODOT)/$(n))) $(alt_priority)) \
+		$(eval ALTERNATIVE_$(pkg)_$(alt) += $(subst /$(ISA_DEFAULT)/,/,$(foreach n,$(wordlist 2,$(words $(BIN_NAMES_$(uppercase_$(pkg)))),$(BIN_NAMES_$(uppercase_$(pkg)))),$(bindir)/$(n)-$(BASE_VERSION_NODOT) $(NAME)$(BASE_VERSION_NODOT)-$(pkg) $(libexecdir)/$(alt)/$(NAME)/$(BASE_VERSION_NODOT)/$(n)))) \
+	)\
+)
+
+# We adjust the $(pkglibdir) found in $(WORKSRC)/src/Makefile.global.in, so
+# that it should be possible to install 8.x and 8.y concurrently
+pre-configure-modulated:
+	@echo " ===> Adjusting pkglibdir in $(WORKSRC)/src/Makefile.global.in"
+	@if [ -r $(WORKSRC)/src/Makefile.global.in ] ; then \
+		gsed -i -r -e 's|^(pkglibdir[[:space:]]*=[[:space:]]*)\$$\(libdir\).*$$|\1$$(libdir)/postgresql/$(BASE_VERSION_NODOT)|' $(WORKSRC)/src/Makefile.global.in ; \
+	fi
+	@$(MAKECOOKIE)
+
 post-build-modulated:
+	@echo " ===> Building contrib stuff"
 	$(BUILD_ENV) gmake -C $(WORKSRC)/contrib all
 	@$(MAKECOOKIE)
 
 post-install-modulated:
+	@echo " ===> Installing contrib stuff"
 	$(INSTALL_ENV) gmake -C $(WORKSRC)/contrib DESTDIR=$(DESTDIR) install
+	$(INSTALL_ENV) gmake -C $(WORKSRC) DESTDIR=$(DESTDIR) install-docs
 	@$(MAKECOOKIE)
 
-post-merge:
-	ginstall -d $(PKGROOT)/etc$(prefix)/init.d
-	gsed \
-		-e 's+ at PGDATA@+$(PGDATA)+g' \
-		-e 's+ at sysconfdir@+$(sysconfdir)+g' \
-		-e 's+ at bindir@+$(bindir)+g' \
-		< $(FILEDIR)/cswpostgres.tmpl \
-		> $(WORKDIR)/$(initscript_base_name)
-	ginstall \
-		$(WORKDIR)/$(initscript_base_name) \
-		$(PKGROOT)/etc$(prefix)/init.d/$(initscript_base_name)
-	ginstall -d $(PKGROOT)/etc$(prefix)/pkg/$(NAME)
-	gsed -e 's+ at PGDATA@+$(PGDATA)+g' \
-		< $(FILEDIR)/cswusergroup.tmpl \
-		> $(WORKDIR)/cswusergroup
-	ginstall $(WORKDIR)/cswusergroup \
-		$(PKGROOT)/etc$(prefix)/pkg/$(NAME)/cswusergroup_$(VERSION_NODOT)
-	ginstall -d $(PKGROOT)$(sysconfdir)
-	gsed -e 's+ at PGDATA@+$(PGDATA)+g' \
-		< $(FILEDIR)/postgresql.conf.tmpl \
-		> $(WORKDIR)/postgresql.conf
-	ginstall $(WORKDIR)/postgresql.conf \
-		$(PKGROOT)$(sysconfdir)
-	ginstall -d $(PKGROOT)$(docdir)
-	# ginstall $(WORKDIR)/README-CSW.txt $(PKGROOT)$(docdir)
-	ginstall -m 755 -d $(PKGROOT)$(prefix)/bin
-	ginstall -d $(PKGROOT)$(PGDATA)
-	gln -s $(ISA_DEFAULT64) $(PKGROOT)$(libdir)/64
-	for L in $(notdir $(wildcard $(PKGROOT)$(libdir)/libpq.*)); do \
-		gln -s $(pgsubdir)/$$L $(PKGROOT)$(libpath_install)/$$L; \
+# We suck in the libpgport.a since pg_config is emitting
+# -lpgport. Unfortunately, there is no shared lib version, and I'm too
+# lazzy to adjust the build system to generate one...
+post-merge-modulated:
+ifeq ($(ISA),$(ISA_DEFAULT64))
+	ginstall $(WORKSRC)/src/port/libpgport.a $(PKGROOT)$(libpath_install)/$(ISA_DEFAULT64)/
+else
+	ginstall $(WORKSRC)/src/port/libpgport.a $(PKGROOT)$(libdir)/
+endif
+# Move the development binaries to the standard location
+	ginstall -d $(PKGROOT)$(bindir)/
+	for f in $(BIN_NAMES_DEVEL) ; do \
+		gmv -v $(PKGROOT)$(libexecdir)/$(NAME)/$(BASE_VERSION_NODOT)/$$f $(PKGROOT)$(bindir)/ ; \
 	done
-	mkdir -p $(PKGROOT)$(libpath_install)/$(ISA_DEFAULT64)
-	for L in $(notdir $(wildcard $(PKGROOT)$(libdir)/$(ISA_DEFAULT64)/libpq.*)); do \
-		gln -s ../$(pgsubdir)/$(ISA_DEFAULT64)/$$L $(PKGROOT)$(libpath_install)/$(ISA_DEFAULT64)/$$L; \
+
+post-merge:  $(foreach n,$(POSTMSG),$(PKGROOT)/$(n)) test-installation
+# Create my alternatives files.
+	$(foreach a,$(myALTERNATIVES), $(foreach i,$(NEEDED_ISAS), $(info ===> Create alternative $(i) $(a)) $(shell ginstall -d $(PKGROOT)$(sharedstatedir)/alternatives ; echo "$(ALTERNATIVE_$(a)_$(i))" > $(PKGROOT)$(sharedstatedir)/alternatives/$(NAME)$(BASE_VERSION_NODOT)_$(a)_$(i) ) ) )
+# Create the PGDATA directory
+	@echo " ===> Create pgdata directory"
+	@ginstall -d $(PKGROOT)$(PGDATA)
+# Adjust the man page names.
+	@echo " ===> Adjusting man page file names"
+	@for i in 1 5 ; do \
+		test -d $(PKGROOT)$(datadir)/man/man$$i || continue ; \
+		for f in $(PKGROOT)$(datadir)/man/man$$i/* ; do \
+			suffix="`echo $$f | awk 'BEGIN { FS="." } { print $$NF }'`" ; \
+			f_no_suffix="`echo $$f | sed -e "s/\.$${suffix}$$//"`" ; \
+			dont_move=0 ; \
+			for d in $(BIN_NAMES_DEVEL) ; do \
+				bname="`basename $${f_no_suffix}`" ; \
+				if test "$${bname}" = "$$d" ; then \
+					dont_move=1 ; \
+					break ; \
+				fi ; \
+			done ; \
+			test $${dont_move} -eq 0 && mv $$f $${f_no_suffix}-$(BASE_VERSION_NODOT).$${suffix} ; \
+		done ;\
 	done
+# Change path names in documentation
+	@echo " ===> Adjust path names in documentation"
+	@for f in $(PKGROOT)$(docdir)/$(NAME)/$(BASE_VERSION_NODOT)/html/*.html $(PKGROOT)$(mandir)/man1/*.1 $(PKGROOT)$(datadir)/$(NAME)/$(BASE_VERSION_NODOT)/*.sample ; do \
+		gsed -i -e 's|/usr/local/pgsql/data|$(localstatedir)/$(NAME)/$(BASE_VERSION_NODOT)|g' \
+			-e 's|/usr/local/pgsql/|$(prefix)/|g' \
+			-e 's|/usr/local|$(prefix)|g' \
+			-e 's|/usr/share|$(datadir)|g' $$f ; \
+	done
+	@echo " ===> Install postmsg"
+	$(foreach n,$(POSTMSG), $(shell ginstall -d $(PKGROOT)$(dir $(n))) $(shell ginstall $(WORKDIR)/$(notdir $(n)) $(PKGROOT)$(n)))
 	@$(MAKECOOKIE)
+
+pre-package:
+# The postinstall for the server package
+	@echo " ===> Install postinstall script"
+	@ginstall $(WORKDIR)/$(SERVERPOSTINSTTMPL) $(WORKDIR)/$(SERVERPOSTINST_VERSIONED)
+# The usergroup file
+	@echo " ===> Install usergroup file"
+	@ginstall -d $(PKGROOT)$(USERGROUPDIR)
+	@ginstall $(WORKDIR)/$(USERGROUPFILETMPL) $(PKGROOT)$(USERGROUPDIR)/$(USERGROUPFILE_VERSIONED)
+# The init script
+	@echo " ===> Install init script"
+	@ginstall -d $(PKGROOT)$(sysconfdir)/init.d
+	@ginstall $(WORKDIR)/$(INITSCRIPTFILETMPL) $(PKGROOT)$(sysconfdir)/init.d/$(INITSCRIPTFILE_VERSIONED)
+	@chmod 0755 $(PKGROOT)$(sysconfdir)/init.d/$(INITSCRIPTFILE_VERSIONED)
+# The init script config
+	@echo " ===> Install init script config"
+	@ginstall $(WORKDIR)/$(CSWPGSQLCONFFILETMPL) $(PKGROOT)$(sysconfdir)/$(CSWPGSQLCONFFILE_VERSIONED).CSW
+# Remove all the README.CSW, since they have not expanded the
+# variables, and copy only the one's we're interested in
+	@echo " ===> Remove all README.CSW"
+	@for f in $(PKGROOT)$(docdir)/*/README.CSW ; do \
+		rm $$f ; \
+	done
+	@echo " ==> Install variable expanded README.CSW"
+	@for d in $(foreach n,$(myALTERNATIVES),$(NAME)$(BASE_VERSION_NODOT)_$(n)) $(NAME)$(BASE_VERSION_NODOT) ; do \
+		ginstall $(WORKDIR)/README.CSW $(PKGROOT)$(docdir)/$$d/ ; \
+	done
+	@$(MAKECOOKIE)
+
+$(foreach n,$(POSTMSG),$(PKGROOT)/$(n)):
+	@echo " ===> Linking Post Messages"
+	@ginstall -d $(dir $@)
+	@ln $(DOWNLOADDIR)/$(notdir $@) $@
+
+$(foreach n,$(POSTMSG),$(DOWNLOADDIR)/$(notdir $(n))):
+	@echo " ===> Generating $(notdir $@)"
+	@echo "" > $@
+	@echo "---" >> $@
+	@echo "" >> $@
+	@echo "There are 32bit and 64bit versions of $(NAME) $(VERSION) binaries on the system installed:" >> $@
+	@echo "" >> $@
+	@echo "You can easily select between the versions with the alternatives(8)" >> $@
+	@echo "system by executing" >> $@
+	@echo "" >> $@
+	@echo "  /opt/csw/sbin/alternatives --config $(subst .postmsg,,$(subst CSW,,$(notdir $@)))" >> $@
+	@echo "" >> $@
+	@echo "See http://www.opencsw.org/packages/alternatives for details." >> $@
+	@echo "" >> $@
+	@echo "---" >> $@
+	@echo "" >> $@
+	@$(MAKECOOKIE)
+
+test-installation:
+# Check if all binaries and libraries defined in the variables
+# BIN_NAMES_* and SO_NAMES_* are there
+	@echo " ===> Checking for extra binaries in BIN_NAMES_*"
+	@for n in $(BIN_NAMES_SERVER) $(BIN_NAMES_CLIENT) $(BIN_NAMES_CONTRIB) ; do \
+		if [ -f $(PKGROOT)$(PGBINDIR)/$$n ] ; then\
+			: ; \
+		else \
+			echo "Extra binary defined $$n" ; \
+			exit 1 ; \
+		fi ; \
+	done
+	@echo " ===> Checking for extra libraries in SO_NAMES_*"
+	@for n in $(SO_NAMES_SERVER) $(SO_NAMES_CONTRIB) ; do \
+		if [ -f $(PKGROOT)$(libdir)/$(NAME)/$(BASE_VERSION_NODOT)/$$n ] ; then\
+			: ; \
+		else \
+			echo "Extra library defined $$n" ; \
+			exit 1 ; \
+		fi ; \
+	done
+	@echo " ===> Checking for extra extensions in EXT_NAMES_*"
+	@for n in $(EXT_NAMES_SERVER) $(EXT_NAMES_CONTRIB) ; do \
+		if [ -f $(PKGROOT)$(sharedstatedir)/$(NAME)/$(BASE_VERSION_NODOT)/extension/$$n ] ; then\
+			: ; \
+		else \
+			echo "Extra extension defined $$n" ; \
+			exit 1 ; \
+		fi ; \
+	done
+# Check if all binaries and libraries in the pkgroot are contained in
+# the respective recipe variables.
+	@echo " ===> Checking for missing binaries in BIN_NAMES_*"
+	@for n in `gfind $(PKGROOT)$(PGBINDIR) -maxdepth 1 -type f` ; do \
+		echo "$(BIN_NAMES_SERVER) $(BIN_NAMES_CLIENT) $(BIN_NAMES_CONTRIB)" | grep `basename $$n` >/dev/null 2>&1 ; \
+		if [ $$? -eq 0 ] ; then \
+			: ; \
+		else \
+			echo "Binary `basename $$n` not defined" ; \
+			exit 1 ; \
+		fi ; \
+	done
+	@echo " ===> Checking for missing binaries in SO_NAMES_*"
+	@for n in `gfind $(PKGROOT)$(libdir)/$(NAME)/$(BASE_VERSION_NODOT) -maxdepth 1 -type f` ; do \
+		echo "$(SO_NAMES_SERVER) $(SO_NAMES_CONTRIB)" | grep `basename $$n` >/dev/null 2>&1 ; \
+		if [ $$? -eq 0 ] ; then \
+			: ; \
+		else \
+			echo "Library `basename $$n` not defined" ; \
+			exit 1 ; \
+		fi ; \
+	done
+	@echo " ===> Checking for missing extensions in EXT_NAMES_*"
+	@for n in `gfind $(PKGROOT)$(sharedstatedir)/$(NAME)/$(BASE_VERSION_NODOT)/extension -maxdepth 1 -type f` ; do \
+		echo "$(EXT_NAMES_SERVER) $(EXT_NAMES_CONTRIB)" | grep `basename $$n` >/dev/null 2>&1 ; \
+		if [ $$? -eq 0 ] ; then \
+			: ; \
+		else \
+			echo "Extension `basename $$n` not defined" ; \
+			exit 1 ; \
+		fi ; \
+	done

Modified: csw/mgar/pkg/postgresql/trunk/checksums
===================================================================
--- csw/mgar/pkg/postgresql/trunk/checksums	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/checksums	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1 +1 @@
-4bf2448ad965bca3940df648c02194df  postgresql-8.4.4.tar.bz2
+7dbff52221954c46595313eb7f92c3e0  postgresql-9.1.2.tar.bz2

Copied: csw/mgar/pkg/postgresql/trunk/files/0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/0000-Run-tests-in-var-tmp-pgsql-tmp_check.patch	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,62 @@
+From 051eb505448cba2f98aa5926ef3bfe0eed50d74c Mon Sep 17 00:00:00 2001
+From: Rafael Ostertag <rafisol at opencsw.org>
+Date: Fri, 30 Dec 2011 20:32:11 +0100
+Subject: [PATCH] Run tests in /var/tmp/pgsql/tmp_check
+
+---
+ src/Makefile.global.in       |    4 ++--
+ src/test/regress/GNUmakefile |    4 ++++
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile.global.in b/src/Makefile.global.in
+index 3bf658d..69523de 100644
+--- a/src/Makefile.global.in
++++ b/src/Makefile.global.in
+@@ -438,10 +438,10 @@ endif
+ 
+ pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
+ 
+-pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags)
++pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=/var/tmp/pgsql/tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags)
+ pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir='$(PSQLDIR)' $(pg_regress_locale_flags)
+ 
+-pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
++pg_regress_clean_files = results/ regression.diffs regression.out /var/tmp/pgsql/tmp_check log/
+ 
+ 
+ ##########################################################################
+diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
+index 90aea6c..99c3905 100644
+--- a/src/test/regress/GNUmakefile
++++ b/src/test/regress/GNUmakefile
+@@ -135,6 +135,7 @@ tablespace-setup:
+ REGRESS_OPTS = --dlpath=.
+ 
+ check: all tablespace-setup
++	install -d /var/tmp/pgsql/tmp_check
+ 	$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(EXTRA_TESTS)
+ 
+ installcheck: all tablespace-setup
+@@ -144,6 +145,7 @@ installcheck-parallel: all tablespace-setup
+ 	$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
+ 
+ standbycheck: all
++	install -d /var/tmp/pgsql/tmp_check
+ 	$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
+ 
+ # old interfaces follow...
+@@ -153,9 +155,11 @@ runtest: installcheck
+ runtest-parallel: installcheck-parallel
+ 
+ bigtest: all tablespace-setup
++	install -d /var/tmp/pgsql/tmp_check
+ 	$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
+ 
+ bigcheck: all tablespace-setup
++	install -d /var/tmp/pgsql/tmp_check
+ 	$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
+ 
+ 
+-- 
+1.7.6.1
+

Copied: csw/mgar/pkg/postgresql/trunk/files/0000-Use-plain-rpath.patch (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/0000-Use-plain-rpath.patch)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/0000-Use-plain-rpath.patch	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/0000-Use-plain-rpath.patch	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,25 @@
+From 3e5748b6bc287f4036c2f619c143b9e467b84c29 Mon Sep 17 00:00:00 2001
+From: Rafael Ostertag <rafisol at opencsw.org>
+Date: Sun, 1 Jan 2012 17:35:00 +0100
+Subject: [PATCH] Use plain rpath
+
+---
+ src/makefiles/Makefile.solaris |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
+index bb56830..89d83df 100644
+--- a/src/makefiles/Makefile.solaris
++++ b/src/makefiles/Makefile.solaris
+@@ -6,7 +6,7 @@ ifeq ($(with_gnu_ld), yes)
+ export_dynamic = -Wl,-E
+ rpath = -Wl,-rpath,'$(rpathdir)'
+ else
+-rpath = -Wl,-R'$(rpathdir)'
++rpath = -R$(rpathdir)
+ endif
+ 
+ DLSUFFIX = .so
+-- 
+1.7.6.1
+

Copied: csw/mgar/pkg/postgresql/trunk/files/0000-ecpg-usr-local-include-replacement.patch (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/0000-ecpg-usr-local-include-replacement.patch)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/0000-ecpg-usr-local-include-replacement.patch	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/0000-ecpg-usr-local-include-replacement.patch	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,25 @@
+From dec1e5ffd2ec2e58d185f6e4753e38ff5a0af1cd Mon Sep 17 00:00:00 2001
+From: Rafael Ostertag <rafisol at opencsw.org>
+Date: Fri, 30 Dec 2011 16:27:27 +0100
+Subject: [PATCH] ecpg /usr/local/include replacement
+
+---
+ src/interfaces/ecpg/preproc/ecpg.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
+index db52bf5..05cad72 100644
+--- a/src/interfaces/ecpg/preproc/ecpg.c
++++ b/src/interfaces/ecpg/preproc/ecpg.c
+@@ -253,7 +253,7 @@ main(int argc, char *const argv[])
+ 	}
+ 
+ 	add_include_path(".");
+-	add_include_path("/usr/local/include");
++	add_include_path("/opt/csw/include");
+ 	get_include_path(my_exec_path, include_path);
+ 	add_include_path(include_path);
+ 	add_include_path("/usr/include");
+-- 
+1.7.6.1
+

Deleted: csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-84.postinstall
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-84.postinstall	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-84.postinstall	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1,41 +0,0 @@
-define CSWpostgresql-84_postinstall
-#!/bin/sh
-# vim:set ft=sh:
-#
-# $$Id$$
-#
-# Initialize the database cluster if it hasn't been initialized before.
-
-# Read in the user configuration file
-[ -s /opt/csw/etc/postgresql.conf ] && . /opt/csw/etc/postgresql.conf
-[ -s $(sysconfdir)/postgresql.conf ] && . $(sysconfdir)/postgresql.conf
-
-PGDATA=$(PGDATA)
-PGINIT=$(bindir)/initdb
-
-initialize_cluster() {
-	chown postgres "$${PGDATA}"
-	chmod 0700 "$${PGDATA}"
-	echo "Initializing PostgreSQL database..."
-	su postgres -c "\"$${PGINIT}\" -D \"$${PGDATA}\" -E utf-8"
-}
-
-if [ `ls -l $${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
-	initialize_cluster
-else
-	echo "The database cluster seems to be initialized already."
-fi
-
-if [ -x /usr/sbin/svcadm ]; then
-	fmri="cswpostgres_$(VERSION_NODOT)"
-	echo "Enabling the $${fmri} service in SMF"
-	svcadm clear "$${fmri}"
-	svcadm enable "$${fmri}"
-else
-	initscript="/etc/opt/csw/init.d/cswpostgres_$(VERSION_NODOT)"
-	echo "Issuing $${initscript} start"
-	$${initscript} start
-fi
-
-exit 0
-endef

Copied: csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-server.postinstall.tmpl (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/CSWpostgresql-server.postinstall.tmpl)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-server.postinstall.tmpl	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/CSWpostgresql-server.postinstall.tmpl	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,64 @@
+#!/bin/sh
+# vim:set ft=sh:
+#
+# $Id$
+#
+# Initialize the database cluster if it hasn't been initialized before.
+
+USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
+PGCTL=@bindir@/pg_ctl- at BASE_VERSION_NODOT@
+PGINIT=@bindir@/initdb- at BASE_VERSION_NODOT@
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
+[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
+
+if [ ! -d "${PGDATA}" -o `ls -l ${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
+    @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+    cat <<EOF
+---
+
+The database cluster has been initialized in ${PGDATA}.
+
+Some customizations to the initialization can be made by editing the file
+
+ @sysconfdir@/${USERCONF}
+
+In order to re-initialize the database cluster, remove the directory
+
+ ${PGDATA}
+
+and call cswpostgresql- at BASE_VERSION_NODOT@ as such
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+
+PLEASE NOTE: by doing so, all data will be LOST. Thus this procedure
+             is only recommended for pristine installations.
+
+
+In order to start the PostgreSQL server you can either use
+
+ svcadm enable cswpostgresql- at BASE_VERSION_NODOT@    # Solaris 10+ only
+
+or
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ start
+
+---
+EOF
+else
+    cat <<EOF
+---
+
+The database cluster seems to be initialized already.
+
+---
+EOF
+fi
+
+# The database server will not be started, in case the user wants to
+# do some customization to the database cluster. However, the database
+# cluster is initialized and the user simply have to start the server
+# if the defaults suits him.
+
+exit 0

Deleted: csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1,103 +0,0 @@
-*** Important information - please make sure you read this ! ***
-
-*** Migrating from older versions ***
-
-If you have upgraded from a previous 8.0, 8.1 or 8.2 version of PostgreSQL, 
-your databases will NOT work on this 8.3.x version. Before upgrading, you 
-should dump your databases using the old utilities. You can then create a
-new data directory using this 8.3.x package, and import your dumps. 
-See the "64-bit support" section below for pointers to documentation on t
-his.
-
-Another point to note is that the location of the PostgreSQL install has 
-changed. Previous 7.3.x packages used /opt/csw as the base - this package 
-uses /opt/csw/postgresql. You will need to add /opt/csw/postgresql/bin to your
-$PATH, and any scripts you have written using the old locations will have to
-be changed.
-
-
-*** User configuration of server options ***
-
-Configuration of the server start-up options is now done through a user-
-configuration file, /opt/csw/etc/postgresql.conf. A sample template has been
-provided for you at /opt/csw/etc/postgresql.conf.csw. If you want to change
-any of the server options discussed below, make a copy of this file to 
-/opt/csw/etc/postgresql.conf and edit it accordingly.
-
-If you cannot modify this file (for instance, you are mounting /opt/csw
-from a read-only NFS server), you can use /etc/opt/csw/postgresql.conf 
-instead, and it will take precedence over /opt/csw/etc/postgresql.conf.
-
-*** Networking ***
-
-By default, the cswpostgres init script will start the server up listening on
-localhost only. If you want to allow other hosts on your network to connect, you
-will need to add "-o -i" to the value of SERVEROPTS in the user configuration
-file and restart your server. The included template has the line already
-entered, you just need to uncomment it (remove the leading #).
-
-Once this is done, PostgreSQL will now bind to all network interfaces and
-listen for connections. You will still need to configure which hosts are allowed
-access by modifying the pg_hba.conf file in your data directory - read the manual
-for more information on this.
-
-*** 64-bit support ***
-
-The SPARC packages have been built with 64-bit support, but by default, the
-32-bit version of the server will be run. If you need the 64-bit version,
-edit the user configuration file and change the values of PGINIT and PGCTL
-accordingly.
-
-It is important to note that the 64-bit server WILL NOT WORK with databases
-created with the 32-bit version, and vice versa. You will get an error
-message if you attempt this.
-
-In order to migrate your system to the 64-bit server, you will need to dump
-your databases while running the 32-bit client, stop and upgrade the server,
-initialise a new database directory, and import your dumps. For more information
-on this procedure, see the PostgreSQL manual (included with this package),
-chapter 9 - Backup and restore. This is located at :
-
-/opt/csw/postgresql/share/doc/html/backup.html
-
-All other PostgreSQL binaries in /opt/csw/postgresql/bin/ are copies of the 
-'isaexec' wrapper, which will run the appropriate binary for your
-architecture and/or kernel.
-
-*** Starting the server ***
-
-The PostgreSQL database runs under the user 'postgres' - this has been created 
-for you by the installation script.
-
-The default PostgreSQL data directory is /opt/csw/var/pgdata. As this does not 
-exist, you will need to create it yourself before the database will start.
-You can change the location of the data directory by altering the user
-configuration file, and modifying the value of PGDATA.
-
-A startup script has been provided for you that handles database initialisation,
-startup and shutdown functions - it is located at /etc/init.d/cswpostgres. You
-should always use this script to start or stop the server, otherwise you may 
-find that you are running the wrong binaries (64-bit instead of 32-bit).
- 
-It is set to start the database the next time the system enters runlevel 3 - 
-usually, this will be at the next boot. 
-
-To create the data directory, the startup script accepts the "init" argument :
-
-/etc/init.d/cswpostgres init
-
-This will create and initialise the data directory. After this step has been
-completed succesfully, the database can be started with :
-
-/etc/init.d/cswpostgres start
-
-If you get errors relating to shared memory on startup, make sure you have read 
-the section entitled "Manging Kernel Resources" - this is in Chapter 3 of the 
-PostgreSQL HTML Administrator's Guide, located at 
-
-/opt/csw/postgresql/share/doc/html/index.html 
-
-
-Mark Round,
-mark at blastwave.org
-

Copied: csw/mgar/pkg/postgresql/trunk/files/README.CSW (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/README.CSW)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/README.CSW	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/README.CSW	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,145 @@
+OpenCSW PostgreSQL
+==================
+
+
+Parallel Installations
+----------------------
+
+OpenCSW's PostgreSQL allows for parallel installation of different
+PostgreSQL versions. Therefore, the binaries have appended the
+PostgreSQL version number, e.g. PostgreSQL's @VERSION@ `psql' is named
+`psql- at BASE_VERSION_NODOT@'. The same holds for manpages.
+
+The notable exception to this are development files. Development files
+are only available for the latest PostgreSQL version provided by
+OpenCSW and have no version number appended.
+
+Please see also `Starting the PostgreSQL Server' below for caveat on
+running multiple PostgreSQL servers in parallel.
+
+
+Migrating from CSWpostgresql
+----------------------------
+
+CSWpostgresql has been superseeded by CSW at NAME@@BASE_VERSION_NODOT at .
+It is possible to have CSWpostgresql and CSW at NAME@@BASE_VERSION_NODOT@
+installed on the same system, though. Please refer to `Starting the
+PostgreSQL Server' below for more information on how to run multiple
+PostgreSQL instances on the same system.
+
+In order to migrate from CSWpostgresql to CSW at NAME@@BASE_VERSION_NODOT@,
+create a full dump of the CSWpostgresql database cluster as
+described in
+
+ http://www.postgresql.org/docs/@BASE_VERSION@/static/upgrading.html
+
+and transfer it to the CSW at NAME@@BASE_VERSION_NODOT@ database cluster.
+
+
+32/64-bit Binaries
+------------------
+
+It can be chosen between 32-bit or 64-bit binaries using the
+alternatives mechanism (see the alternative's README.user). By
+default, PostgreSQL will use 64-bit binaries.
+
+Alternatives are provided for server, client, contrib, and dev
+binaries separately. This makes it possible to select different memory
+models for those binaries independently.
+
+In order to list the alternatives provided, issue
+
+ /opt/csw/sbin/alternatives --list
+
+on the command line.
+
+Please note, that a database cluster initialized by the 32-bit server
+binaries cannot be used by the 64-bit versions and vice versa. If you
+want to switch the memory model of the server, you have to
+
+ 1. dump the entire database cluster
+ 2. switch the memory model of the server binaries
+ 3. remove the database cluster
+ 4. re-initialize the database cluster using `initdb- at BASE_VERSION_NODOT@'
+    (see also `Initializing the Database Cluster' below)
+ 5. start the server and restore the database cluster from the dump
+    created in step 1.
+
+
+Starting the PostgreSQL Server
+------------------------------
+
+When installing the PostgreSQL server for the first time, only the
+database cluster will be initialized using default values provided by
+
+ @sysconfdir@/postgresql- at BASE_VERSION_NODOT@.conf
+
+and the database server will not be started, thus allowing for
+post-installation customization.
+
+In order to start the PostgreSQL server you can either use
+
+ svcadm enable cswpostgresql- at BASE_VERSION_NODOT@    # Solaris 10+ only
+
+or
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ start
+
+Please note, that when installing multiple PostgreSQL server versions
+in parallel, the above method will work for the first database server
+started only. Subsequent servers starts will fail unless the listening
+port is set to distinct values using the `SERVEROPTS' in
+
+ @sysconfdir@/postgresql-XY.conf
+
+like
+
+ SERVEROPTS="-p <portnum>"
+
+where `<portnum>' is the port number the server has to listen on,
+which is by default 5432. So, one could configure the servers, for
+instance, to make the first server listen on 5432, the second on 5433,
+and so on.
+
+Alternatively, one can use the `postgresql.conf' file in the database
+cluster directory to provide a different listening port.
+
+
+User Configuration of Server Options
+------------------------------------
+
+Configuration of the server start-up options is done through a
+user-configuration file, `@sysconfdir@/postgresql- at BASE_VERSION_NODOT@.conf', regardless of
+whether Solaris SMF or System V-style initialization is used.
+
+This file also defines the location of the PostgreSQL database cluster
+in `PGDATA', which is by default
+
+ /var/opt/csw/postgresql/@BASE_VERSION_NODOT@
+
+
+Initializing the Database Cluster
+---------------------------------
+
+The startup script `/etc/opt/csw/init.d/cswpostgresql- at BASE_VERSION_NODOT@' allows to
+initialize the database cluster by providing the argument `init' as such
+
+ /etc/opt/csw/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+
+This will initialize the database cluster at the location specified in
+the `PGDATA' variable defined in `/etc/opt/csw/postgresql- at BASE_VERSION_NODOT@.conf'.
+
+When installing PostgreSQL for the first time, the database cluster
+will be initialized using default values.
+
+Please note, that when changing the memory model of the server
+binaries, i.e. from 32-bit to 64-bit or vice versa, you have to
+re-initialize the database cluster (see also `32/64-bit Binaries'
+above).
+
+
+--
+That's all folks.
+
+Rafael Ostertag
+raos at opencsw.org

Deleted: csw/mgar/pkg/postgresql/trunk/files/cswpostgres.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/cswpostgres.tmpl	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/files/cswpostgres.tmpl	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1,123 +0,0 @@
-#!/bin/sh
-# $Id$
-#
-# PostgreSQL startup script - part of the CSWpostgresql package
-# mark at blastwave.org
-# 
-# 2009-11-29  Maciej Blizinski (maciej at opencsw.org)
-#   - Parametrized file locations
-#   - Style changes
-#              
-#
-# This files is a template.  The following variables need to be substituted
-# before it can be run:
-#
-# - PGDATA
-# - bindir
-# - sysconfdir
-
-
-# Read in the user configuration file
-[ -s /opt/csw/etc/postgresql.conf ] && . /opt/csw/etc/postgresql.conf
-[ -s @sysconfdir@/postgresql.conf ] && . @sysconfdir@/postgresql.conf
-
-# Defaults
-[ -z "${PGDATA}" ] && PGDATA=@PGDATA@
-[ -z "${PGCTL}" ] && PGCTL=@bindir@/sparcv8/pg_ctl
-[ -z "${PGINIT}" ] && PGINIT=@bindir@/sparcv8/initdb
-
-
-# The following attempts to catch any mistakes in the server
-# version - it checks if the 64-bit server was last run. If so,
-# it forces the 64-bit server, otherwise it won't start up!
-# And vice-versa for the 32-bit server...
-#
-# This version doesn't check the i386/amd64 architectures.
-if [ -f "${PGDATA}/postmaster.opts" ]; then
-  if grep 'sparcv9' ${PGDATA}/postmaster.opts > /dev/null; then
-    echo ${PGCTL} | grep "sparcv8" > /dev/null
-    if [ $? -eq 0 ]; then
-      echo "Warning: 32-bit server was specified in /etc/init.d/cswpostgres,"
-      echo "         but 64-bit version was last run. Using 64-bit server..."
-    fi
-    PGCTL=@bindir@/sparcv9/pg_ctl
-    PGINIT=@bindir@/sparcv9/initdb
-  elif grep 'sparcv8' ${PGDATA}/postmaster.opts > /dev/null; then
-    # Detected 32-bit server last used
-    echo "${PGCTL}" | grep "sparcv8" > /dev/null
-    if [ $? -ne 0 ]; then
-      echo "Warning: 64-bit server was specified in /etc/init.d/cswpostgres,"
-      echo "         but 32-bit version was last run. Using 32-bit server..."
-    fi
-    PGCTL=@bindir@/sparcv8/pg_ctl
-    PGINIT=@bindir@/sparcv8/initdb
-  else
-  	echo "Couldn't detect whether the previously run version was 32 or 64-bit."
-  	echo "Running the default."
-  	PGCTL=@bindir@/pg_ctl
-  	PGINIT=@bindir@/initdb
-  fi
-fi
-
-# Exit if postgres user hasn't been created.
-# FIXME: This bit of code is old. It might be obsolete.
-if grep '^postgres:' /etc/passwd >/dev/null; then
-	echo > /dev/null
-else
-  getent passwd postgres >/dev/null
-  if [ $? -ne 0 ] ; then
-         exit 0
-  fi
-fi
-
-# Change to /var/tmp, as pgctl etc. need to be started from
-# a directory that they can read
-cd /var/tmp
-
-case "$1" in
-start)
-      if [ -d ${PGDATA} -a `ls -l ${PGDATA} 2> /dev/null | wc -l` -gt 1 ]; then
-         # PostgreSQL data directory exists and is populated
-         echo "Starting PostgreSQL..."
-         su postgres -c "${PGCTL} -D ${PGDATA} -l ${PGDATA}/postgresql.log start ${SERVEROPTS}"
-      fi
-      ;;
-
-stop)
-     echo "Stopping PostgreSQL database..."
-     su postgres -c "${PGCTL} -D ${PGDATA} -l ${PGDATA}/postgresql.log stop"
-     true  # The previous command fails when there's no .pid file
-     ;;
-
-restart)
-     echo "Restarting PostgreSQL database..."
-     su postgres -c "${PGCTL} -D ${PGDATA} -l ${PGDATA}/postgresql.log restart ${SERVEROPTS}"
-     ;;
-
-reload)
-     echo "Reloading PostgreSQL database..."
-     su postgres -c "${PGCTL} -D ${PGDATA} -l ${PGDATA}/postgresql.log reload ${SERVEROPTS}"
-     ;;
-
-status)
-     su postgres -c "${PGCTL} -D ${PGDATA} status"
-     ;;
-
-init)
-     # create and initialise data directory
-     echo "Creating PostgreSQL data directory at ${PGDATA}..."
-     # Create it, unless it's already there and empty
-     [ -d ${PGDATA} -a `ls -l ${PGDATA} 2> /dev/null | wc -l` -eq 1 ] || mkdir -p "${PGDATA}"
-     chown postgres "${PGDATA}"
-     chmod 0700 "${PGDATA}"
-     echo "Initialising PostgreSQL database..."
-     su postgres -c "${PGINIT} -D ${PGDATA} -E utf-8"
-     ;;
-
-*)
-     echo "Usage: ${0} (init|start|stop|restart|reload|status)"
-     ;;
-
-esac
-
-# vim:set ft=sh sw=2 ts=2 sts=2 expandtab si ci:

Copied: csw/mgar/pkg/postgresql/trunk/files/cswpostgresql.tmpl (from rev 16856, csw/mgar/pkg/postgresql/branches/postgresql-9.1-raos/files/cswpostgresql.tmpl)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/cswpostgresql.tmpl	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/cswpostgresql.tmpl	2012-01-20 15:02:39 UTC (rev 16858)
@@ -0,0 +1,117 @@
+#!/bin/sh
+# $Id$
+#
+# PostgreSQL startup script - part of the CSWpostgresql package
+#
+# 2009-11-29  Maciej Blizinski (maciej at opencsw.org)
+#   - Parametrized file locations
+#   - Style changes
+#
+#
+#RC_KNUM 20         # Number used for kill script symlink, e.g. K20cswfoo
+#RC_SNUM 80         # Number used for start script symlink, e.g. S80cswfoo
+#RC_KLEV 0,1,2,S    # Run levels that should have a kill script symlink
+#RC_SLEV 3          # Run levels that should have a start script symlink
+#AUTOENABLE no      # If set to no will not enable service regardless of
+#                     local csw.conf, use when a package needs setup before
+#                     being useful, would otherwise leave service in
+#                     maintenance mode
+
+VERSION=@BASE_VERSION_NODOT@
+
+USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
+PGCTL=@bindir@/pg_ctl-${VERSION}
+PGINIT=@bindir@/initdb-${VERSION}
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
+[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
+
+# Defaults
+[ -z "${PGDATA}" ] && PGDATA=@PGDATA@
+[ -z "${SHUTDOWNMODE}" ] && SHUTDOWNMODE=fast
+[ -z "${PGENCODING}" ] && PGENCODING=UTF8
+[ -z "${PGSUPERUSER}" ] && PGSUPERUSER=postgres
+[ -z "${PGLOGOUTPUT}" ] && PGLOGOUTPUT=${PGDATA}/postgresql.log
+
+if [ -n "${SERVEROPTS}" ]
+then
+    # Remove the -o option, we provide it later on
+    SERVEROPTS=`echo "${SERVEROPTS}" | sed 's/^-o[ ]*//'`
+fi
+if [ -n "${PGLOCALE}" ]
+then
+    PGLOCALE="--locale=${PGLOCALE}"
+fi
+
+
+# Exit if postgres user hasn't been created.
+# FIXME: This bit of code is old. It might be obsolete.
+if grep '^postgres:' /etc/passwd >/dev/null; then
+	echo > /dev/null
+else
+  getent passwd postgres >/dev/null
+  if [ $? -ne 0 ] ; then
+	 exit 0
+  fi
+fi
+
+cd /
+
+case "$1" in
+start)
+      if [ -d ${PGDATA} -a `ls -l ${PGDATA} 2> /dev/null | wc -l` -gt 1 ]; then
+	 # PostgreSQL data directory exists and is populated
+	 echo "Starting PostgreSQL..."
+	 if [ -n "${SERVEROPTS}" ]
+	 then
+	     su postgres -c "${PGCTL} start -D ${PGDATA} -l ${PGLOGOUTPUT} -o '${SERVEROPTS}'"
+	 else
+	     su postgres -c "${PGCTL} start -D ${PGDATA} -l ${PGLOGOUTPUT}"
+	 fi
+      fi
+      ;;
+
+stop)
+     echo "Stopping PostgreSQL database..."
+     su postgres -c "${PGCTL} stop -D ${PGDATA} -l ${PGLOGOUTPUT} -m ${SHUTDOWNMODE}"
+     true  # The previous command fails when there's no .pid file
+     ;;
+
+restart)
+     echo "Restarting PostgreSQL database..."
+     if [ -n "${SERVEROPTS}" ]
+     then
+	 su postgres -c "${PGCTL} restart -D ${PGDATA} -l ${PGLOGOUTPUT} -m ${SHUTDOWNMODE} -o '${SERVEROPTS}'"
+     else
+	 su postgres -c "${PGCTL} restart -D ${PGDATA} -l ${PGLOGOUTPUT} -m ${SHUTDOWNMODE}"
+     fi
+     ;;
+
+reload)
+     echo "Reloading PostgreSQL database..."
+     su postgres -c "${PGCTL} reload -D ${PGDATA} -l ${PGLOGOUTPUT}"
+     ;;
+
+status)
+     su postgres -c "${PGCTL} status -D ${PGDATA}"
+     ;;
+
+init)
+     # create and initialise data directory
+     echo "Creating PostgreSQL data directory at ${PGDATA}..."
+     # Create it, unless it's already there and empty
+     [ -d "${PGDATA}" -a `ls -l ${PGDATA} 2> /dev/null | wc -l` -eq 1 ] || mkdir -p "${PGDATA}"
+     chown postgres "${PGDATA}"
+     chmod 0700 "${PGDATA}"
+     echo "Initialising PostgreSQL database..."
+     su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E ${PGENCODING} -U ${PGSUPERUSER} ${PGLOCALE}"
+     ;;
+
+*)
+     echo "Usage: ${0} (init|start|stop|restart|reload|status)"
+     ;;
+
+esac
+
+# vim:set ft=sh sw=2 ts=2 sts=2 expandtab si ci:

Modified: csw/mgar/pkg/postgresql/trunk/files/cswusergroup.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/cswusergroup.tmpl	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/files/cswusergroup.tmpl	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1 +1 @@
-postgres::CSW Postgres:@PGDATA@:/bin/sh::
+postgres::CSW Postgres:@PGLOCALSTATEDIR_BASE@:/bin/sh::

Modified: csw/mgar/pkg/postgresql/trunk/files/postgresql.conf.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/postgresql.conf.tmpl	2012-01-20 15:00:35 UTC (rev 16857)
+++ csw/mgar/pkg/postgresql/trunk/files/postgresql.conf.tmpl	2012-01-20 15:02:39 UTC (rev 16858)
@@ -1,37 +1,63 @@
-# Example PostgreSQL server configuration file.
+# This is a shell script fragment.
 # 
-# Provided by the OpenCSW package of PostgreSQL.  This file is read by the
-# /etc/opt/csw/init.d/cswpostgres startup script, and can be used to override
-# the defaults.
+# This file is sourced by the /etc/opt/csw/init.d/csw at PGNAME_VERSIONED@
+# startup script, and can be used to override the defaults.
+#
+# Please use alternatives to choose between 32/64bit version of the
+# server (See also @docdir@/@PGNAMEVERSIONED at _server/README.CSW)
 
 # The location of the data directory.
-# Default : /opt/csw/var/pgdata
+#
+# Default: @PGDATA@
 PGDATA=@PGDATA@
 
-# Which binaries to use, 32- or 64-bit.  Only use the 64-bit server if you're
-# sure you need it.  Make sure you have read
-# /opt/csw/postgresql/share/doc/README-CSW.txt before changing these, as your
-# databases may not work without a 'dump and restore' cycle!
+# Specifies the shutdown mode. mode can be smart, fast, or immediate,
+# or the first letter of one of these three.
+#
+# Default: fast
+#SHUTDOWNMODE=fast
 
-# 32-bit server - default, and fine for most uses
-# 
-# PGCTL=/opt/csw/postgresql/bin/sparcv8/pg_ctl
-# PGINIT=/opt/csw/postgresql/bin/sparcv8/initdb
+# Append the server log output to filename. If the file does not
+# exist, it is created. The umask is set to 077, so access to the log
+# file from other users is disallowed by default
+#
+# Default: ${PGDATA}/postgresql.log
+#PGLOGOUTPUT=${PGDATA}/postgresql.log
 
-# 64-bit server - uncomment these lines only if you really need them.
-# 
-# PGCTL=/opt/csw/postgresql/bin/sparcv9/pg_ctl
-# PGINIT=/opt/csw/postgresql/bin/sparcv9/initdb
+# Additional options to pass to postmaster.
+#
+# Please note: it is no longer necessary to pass the '-o' option.
+#
+# SERVEROPTS="-i"
 
+##
+## The following variables are used by initdb when initializing the
+## database cluster
+##
 
-# Additional options to pass to postmaster.
-# 
-# These options will be passed to the postmaster program. The most common use
-# of these is to allow network access to PostgreSQL from other hosts over
-# TCP/IP.  This is done by using the flags "-o -i", as in the example below.
-# Uncomment this line to enable network access to PostgreSQL.  Note that you
-# will still need to configure authentication in the pg_hba.conf in your data
-# directory.
-# 
-# SERVEROPTS="-o -i"
+# The PostgreSQL encoding of the database cluster. This is used when
+# initializing the database cluster using the init script.
+#
+# For a complete list of character sets supported, go to
+#
+#  http://www.postgresql.org/docs/@BASE_VERSION@/static/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED
+#
+# Default: UTF8
+#PGENCODING=UTF8
 
+# The locale used to initialize the database cluster.
+#
+# If none is specified, the locale is inherited from the environment
+# that initdb runs in.
+#
+# Default: <empty>
+#PGLOCALE=en_US.UTF-8
+
+# Selects the user name of the database superuser. This defaults to
+# the name of the effective user running initdb. It is really not
+# important what the superuser's name is, but one might choose to keep
+# the customary name postgres, even if the operating system user's
+# name is different.
+#
+# Default: postgres
+#PGSUPERUSER=postgres

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list