PortSystem          1.0

name                wordnet
version             3.0
revision            3
checksums           rmd160  87b3719273ec8f1d87742d6802af4d442b6ad040 \
                    sha256  6c492d0c7b4a40e7674d088191d3aa11f373bb1da60762e098b8ee2dda96ef22 \
                    size    9060524

categories          textproc
license             Permissive
maintainers         nomaintainer
description         Lexical database for the English language
long_description    WordNet® is a large lexical database of English, developed \
                    under the direction of George A. Miller. Nouns, verbs, \
                    adjectives and adverbs are grouped into sets of cognitive \
                    synonyms (synsets), each expressing a distinct concept. \
                    Synsets are interlinked by means of conceptual-semantic \
                    and lexical relations. WordNet's structure makes it a \
                    useful tool for computational linguistics and natural \
                    language processing.
homepage            http://wordnet.princeton.edu/
master_sites        http://wordnet.princeton.edu/${version}/ \
                    ftp://ftp.cogsci.princeton.edu/pub/wordnet/${version}/
distname            WordNet-${version}
use_bzip2           yes

depends_lib         port:tcl \
                    port:tk

patchfiles          implicit.patch \
                    implicit-int.patch \
                    patch-lib-wnrtl.c.diff

post-patch {
    reinplace "s|/usr/local/WordNet-3.0/dict|${prefix}/share/WordNet-3.0/dict|g" ${worksrcpath}/include/wn.h
}

configure.args      --mandir=${prefix}/share/man \
                    --with-tcl=${prefix}/lib \
                    --with-tk=${prefix}/lib
configure.cflags-append \
                    -DUSE_INTERP_RESULT

variant universal {}

post-configure {
    reinplace "s|${prefix}/dict|${prefix}/share/WordNet-3.0/dict|g" ${worksrcpath}/config.h
}

# Build a shared library (so does FreeBSD's port).
post-build {
    system "${configure.cc} [get_canonical_archflags cc] -install_name ${prefix}/lib/libWN.dylib -dynamiclib ${worksrcpath}/lib/*.o -o ${worksrcpath}/lib/libWN.dylib"
}

destroot.args-append    dictdir=${prefix}/share/WordNet-3.0/dict \
                        htmldir=${prefix}/share/WordNet-3.0/doc/html \
                        psdir=${prefix}/share/WordNet-3.0/doc/ps \
                        pdfdir=${prefix}/share/WordNet-3.0/doc/pdf

post-destroot {
    xinstall -m 644 ${worksrcpath}/lib/libWN.dylib ${destroot}${prefix}/lib/
}
