# $Id: Portfile,v 1.20 2005/10/01 09:14:45 mww Exp $

PortSystem 1.0

name			py-psycopg
version			1.1.21
categories		python databases
maintainers		mww@opendarwin.org
platforms		darwin freebsd
description		a python DBAPI-2.0 ompliant database adapter for postgresql
long_description	psycopg is a postgresql database adapter for python. \
				It's fully compliant to pythons DBAPI-2.0. psycopg is \
				designed for heavily multi-threaded applications \
				featuring connection pooling.

homepage		http://www.initd.org/software/initd/psycopg/
master_sites	http://initd.org/pub/software/psycopg/
distname		psycopg-${version}
checksums		md5 a31f79f68d6d32898d6f24e11369a106

depends_lib		port:postgresql8 \
				port:py-mx \
				port:python24 \
				port:openssl

configure.env	LDFLAGS="-L${prefix}/lib -lssl" \
				CPPFLAGS="-I${prefix}/lib/python2.4/site-packages/mx/DateTime/mxDateTime/"
configure.args	--with-postgres-includes=${prefix}/include/pgsql8/ \
				--with-postgres-libraries=${prefix}/lib/pgsql8/ \
				--with-python=${prefix}/bin/python2.4

post-configure {
	cd ${worksrcpath}
	reinplace "s|PY_LIB_DIR = \$(prefix)|\
		PY_LIB_DIR = ${destroot}${prefix}|g" Makefile
	reinplace "s|PY_MOD_DIR = \$(exec_prefix)|\
		PY_MOD_DIR = ${destroot}${prefix}|g" Makefile
	reinplace "s|@echo 'Installing shared modules...'|\
		install -m 755 -d \$(PY_MOD_DIR)|g" Makefile
}

build.target
platform darwin 7 {
	build.env	MACOSX_DEPLOYMENT_TARGET=10.3
}
platform darwin 8 {
	build.env	MACOSX_DEPLOYMENT_TARGET=10.4
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/examples
	xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING RELEASE-1.0 CREDITS \
		SUCCESS ChangeLog VERSION NEWS README FAQ INSTALL TODO \
		doc/python-taylor.txt ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath}/doc/examples binary.py bool.py \
		commit.py copy_from.py copy_from2.py copy_to.py dictfetch.py \
		dt.py first.py integrity.py notify.py oid.py somehackers.jpg \
		threads.py usercast.py whereareyou.jpg work.py \
		${destroot}${prefix}/share/doc/${name}/examples
	cd ${destroot}${prefix}/lib/python2.4/site-packages
	file rename psycopgmodule.so psycopg.so
}
