# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 63580 2010-02-09 14:14:57Z snc@macports.org $

PortSystem 1.0
PortGroup archcheck 1.0

name                        hunspell
version                     1.2.8
revision                    1
license                     GPL-2.0+ 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 1177af54a09e320d2c24015f29c3a93e \
                            sha1  eaa76f82fcf08678e49f7a30afdaa268bcc75235 \
                            rmd160 e4fd39e5fadf96da1311f2aa7163ec17eacf0f83

patchfiles                  patch-hunspell.cxx.diff

depends_lib                 port:gettext port:ncursesw port:readline

archcheck.files \
    lib/libintl.dylib \
    lib/libncursesw.dylib \
    lib/libreadline.dylib

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."
