# $Id: Portfile 51021 2009-05-15 15:55:30Z and.damore@macports.org $

PortSystem 1.0

name			postgis
version			1.3.3
revision		1
categories		databases
platforms		darwin
maintainers		frank-lists@auroralux.net
description		adds support for geographic objects to the postgresql database
long_description	PostGIS adds support for geographic objects to the \
			PostgreSQL object-relational database. In effect, PostGIS \
			"spatially enables" the PostgreSQL server, allowing it to be used \
			as a backend spatial database for geographic information systems \
			(GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS \
			follows the OpenGIS Simple Features Specification for SQL and \
			will be submitted for conformance testing at version 1.0.

homepage		http://postgis.refractions.net/
master_sites	http://distfiles.macports.org/${dist_subdir}/ \
				http://postgis.refractions.net/download/
checksums		sha1 12b0da709360f67340f88774b70cf3bac65fcc24
patchfiles		patch-extras-template_gis-postgis_env.sh.in \
				patch-Makefile.config.in.diff

depends_lib		port:geos port:proj port:libiconv

configure.args		--datadir=${prefix}/share/${name} \
			--with-geos=${prefix}/bin/geos-config \
			--with-proj=${prefix}

build.args "ICONV_LDFLAGS=\"-L${prefix}/lib -liconv\""

#
# Default to PostgreSQL 8.3
#
set default_configure		"--libdir=${prefix}/lib/postgresql83/ --with-pgsql=${prefix}/lib/postgresql83/bin/pg_config"
set default_depends		port:postgresql83

configure.args-append		${default_configure}
depends_lib-append		${default_depends}

# Support for older PostgreSQL versions
variant postgresql82 {
	# Remove the default dependency
	global default_configure
	global default_depends

	configure.args-delete	$default_configure
	depends_lib-delete	$default_depends

	# Declare the 8.2 dependency
	depends_lib-append	port:postgresql82
	configure.args-append	--libdir=${prefix}/lib/postgresql82/ \
				--with-pgsql=${prefix}/lib/postgresql82/bin/pg_config
}
