# $Id: Portfile 107756 2013-07-05 07:18:55Z jeremyhu@macports.org $

PortSystem 1.0

name		libgda3
set gname       libgda
version		3.0.4
revision	3
license         {LGPL GPL}
description	GDA provides uniform access to different 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	nomaintainer
categories	databases gnome
platforms	darwin
homepage	http://www.gnome-db.org/
distname	libgda-${version}
master_sites    gnome:sources/${gname}/3.0/
use_bzip2	yes
checksums       md5     1096d03d64ee50f98a59ef5e7f906c9c \
                sha1    50ba121e05ab1fbe95b66e8df4f54a0c6a30ef23 \
                rmd160  6efbf5a0f40277124dcc5464168677cc97be40e3


depends_lib	\
	port:gettext \
	port:libiconv \
	port:libxml2 \
	port:ncurses \
	port:readline \
	port:zlib \
	path:lib/pkgconfig/glib-2.0.pc:glib2

depends_build	\
	port:flex \
	port:m4 \
	port:pkgconfig \
	port:gnome-doc-utils

patchfiles      patch-glib-2.32.diff

# Don't do intltool's INTLTOOL_PERL dance
use_autoreconf  yes
autoreconf.args -fvi

# fix build with clang, see #34331

if {${configure.compiler} == "clang"} {
        configure.cflags-append -Wno-return-type
}

configure.args  --mandir=${prefix}/share/man \
                --without-odbc \
                --without-mysql \
                --without-mSQL \
                --without-postgres \
                --without-tds \
                --without-ibmdb2 \
                --without-sybase \
                --without-oracle \
                --without-firebird \
                --without-xbase \
                --without-mdb \
                --without-ldap
                
post-configure {
	fs-traverse file ${worksrcpath} {
		if [string match {/Makefile$} ${file}] {
			reinplace "s|-ldb|-lbd-4|g" ${file}
		}
	}
}

default_variants +with_bdb46

variant with_mysql4 conflicts with_mysql5 \
    description {support for MySQL 4.x} {
	depends_lib-append	port:mysql4
	configure.args-replace  --without-mysql --with-mysql=${prefix}
}

variant with_mysql5 conflicts with_mysql4 \
    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-replace  --without-mysql --with-mysql=${prefix}/lib/mysql5
	configure.cppflags-append	"-I${prefix}/include/mysql5/mysql"
}

variant with_postgresql82 conflicts with_postgresql83 \
    description {support for PostgreSQL 8.2.x} {
	configure.cppflags-append	"-I${prefix}/include/postgresql82"
	configure.ldflags-append	"-L${prefix}/lib/postgresql82"
	depends_lib-append	port:postgresql82
	configure.args-replace  --without-postgres --with-postgres
}

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

variant with_bdb46 conflicts without_bdb \
    description {support for Berkeley DB 4.6} {
	depends_lib-append	port:db46
	configure.args-append	--with-bdb=${prefix}
	configure.cppflags-append	"-I${prefix}/include/db46"
	configure.ldflags-append	"-L${prefix}/lib/db46"
	
}

variant without_bdb conflicts with_bdb46 \
    description {remove support for Berkeley DB} {
	configure.args-append	--without-bdb
}

livecheck.type gnome
livecheck.name ${gname}
livecheck.regex {LATEST-IS-(3\.\d*[02468](?:\.\d+)*)}
