Portfile

# $Id: Portfile 23055 2007-03-23 23:55:15Z landonf@macports.org $

PortSystem 1.0
name libgda
version 1.2.4
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 landonf@macports.org
categories gnome
platforms darwin
homepage http://www.gnome-db.org/
master_sites gnome:sources/libgda/1.2/
checksums md5 512a8ed842ce98eb432e69bd6867f437
use_bzip2 yes

depends_lib port:libxslt \
port:glib2

depends_build port:gnome-doc-utils

# Wow this is ugly. The database ports should probably support
# ${prefix}/database instead of this weird include/database lib/database
# magic.
set mysqldir "${workpath}/mysql"
set pgdir "${workpath}/pgsql"

configure.env CPPFLAGS="-I${prefix}/include -I${prefix}/include/db4 -I${pgdir}/include" \
LDFLAGS="-Wl,-undefined -Wl,dynamic_lookup -L${prefix}/lib -L${pgdir}/lib" MACOSX_DEPLOYMENT_TARGET="10.3"

configure.args --mandir=${prefix}/share/man

default_variants +mysql5 +db4 +postgresql8 +sqlite

post-configure {
cd ${worksrcpath}
reinplace "s|-ldb|-ldb-4|g" \
Makefile data/Makefile \
doc/C/Makefile doc/Makefile \
libgda/Makefile libsql/Makefile \
providers/Makefile \
providers/bdb/Makefile \
providers/firebird/Makefile \
providers/freetds/Makefile \
providers/ibmdb2/Makefile \
providers/ldap/Makefile \
providers/mdb/Makefile \
providers/mdb/Makefile \
providers/msql/Makefile \
providers/mysql/Makefile \
providers/odbc/Makefile \
providers/oracle/Makefile \
providers/postgres/Makefile \
providers/sqlite/Makefile \
providers/xbase/Makefile \
providers/sybase/Makefile \
providers/xml/Makefile \
report/Makefile \
report/libgda-report/Makefile \
report/testing/Makefile \
testing/Makefile \
tools/Makefile
}

post-patch {
if {[variant_isset "mysql5"]} {
file mkdir ${mysqldir}
system "ln -s \"[file join ${prefix} include mysql5]\" \"[file join ${mysqldir} include]\""
system "ln -s \"[file join ${prefix} lib mysql5]\" \"[file join ${mysqldir} lib]\""
}

if {[variant_isset "postgresql8"]} {
file mkdir ${pgdir}
system "ln -s \"[file join ${prefix} include pgsql8]\" \"[file join ${pgdir} include]\""
system "ln -s \"[file join ${prefix} lib pgsql8]\" \"[file join ${pgdir} lib]\""
}
}

variant mysql5 {
depends_lib-append port:mysql5
configure.args-append --with-mysql=${mysqldir}
}

variant postgresql8 {
depends_lib-append port:postgresql8
configure.args-append --with-postgres=${pgdir}
}

variant db4 {
depends_lib-append port:db4
configure.args-append --with-bdb=${prefix}
}

variant sqlite {
depends_lib-append port:sqlite3
configure.args-append --with-sqlite=${prefix}
}