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

PortSystem 1.0

name		        	aspell
version		            0.60.6
revision                4
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	            md5 bc80f0198773d5c05086522be67334eb \
		                sha1 335bcb560e00f59d89ec9e4c4114c325fb0e65f4 \
		                rmd160 315638cc7cc4ce9d3dc09c7e15faf637855d504e

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

patchfiles              patch-mk-static-filter.pl.diff

configure.env	        LIBS="-L${prefix}/lib"
configure.cflags-append "-I${prefix}/include"
configure.args	        --enable-dict-dir="${prefix}/share/aspell" \
                        --infodir="${prefix}/share/info" \
                        --enable-compile-in-filters
test.run                yes
test.target             check

# BUILD FIX TODO: clang C++
# clang fails to build this project due to buggy C++ as of 2011.06.28 0.60.6
if {${configure.compiler} == "clang"} {
    configure.compiler llvm-gcc-4.2 
}

post-destroot { 
    file copy ${filespath}/u-deva.cmap ${destroot}${prefix}/lib/aspell-0.60/
    file copy ${filespath}/u-deva.cset ${destroot}${prefix}/lib/aspell-0.60/
	file delete -force ${destroot}${prefix}/share/info/dir
    if {[variant_isset ispell]} {
        file 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
}

variant nonls conflicts nls description {Don't include natural language support (default on Mac OS X)} {
    configure.args-delete --enable-nls
    configure.args-append --disable-nls
}

variant ispell description {Install ispell emulation script} {
}

platform 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
    if { ![variant_isset nls] } {
        default_variants        +nonls
    }
}

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