# -*- 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 89386 2012-01-27 16:37:03Z hum@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        JohnLangford vowpal_wabbit 6.1
categories          math
maintainers         hum openmaintainer

description         a fast online learning tool
long_description    Vowpal Wabbit is the essence of speed in machine learning, able to \
                    learn from terafeature datasets with ease. Via parallel learning, \
                    it can exceed the throughput of any single machine network interface \
                    when doing linear learning, a first amongst learning algorithms.

homepage            http://hunch.net/~vw/
platforms           darwin
license             BSD

checksums           rmd160  a18dbff352b503040d3c4b8991b8ebf60e341dd2 \
                    sha256  26a23aed9497025a678bd0031577434f872dade86dafc5d749dea48f9232c9ad

depends_lib         port:boost

use_configure       no

variant universal   {}

if {${configure.compiler} == "clang"} {
    configure.compiler llvm-gcc-4.2
}

build.args          COMPILER=${configure.cxx} \
                    FLAGS="-I${prefix}/include ${configure.cxxflags} [get_canonical_archflags cxx]" \
                    BOOST_LIBRARY=${prefix}/lib

test.run            yes

destroot {
    xinstall -m 755 -W ${worksrcpath} vw active_interactor ${destroot}${prefix}/bin
}

set cluster_dir     ${worksrcpath}/cluster

variant cluster description {Add cluster codes} {
    post-build {
        system -W ${cluster_dir} "${build.cmd} [join ${build.args}] ${build.target}"
    }
    post-destroot {
        xinstall -m 755 -W ${cluster_dir} spanning_tree ${destroot}${prefix}/bin
    }
}

default_variants    +cluster
