Index: Mk/bsd.database.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.database.mk,v
retrieving revision 1.66
diff -u -r1.66 bsd.database.mk
--- Mk/bsd.database.mk	14 Oct 2011 22:30:35 -0000	1.66
+++ Mk/bsd.database.mk	1 Mar 2012 21:58:43 -0000
@@ -35,20 +35,19 @@
 # MYSQL_VER
 #				- Detected MySQL version.
 ##
-# USE_PGSQL		- Add PostgreSQL client dependency.
+# USE_PGSQL		- Add PostgreSQL client dependency.  Server can be depended on
+#				  using USE_PGSQL=server.
 #				  If no version is given (by the maintainer via the port or
 #				  by the user via defined variable), try to find the
 #				  currently installed version.  Fall back to default if
-#				  necessary (PostgreSQL-8.4 = 84).
+#				  necessary (PostgreSQL-9.0 = 90).
 # DEFAULT_PGSQL_VER
 #				- PostgreSQL default version.  Can be overridden within a
-#				  port.  Default: 84.
+#				  port.  Default: 90.
 # WANT_PGSQL_VER
 #				- Maintainer can set an arbitrary version of PostgreSQL to
 #				  always build this port with (overrides WITH_PGSQL_VER).
-# IGNORE_WITH_PGSQL
-#				- This variable can be defined if the ports does not support
-#				  one or more versions of PostgreSQL.
+#				  Minimum and maximum versions can be set (e.g. 90+)
 # WITH_PGSQL_VER
 #				- User defined variable to set PostgreSQL version.
 # PGSQL_VER
@@ -173,7 +172,8 @@
 .endif # USE_MYSQL
 
 .if defined(USE_PGSQL)
-DEFAULT_PGSQL_VER?=	84
+VALID_PGSQL_VER=	82 83 84 90 91
+DEFAULT_PGSQL_VER?=	90
 PGSQL82_LIBVER=		5
 PGSQL83_LIBVER=		5
 PGSQL84_LIBVER=		5
@@ -181,51 +181,83 @@
 PGSQL91_LIBVER=		5
 
 # Setting/finding PostgreSQL version we want.
-.if exists(${LOCALBASE}/bin/pg_config)
+.  if exists(${LOCALBASE}/bin/pg_config)
 _PGSQL_VER!=	${LOCALBASE}/bin/pg_config --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)[^0-9].*/\1\2/p'
-.endif
+.	 if defined(WITH_PGSQL_VER) && ${WITH_PGSQL_VER} != ${_PGSQL_VER}
+IGNORE?=		cannot install: you have set WITH_PGSQL_VER=${WITH_PGSQL_VER} in make.conf, but you have postgresql${_PGSQL_VER}-client installed
+.	 endif
+WITH_PGSQL_VER?=	${_PGSQL_VER}
+.  endif
 
