# $Id: Portfile 59972 2009-10-28 07:03:21Z pguyot@kallisys.net $

PortSystem          1.0

name                wordnet
version             3.0
revision            3
categories          textproc
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/
platforms           darwin
master_sites        http://wordnet.princeton.edu/${version}/ \
                    ftp://ftp.cogsci.princeton.edu/pub/wordnet/${version}/
distname            WordNet-${version}
checksums           md5     89b4db7c6840ce69a8e315a3f83d996b \
                    sha1    aeb7887cb4935756cf77deb1ea86973dff0e32fb \
                    rmd160  87b3719273ec8f1d87742d6802af4d442b6ad040
use_bzip2           yes

depends_lib         port:tcl \
                    port:tk
patchfiles          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
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 "gcc -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/
}
