# -*- 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 117500 2014-03-01 11:52:38Z hum@macports.org $

PortSystem          1.0

name                word2vec
version             20131218
categories          textproc
maintainers         hum openmaintainer

description         Tool for computing continuous distributed representations of words

long_description    This tool provides an efficient implementation of the \
                    continuous bag-of-words and skip-gram architectures for \
                    computing vector representations of words. These \
                    representations can be subsequently used in many natural \
                    language processing applications and for further research.

homepage            https://code.google.com/p/word2vec/
platforms           darwin
license             Apache-2

fetch.type          svn
svn.url             http://word2vec.googlecode.com/svn/trunk
svn.revision        37
worksrcdir          trunk

patchfiles          patch-malloc.diff \
                    patch-compute-accuracy.c.diff \
                    patch-demo.diff

use_configure       no
variant universal   {}

configure.optflags  -O2

build.args          CC="${configure.cc}" \
                    CFLAGS="${configure.cflags} [get_canonical_archflags] -lm -pthread -Wall -funroll-loops"

destroot {
    set execdir ${prefix}/libexec/${name}
    xinstall -d ${destroot}${execdir}
    xinstall -m 755 -W ${worksrcpath} \
        word2vec word2phrase distance word-analogy compute-accuracy \
        demo-analogy.sh demo-classes.sh demo-phrase-accuracy.sh \
        demo-phrases.sh demo-word-accuracy.sh demo-word.sh \
        ${destroot}${execdir}
    set exdir ${prefix}/share/examples/${name}
    xinstall -d ${destroot}${exdir}
    xinstall -m 644 -W ${worksrcpath} \
        questions-phrases.txt questions-words.txt \
        ${destroot}${exdir}
    # fix demo scripts.
    foreach f [glob ${destroot}${execdir}/demo-*.sh] {
        reinplace "s|@EXECDIR@|${execdir}|g" ${f}
        reinplace "s|@EXDIR@|${exdir}|g" ${f}
    }
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        LICENSE README.txt \
        ${destroot}${docdir}
}

livecheck.type      none
