# -*- 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 67579 2010-05-13 10:03:19Z jwa@macports.org $

PortSystem 1.0

name		libgda4
conflicts       libgda3
set gname       libgda
version		4.1.5
set branch      [join [lrange [split ${version} .] 0 1] .]
description	GDA provides uniform access to diffent kinds of data sources.
long_description	\
    GNU Data Access (GDA) is an attempt to provide \
    uniform access to different kinds of data sources \
    (databases, information servers, mail spools, etc).
maintainers	jwa devans openmaintainer
categories	databases gnome
platforms	darwin
homepage	http://www.gnome-db.org/
distname	libgda-${version}
master_sites    gnome:sources/${gname}/${branch}/
use_bzip2	yes

checksums           md5     2b9e2482ba68ceb3c9c92573be499cf1 \
                    sha1    8698c8b0833dc67046aeb73601377e1deca64b0e \
                    rmd160  77c1eb05d68060e718ab1b0239364e52f3b27e29

patchfiles      patch-configure.in.diff

depends_build	port:pkgconfig \
                port:flex \
	        port:m4 \
	        port:intltool \
                port:p5-xml-parser \
	        port:gnome-doc-utils

depends_lib	port:gettext \
	        port:libiconv \
	        port:libxml2 \
	        port:ncurses \
	        port:readline \
	        port:zlib \
	        port:gnome-vfs \
                port:sqlite3 \
                port:libsoup

#
# prefer Berkeley DB 4.7 over 4.6
# and depend on it if 4.6 is not installed
# if both are installed configure will select 4.7
# otherwise look for 4.6
#

if (![variant_isset without_bdb]) {
    if !([file exists ${prefix}/include/db46/db.h]) {
        depends_lib-append port:db47
    } elseif ([file exists ${prefix}/include/db47/db.h])  {
        depends_lib-append port:db47
    } else {
        depends_lib-append port:db46
    }
}

use_autoconf    yes

configure.perl  ${prefix}/bin/perl
configure.env-append  INTLTOOL_PERL=${configure.perl}

configure.args  --mandir=${prefix}/share/man \
                --with-bdb=${prefix} \
                --enable-system-sqlite \
                --without-odbc \
                --without-mysql \
                --without-msql \
                --without-postgres \
                --without-tds \
                --without-ibmdb2 \
                --without-sybase \
                --without-oracle \
                --without-firebird \
                --without-xbase \
                --without-mdb \
                --without-ldap \
                --without-java \
                --without-jni

variant with_mysql5 \
    description {support for current MySQL 5.x} {
	depends_lib-append	path:bin/mysql_config5:mysql5
	configure.env-append	\
		MYSQL_CONFIG=${prefix}/lib/mysql5/bin/mysql_config
	configure.args-delete   --without-mysql
	configure.args-append	--with-mysql=${prefix}/lib/mysql5
	configure.cppflags-append	"-I${prefix}/include/mysql5/mysql"
}

variant with_postgresql83 conflicts with_postgresql84 \
    description {support for PostgreSQL 8.3.x} {
	configure.cppflags-append	"-I${prefix}/include/postgresql83"
	depends_lib-append	port:postgresql83
	configure.args-delete   --without-postgres
	configure.args-append	--with-postgres=${prefix}/lib/postgresql83
}

variant with_postgresql84 conflicts with_postgresql83 \
    description {support for PostgreSQL 8.4.x} {
	configure.cppflags-append	"-I${prefix}/include/postgresql84"
	depends_lib-append	port:postgresql84
	configure.args-delete   --without-postgres
	configure.args-append	--with-postgres=${prefix}/lib/postgresql84
}

variant without_bdb \
    description {remove support for Berkeley DB} {
	configure.args-delete   --with-bdb=${prefix}
	configure.args-append	--without-bdb
}

livecheck.type		regex
livecheck.url		http://ftp.gnome.org/pub/GNOME/sources/${gname}/${branch}/
livecheck.regex		"LATEST-IS-(\\d+(?:\\.\\d+)*)"
