# -*- 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                lda-c
version             20080413
categories          math
maintainers         nomaintainer

description         a C implementation of latent Dirichlet allocation (LDA)

long_description    LDA-C is a C implementation of latent Dirichlet allocation \
                    (LDA) made by David M. Blei.

homepage            http://www.cs.princeton.edu/~blei/lda-c/
platforms           darwin
license             GPL

distname            ${name}-dist
extract.suffix      .tgz

master_sites        ${homepage}
checksums           ${distname}${extract.suffix} \
                    rmd160  a1e2fb1248827142eb31b72dc5a63ca57ffb6470 \
                    sha256  d3f387bfd468552319a05d62f33be9872c1b03bee1c7e382ebda37d8e35bc993

use_configure       no

variant universal {}

build.args          CC=${configure.cc} CFLAGS="${configure.cflags} [get_canonical_archflags]"
build.target        

set share_dir       ${prefix}/share/${name}

destroot {
    # install lda executable as 'lda-c'.
    xinstall -m 755 ${worksrcpath}/lda ${destroot}${prefix}/bin/${name}
    # install additional documents.
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        readme.txt todo.txt \
        ${destroot}${docdir}
    # install settings files and a script.
    xinstall -d ${destroot}${share_dir}
    foreach f {inf-settings.txt settings.txt} {
        xinstall -m 644 ${worksrcpath}/${f} ${destroot}${share_dir}
    }
    xinstall -m 755 ${worksrcpath}/topics.py ${destroot}${share_dir}
}

variant sample description {Add sample data from the Associated Press} {
    distfiles-append    ap${extract.suffix}
    checksums-append    ap${extract.suffix} \
                        rmd160  25b1b2e8871eb50cb6a179c0b100c455fc19bca6 \
                        sha256  91bc914b8f66d55c3b87556d6450b7a7c635efae752eedc702fd20b1fb1b3e8b
    post-destroot {
        copy ${workpath}/ap ${destroot}${share_dir}
    }
}

default_variants    +sample

livecheck.type      none
