# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 67784 2010-05-18 11:17:22Z ryandesign@macports.org $

PortSystem 1.0
PortGroup               archcheck 1.0

name		pgAdmin3
version		1.10.3

categories	aqua
maintainers	jwa

description	An administration program to PostgreSQL
long_description pgAdmin III is a powerful administration and development \
    platform for the PostgreSQL database, free for any use. The \
    application works on several platforms, e.g. GNU/Linux, FreeBSD, \
    OS X and Windows 2000/XP. This port is for OS X.

platforms	macosx
homepage	http://www.pgadmin.org/

master_sites	http://developer.pgadmin.org/ftp/release/v${version}/src/ \
    http://www.postgresql.org/ftp/pgadmin3/release/v${version}/src/

distname	pgadmin3-${version}

checksums           md5     c8f104c9b6835f5ea24393c2f93b8a7b \
                    sha1    d5895ca8be9cccf0faa626b2b7be0049dd4abf92 \
                    rmd160  8db5b45c946fb4ed990f8386cb193f56c9a0cca9

depends_lib	port:postgresql84 \
    port:wxWidgets \
    port:openssl \
    port:libxml2 \
    port:libxslt

archcheck.files lib/postgresql84/libpq.dylib \
    lib/libwx_macu_gl-2.8.dylib

configure.args	--with-pgsql=${prefix}/lib/postgresql84 \
    --with-wx=${prefix} \
    --with-wx-version=2.8 \
    --with-libxml2=${prefix} \
    --with-libxslt=${prefix} \
    --enable-appbundle

use_parallel_build	no
build.target	all install

if {$build_arch == "x86_64"} {
    configure.build_arch i386
} elseif {$build_arch == "ppc64"} {
    configure.build_arch ppc
}
if {![info exists configure.ld_archflags]} {
    eval configure.ldflags-append ${configure.cc_archflags}
}
# wxWidgets is not universal
universal_variant no

#destroot.violate_mtree	yes
destroot {
    xinstall -d -m 0755 ${destroot}${applications_dir}
    file copy ${worksrcpath}/${name}.app ${destroot}${applications_dir}/${name}.app
}

variant with_postgresql82 conflicts with_postgresql83 \
    description {support for PostgreSQL 8.2.x} {
	depends_lib-delete	port:postgresql84
	depends_lib-delete	--with-pgsql=${prefix}/lib/postgresql84
	depends_lib-append	port:postgresql82
	configure.args-append	--with-pgsql=${prefix}/lib/postgresql82
}

variant with_postgresql83 conflicts with_postgresql82 \
    description {support for PostgreSQL 8.3.x} {
	depends_lib-delete	port:postgresql84
	depends_lib-delete	--with-pgsql=${prefix}/lib/postgresql84
	depends_lib-append	port:postgresql83
	configure.args-append	--with-pgsql=${prefix}/lib/postgresql83
}

variant debug description {provide a debug build in case of difficulties} {
    configure.args-append	--enable-debug
}

livecheck.type	regex
livecheck.url	${homepage}
livecheck.regex	pgAdmin v(1\\.\[0-9\]+\\.\[0-9\]+)
