# -*- 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
PortGroup           github 1.0

github.setup        tmikolov word2vec 20c129af10659f7c50e86e3be406df663beff438
version             20170716
revision            0
checksums           rmd160  de98886c52303242566eacd5a3eaf4459026bd71 \
                    sha256  e546d2c1213ca55fd2291a638139ef2730c3f0b737b2aa42dd98e25936a226c0 \
                    size    104875

categories          textproc
maintainers         nomaintainer

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.

platforms           darwin
license             Apache-2
github.tarball_from archive

depends_run         port:wget

patchfiles          fgetc_unlocked-fputc_unlocked.patch \
                    prevent-early-exit.patch \
                    patch-compute-accuracy.c.diff \
                    patch-demo.diff

use_configure       no
variant universal   {}

# This is what the makefile uses.
configure.optflags  -O3

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

destroot {
    set execdir ${prefix}/libexec/${name}
    xinstall -d ${destroot}${execdir}
    xinstall -m 0755 -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 0644 -W ${worksrcpath} \
        questions-phrases.txt questions-words.txt \
        ${destroot}${exdir}
    reinplace "s|@EXECDIR@|${execdir}|g" {*}[glob ${destroot}${execdir}/demo-*.sh]
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        LICENSE README.txt \
        ${destroot}${docdir}
}
