# -*- 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

PortSystem          1.0

name                sgd
version             2.1
revision            1
categories          math textproc
maintainers         nomaintainer

description         Stochastic Gradient Descent
long_description    The goal of this package is to illustrate the efficiency of \
                    stochastic gradient descent for large-scale learning tasks. \
                    Two algorithms, Stochastic Gradient Descent (SGD), and \
                    Averaged Stochastic Gradient Descent (ASGD), are applied to \
                    two well known problems, Linear Support Vector Machines, and \
                    Conditional Random Fields.

homepage            http://leon.bottou.org/projects/sgd
platforms           darwin
license             LGPL-3

master_sites        http://leon.bottou.org/_media/projects/
checksums           rmd160  ee438a984a67b36944d4dba3fa2de2cd017d665f \
                    sha256  f591e8352bfc47f280887a23cac521123814556abd510b65e4ba39218275a112
 
depends_lib         port:zlib

patchfiles          patch-c++11.diff

use_configure       no

variant universal {}

build.args          CXX=${configure.cxx} \
                    CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx] -I../lib" \
                    LIBS="-L${prefix}/lib -lz -lm"

destroot {
    # install executables.
    xinstall -m 755 -W ${worksrcpath}/crf \
        crfsgd crfasgd conlleval \
        ${destroot}${prefix}/bin
    xinstall -m 755 -W ${worksrcpath}/svm \
        prep_rcv1 prep_alpha prep_webspam svmsgd svmasgd \
        ${destroot}${prefix}/bin
    # install additional documents.
    set dest_doc ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${dest_doc}
    xinstall -m 644 -W ${worksrcpath} \
        COPYING README.txt \
        ${dest_doc}
    xinstall -d ${dest_doc}/crf
    xinstall -m 644 ${worksrcpath}/crf/README.txt ${dest_doc}/crf
    xinstall -d ${dest_doc}/svm
    xinstall -m 644 ${worksrcpath}/svm/README.txt ${dest_doc}/svm
    # install examples.
    set dest_ex ${destroot}${prefix}/share/examples/${name}
    xinstall -d ${dest_ex}
    copy ${worksrcpath}/data ${dest_ex}
    xinstall -d ${dest_ex}/crf
    xinstall -m 644 ${worksrcpath}/crf/template ${dest_ex}/crf
}

livecheck.type      regex
livecheck.regex     ${name}-(\[0-9.\]+)\\.tar
