# -*- 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 91617 2012-04-07 01:33:33Z ryandesign@macports.org $

PortSystem 1.0

name                        hunspell
version                     1.3.2
license                     {GPL-2+ LGPL-2.1+ MPL-1.1+}
categories                  textproc
maintainers                 nomaintainer
description                 Spell checker and morphological analyzer
homepage                    http://hunspell.sourceforge.net/
platforms                   darwin

long_description            Hunspell is a spell checker and morphological analyzer library and program \
                            designed for languages with rich morphology and complex word compounding or \
                            character encoding. Hunspell interfaces: Ispell-like terminal interface \
                            using Curses library, Ispell pipe interface, OpenOffice.org UNO module.

master_sites                sourceforge

checksums           md5     3121aaf3e13e5d88dfff13fb4a5f1ab8 \
                    sha1    902c76d2b55a22610e2227abc4fd26cbe606a51c \
                    rmd160  f193de180f9ac29cfb54824a45366ba57b27e5c4

patchfiles                  patch-hunspell.cxx.diff

depends_lib                 port:gettext port:ncurses port:readline

configure.cppflags-append   -DLIBDIR=\\"${prefix}/share/hunspell\\"
configure.args              --with-ui --with-readline

pre-test {
    # Fix tools path in test script
    reinplace /^alias/s:/src/tools:&/.libs: ${worksrcpath}/tests/test.sh
}

test.run                    yes
test.target                 check

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} AUTHORS AUTHORS.myspell BUGS COPYING \
        COPYING.LGPL COPYING.MPL ChangeLog NEWS README README.myspell THANKS \
        TODO ${destroot}${docdir}
}

if {[variant_isset universal]} {
    post-configure {
        # Properly include universal ldflags when building the library
        reinplace \
            "/archive_cmds/s/-dynamiclib/& ${configure.universal_ldflags}/" \
            ${worksrcpath}/libtool
    }
}


notes "
You must install (at least) one of the language dictionaries after installing\
this port in order for it to work.
"

livecheck.url   http://sourceforge.net/projects/${name}/files/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
