# -*- 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 115784 2014-01-11 07:30:45Z jeremyhu@macports.org $

PortSystem 1.0

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

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

checksums               rmd160  6d4e29228e5c47cd4dbd780a73dbc1d2222e8266 \
                        sha256  f52583a83a63633701c5f71db3dc40aab87b7f76b29723aeb27941eff42df6e1

depends_lib             port:gettext port:texinfo
# texinfo is also used in post-activate

patchfiles              clang.patch

use_autoreconf          yes
autoreconf.args         -fvi

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

test.run                yes
test.target             check

post-destroot { 
    xinstall -m 644 -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 conflicts nonls {
    configure.args-delete --disable-nls
    configure.args-append --enable-nls
}

# nonls variant to be removed after January 2014
variant nonls conflicts nls description {Legacy compatibility variant} {}

if {[variant_isset nonls]} {
    default_variants -nls
} else {
    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.
"
