# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 76899 2011-03-12 14:47:29Z mnick@macports.org $

PortSystem          1.0

name                weka
version             3.6.4
set dash_vers       [string map {. -} ${version}]
maintainers         mnick

categories          science java
description         Weka is a collection of machine learning algorithms for data mining tasks implemented in java
long_description    ${description}. \
                    The algorithms can either be applied directly to a dataset or called from \
                    your own Java code. Weka contains tools for data pre-processing, classification, \
                    regression, clustering, association rules, and visualization. It is also \
                    well-suited for developing new machine learning schemes.
license             GPL

platforms           darwin

homepage            http://www.cs.waikato.ac.nz/ml/weka/
master_sites        sourceforge:weka
use_zip             yes
distname            ${name}-${dash_vers}

checksums           md5     39555fdb912552d418538f6e6b74d784 \
                    sha1    d0d4fd9bfbea42fe270f1ecbed54533968c9e5c4 \
                    rmd160  6694adcb5e0feeb382a6cfd74024ba50d46a63c9

patchfiles          patch-build.xml.diff

use_configure       no
depends_build       port:jarbundler \
                    bin:ant:apache-ant

build.env-append    CLASSPATH=${prefix}/share/java/jarbundler.jar
build.cmd           ant
build.args          "compile release_sub_tasks osx_application"
build.pre_args      -Drelease='${version}'

post-extract {
    system "cd ${worksrcpath} && jar xf ./weka-src.jar"
    file copy ${portpath}/${filesdir}/weka_icon.icns ${worksrcpath}/src/main/java/weka/gui
}

pre-build {
    reinplace "s|wekadocs|${worksrcdir}|g" ${worksrcpath}/build.xml
}

destroot {
    file copy ${worksrcpath}/osx-distrib/weka-${version}.app ${destroot}${applications_dir}/Weka.app
}

# only check even minor versions for stable releases
livecheck.type     regex
livecheck.url       http://sourceforge.net/export/rss2_projfiles.php?project=weka
livecheck.regex     <title>${name}-\\d-\\d*\[24680\] (\\d.*) released .*</title>
