# -*- 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 86155 2011-10-20 06:08:11Z ryandesign@macports.org $

PortSystem          1.0

fetch.type          svn
svn.url             http://sofia-ml.googlecode.com/svn/trunk/sofia-ml
svn.revision        42

name                sofia-ml
version             2011-06-20-r${svn.revision}
revision            1
categories          math
platforms           darwin
maintainers         hum openmaintainer
license             Apache-2.0

homepage            http://code.google.com/p/sofia-ml/
description         Suite of Fast Incremental Algorithms for Machine Learning
long_description    The suite of fast incremental algorithms for machine learning (sofia-ml) \
                    can be used for training models for classification, regression, ranking, \
                    or combined regression and ranking. Several different techniques are \
                    available. This release is intended to aid researchers and practitioners \
                    who require fast methods for classification and ranking on large, sparse \
                    data sets.

worksrcdir          ${name}

use_configure       no

variant universal   {}

build.dir           ${worksrcpath}/src
build.args          GCC="${configure.cxx} ${configure.cxxflags} [get_canonical_archflags cxx]"
build.target        

test.run            yes
eval test.args      ${build.args}
test.target         all_test

destroot {
    xinstall -m 755 -W ${worksrcpath} sofia-ml ${destroot}${prefix}/bin
    xinstall -m 755 -W ${worksrcpath} eval.pl  ${destroot}${prefix}/bin/sofia-eval.pl
    file mkdir ${destroot}${prefix}/share/${name}
    foreach item {COPYING README demo papers} {
        file copy ${worksrcpath}/${item} \
            ${destroot}${prefix}/share/${name}
    }
}

set kmeans_worksrcpath ${worksrcpath}/cluster-src

variant kmeans description {Add sofia-kmeans package} {
    post-build {
        system -W ${kmeans_worksrcpath} "${build.cmd} [join ${build.args}] ${build.target}"
    }
    post-test {
        system -W ${kmeans_worksrcpath} "${build.cmd} [join ${test.args}] ${test.target}"
    }
    post-destroot {
        xinstall -m 755 -W ${worksrcpath} sofia-kmeans ${destroot}${prefix}/bin
    }
}

default_variants    +kmeans

livecheck.type      regex
livecheck.version   ${svn.revision}
livecheck.url       ${homepage}source/list
livecheck.regex     >r(\\d+)<
