# -*- 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                hunspell-de
version             20161207
revision            2
distname            igerman98-${version}
categories          textproc
license             {GPL-2 GPL-3}
maintainers         nomaintainer
description         German dictionary for hunspell
platforms           darwin
homepage            https://www.j3e.de/ispell/igerman98/index_en.html
master_sites        https://www.j3e.de/ispell/igerman98/dict/
supported_archs     noarch

use_bzip2           yes

checksums           rmd160  6c8e460d27af7930af5b457e513316410c8321a6 \
                    sha256  17296f03c5fea62d76ecc530ebe80f6adc430278f58d472dc1842d71612960a8

use_configure       no

build.target-delete all

depends_build       port:ispell

depends_lib         port:hunspell

set installdir "$destroot$prefix/share/hunspell/"

pre-destroot {
    xinstall -d -m 755 $installdir
}

subport hunspell-de {
    pre-configure {
	    ui_error "Please choose one of the subports: \
	    hunspell-de_AT, hunspell-de_CH or hunspell-de_DE."
	    return -code error
	}
}

subport hunspell-de_AT {
	long_description    ${description}: Austrian German
    build.target-append hunspell/de_AT.dic hunspell/de_AT.aff

    destroot {
        xinstall -m 644 ${worksrcpath}/hunspell/de_AT.aff $installdir
        xinstall -m 644 ${worksrcpath}/hunspell/de_AT.dic $installdir
    }
}

subport hunspell-de_CH {
	long_description    ${description}: Swiss German
    build.target-append hunspell/de_CH.dic hunspell/de_CH.aff

    destroot {
        xinstall -m 644 ${worksrcpath}/hunspell/de_CH.aff $installdir
        xinstall -m 644 ${worksrcpath}/hunspell/de_CH.dic $installdir
    }
}

subport hunspell-de_DE {
	long_description    ${description}: German
    build.target-append hunspell/de_DE.dic hunspell/de_DE.aff

    destroot {
        xinstall -m 644 ${worksrcpath}/hunspell/de_DE.aff $installdir
        xinstall -m 644 ${worksrcpath}/hunspell/de_DE.dic $installdir
    }
}

default_variants +de_DE

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "igerman98-(\[0-9.\]+)${extract.suffix}"
