# $Id: Portfile 82946 2011-08-22 14:11:48Z ryandesign@macports.org $

PortSystem 1.0

name				mysql-connector-java
version				5.1.12
license             GPL-2
set branch          [join [lrange [split ${version} .] 0 1] .]

categories			java
maintainers			nomaintainer
platforms			darwin

description			MySQL Official JDBC connector for MySQL database.
long_description	MySQL Connector/J is a native Java driver that converts JDBC \
					(Java Database Connectivity) calls into the network protocol \
					used by the MySQL database. It lets developers working with \
					the Java programming language easily build programs and applets \
					that interact with MySQL and connect all corporate data, even \
					in a heterogeneous environment. MySQL Connector/J is a Type IV \
					JDBC driver and has a complete JDBC feature set that supports \
					the capabilities of MySQL.
homepage			http://dev.mysql.com/doc/refman/${branch}/en/connector-j.html

master_sites		http://ftp.plusline.de/mysql/Downloads/Connector-J/

checksums           md5     d2f836c761614a3fdf39f7a6c7c1acb5 \
                    sha1    e63fed86be594a6166eaf4abf69375747042dcc6 \
                    rmd160  43aa29a886c488c985608278b66f746546a4cfd7

patchfiles			patch-build.xml

depends_build		bin:ant:apache-ant
depends_lib			bin:java:kaffe \
					port:junit \
					port:jakarta-log4j


set javaLibs		${prefix}/share/java

use_configure		no

build.cmd			ant
build.target		dist
build.args			-Djunit.jar=${javaLibs}/junit.jar \
					-Dlog4j.jar=${javaLibs}/jakarta-log4j.jar					

destroot {
	xinstall -d ${destroot}${prefix}/share/java \
		${destroot}${prefix}/share/doc
	xinstall -m 644 ${worksrcpath}/build/${distname}/${distname}-bin.jar \
		${destroot}${prefix}/share/java/${name}-5.0.jar
	copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${name}

    set docdir ${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} CHANGES COPYING EXCEPTIONS-CONNECTOR-J \
        ${destroot}${docdir}
}

platform darwin {
    if {${os.major} >= 10} {
        patchfiles-append patch-JDK-1.6.diff
        post-patch {
            reinplace -E {/name="compile"/s/compile-testsuite, //} \
                ${worksrcpath}/build.xml
        }
    }
}

universal_variant no

livecheck.type  regex
livecheck.url   http://dev.mysql.com/downloads/connector/j/${branch}.html
livecheck.regex "${name}-(\\d+\\.\\d+(\\.\\d+)?).tar.gz"