-.if defined(WANT_PGSQL_VER)
-.if defined(WITH_PGSQL_VER) && ${WITH_PGSQL_VER} != ${WANT_PGSQL_VER}
-IGNORE=		cannot install: the port wants postgresql${WANT_PGSQL_VER}-client and you try to install postgresql${WITH_PGSQL_VER}-client
-.endif
-PGSQL_VER=	${WANT_PGSQL_VER}
-.elif defined(WITH_PGSQL_VER)
+.  if defined(WANT_PGSQL_VER)
+.    if ${WANT_PGSQL_VER:M*+}
+.      for version in ${VALID_PGSQL_VER}
+.        if ${WANT_PGSQL_VER:S/+//} <= ${version}
+_WANT_PGSQL_VER+=${version}
+.        endif
+.      endfor
+.    elif ${WANT_PGSQL_VER:M*-}
+.      for version in ${VALID_PGSQL_VER}
+.        if ${WANT_PGSQL_VER:S/-//} >= ${version}
+_WANT_PGSQL_VER+=${version}
+.        endif
+.      endfor
+.    endif
+_WANT_PGSQL_VER?=	${WANT_PGSQL_VER}
+
+.    if defined(WITH_PGSQL_VER) && !empty(_WANT_PGSQL_VER)
+.      for version in ${_WANT_PGSQL_VER}
+.        if ${WITH_PGSQL_VER} == ${version} 
 PGSQL_VER=	${WITH_PGSQL_VER}
-.else
-.if defined(_PGSQL_VER)
+.        endif
+.      endfor
+
+# Take highest allowed version, but take default if allowed
+.    elif !empty(_WANT_PGSQL_VER)
+.      for ver in ${_WANT_PGSQL_VER}
+.        if ${DEFAULT_PGSQL_VER} == ${ver}
+PGSQL_VER=	${ver}
+.        else
+_PGSQL_VER_HIGHEST=	${ver}
+.        endif
+.      endfor
+PGSQL_VER?=	${_PGSQL_VER_HIGHEST}
+.    elif defined(WITH_PGSQL_VER)
+PGSQL_VER=	${WITH_PGSQL_VER}
+.  endif
+.  else
+.    if defined(_PGSQL_VER)
 PGSQL_VER=	${_PGSQL_VER}
-.else
+.    else
 PGSQL_VER=	${DEFAULT_PGSQL_VER}
-.endif
-.endif # WANT_PGSQL_VER
+.    endif
+.  endif # WANT_PGSQL_VER
 
-.if defined(_PGSQL_VER) && ${PGSQL_VER} != ${_PGSQL_VER}
-IGNORE=		cannot install: the port wants postgresql${PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
-.endif
+.      if empty(PGSQL_VER)
+IGNORE?=	cannot install: the port wants postgresql-client version ${WANT_PGSQL_VER} and you have set WITH_PGSQL_VER=${WITH_PGSQL_VER} in make.conf or have postgresql${WITH_PGSQL_VER}-client installed
+.      endif
 
 # And now we are checking if we can use it
 .if defined(PGSQL${PGSQL_VER}_LIBVER)
-# compatibility shim
-.if defined(BROKEN_WITH_PGSQL)
-IGNORE_WITH_PGSQL=${BROKEN_WITH_PGSQL}
-.endif
 .if defined(IGNORE_WITH_PGSQL)
 .	for VER in ${IGNORE_WITH_PGSQL}
 .		if (${PGSQL_VER} == "${VER}")
-IGNORE=		cannot install: does not work with postgresql${PGSQL_VER}-client (PostgresSQL ${IGNORE_WITH_PGSQL} not supported)
+IGNORE?=		cannot install: does not work with postgresql${PGSQL_VER}-client (PostgresSQL ${IGNORE_WITH_PGSQL} not supported)
 .		endif
 .	endfor
 .endif # IGNORE_WITH_PGSQL
 LIB_DEPENDS+=	pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
+.  if ${USE_PGSQL:Mserver}
+BUILD_DEPENDS+=	postgres:${PORTSDIR}/databases/postgresql${PGSQL_VER}-server
+RUN_DEPENDS+=	postgres:${PORTSDIR}/databases/postgresql${PGSQL_VER}-server
+.  endif
 .else
-IGNORE=		cannot install: unknown PostgreSQL version: ${PGSQL_VER}
+IGNORE?=		cannot install: unknown PostgreSQL version: ${PGSQL_VER}
 .endif # Check for correct version
 CPPFLAGS+=		-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
 .endif # USE_PGSQL
 
-
 .if defined(USE_BDB)
 
 _DB_PORTS=	40 41 42 43 44 46 47 48 5 40+ 41+ 42+ 43+ 44+ 46+ 47+ 48+
Index: databases/postgresql-plruby/Makefile
===================================================================
RCS file: /home/pcvs/ports/databases/postgresql-plruby/Makefile,v
retrieving revision 1.41
diff -u -r1.41 Makefile
--- databases/postgresql-plruby/Makefile	12 Sep 2011 09:51:35 -0000	1.41
+++ databases/postgresql-plruby/Makefile	1 Mar 2012 21:58:43 -0000
@@ -21,11 +21,9 @@
 MAINTAINER=	knu@FreeBSD.org
 COMMENT=	PL/Ruby procedural language for the PostgreSQL database system
 
-BUILD_DEPENDS=	postgres:${PORTSDIR}/${POSTGRESQL_PORT}
-RUN_DEPENDS=	postgres:${PORTSDIR}/${POSTGRESQL_PORT}
-
 USE_BZIP2=	yes
-USE_PGSQL=	yes
+USE_PGSQL=	server
+WANT_PGSQL_VER=	84-
 USE_RUBY=	yes
 USE_RUBY_EXTCONF=	yes
 USE_RUBY_RDOC=		yes
Index: www/thundercache/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/thundercache/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- www/thundercache/Makefile	20 Aug 2011 17:27:51 -0000	1.21
+++ www/thundercache/Makefile	1 Mar 2012 21:58:43 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	thundercache
 PORTVERSION=	6.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	www
 MASTER_SITES=	http://www.bmsoftware.org/packs/ \
 		http://www8.freebsdbrasil.com.br/~eksffa/thunder/ \
@@ -55,7 +55,7 @@
 
 .if defined (WITH_PGSQL)
 USE_PGSQL=	yes
-WANT_PGSQL_VER=	84
+WANT_PGSQL_VER=	84+
 RUN_DEPENDS+=	postgresql-server>=0:${PORTSDIR}/databases/postgresql${PGSQL_VER}-server
 .endif
 
Index: www/thundersnarf/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/thundersnarf/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- www/thundersnarf/Makefile	20 Aug 2011 17:27:52 -0000	1.6
+++ www/thundersnarf/Makefile	1 Mar 2012 21:58:43 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	thundersnarf
 PORTVERSION=	1.3
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	www
 MASTER_SITES=	http://www.tracanelli.com.br/l/dev/thunder/ \
@@ -33,7 +33,7 @@
 
 .if defined (WITH_PGSQL)
 USE_PGSQL=	yes
-WANT_PGSQL_VER=	84
+WANT_PGSQL_VER=	84+
 RUN_DEPENDS+=	postgresql-server>=0:${PORTSDIR}/databases/postgresql${PGSQL_VER}-server
 .endif
 
