# -*- 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                    aspell
version                 0.60.8.1
revision                0
checksums               rmd160  8bd3e99a91d94a0fd720d341ed22ccbce7af11de \
                        sha256  d6da12b34d42d457fa604e435ad484a74b2effcd120ff40acd6bb3fb2887d21b \
                        size    3567205

set branch              [join [lrange [split ${version} .] 0 1] .]
categories              textproc
maintainers             openmaintainer {jochen @jokuha}
conflicts               ispell
description             Spell checker with better logic than ispell
homepage                http://aspell.net/
license                 LGPL-2

long_description        Aspell is a spell checker designed to eventually replace ispell. \
                        Aspell's main feature is that it  does a much better job of coming up with \
                        possible suggestions than ispell.

master_sites            gnu freebsd

depends_lib             port:gettext port:texinfo port:ncurses

# Teach glibtool to pass -stdlib at link time.
use_autoreconf          yes
autoreconf.args         -fvi

configure.args-append   --enable-dict-dir="${prefix}/share/aspell" \
                        --disable-nls \
                        --enable-compile-in-filters

test.run                yes
test.target             check

post-destroot {
    xinstall -m 0644 -W ${filespath} u-deva.cmap u-deva.cset ${destroot}${prefix}/lib/aspell-${branch}/
    copy ${worksrcpath}/scripts/ispell ${destroot}${prefix}/bin/ispell
}

post-activate {
    system "${prefix}/bin/install-info ${prefix}/share/info/aspell.info ${prefix}/share/info/dir"
    system "${prefix}/bin/install-info ${prefix}/share/info/aspell-dev.info ${prefix}/share/info/dir"
}

variant nls {
    configure.args-replace --disable-nls --enable-nls
}

if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"} {
    # gnustep-gui uses aspell and will not work if aspell is linked to gettext because
    # gettext is linked to CoreFoundation which is itself linked to the Apple objc runtime
    default_variants -nls
} else {
    default_variants +nls
}

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