# -*- 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
PortGroup           cmake 1.1
PortGroup           github 1.0

if {${os.platform} ne "darwin" || ${os.major} > 15} {
    PortGroup       qt5 1.0

    # Needed for Qt5LinguistTools
    qt5.depends_component   qttools

    github.setup    Gnurou tagainijisho 1.2.2

    checksums       rmd160  83a9ecc7f1d5b5ba0ec6871c66a79e2590bb14e0 \
                    sha256  10fa6aa3a2e0eea0f4456236ac3020db73c76f65cb31a76ad74a107b2d739003 \
                    size    32366512

    # To build docs
    depends_build-append    port:multimarkdown

    patchfiles      patch-CMakeLists.txt.diff \
                    patch-gui-CMakeLists.txt.diff \
                    patch-pack-CMakeLists.txt.diff

    post-destroot {
        file copy ${filespath}/qt.conf \
            ${destroot}${applications_dir}/Tagaini\ Jisho.app/Contents/Resources/

        set docdir ${prefix}/share/doc/${name}

        xinstall -d ${destroot}${docdir}/html
        xinstall -d ${destroot}${docdir}/html/images
        xinstall -m 0444 {*}[glob ${worksrcpath}/doc/*.html] \
            ${destroot}${docdir}/html
        xinstall -m 0444 {*}[glob ${worksrcpath}/doc/images/*.png] \
            ${destroot}${docdir}/html/images
        xinstall -m 0644 -W ${worksrcpath} COPYING.txt Changelog README.md \
            ${destroot}${docdir}
    }
} else {
    # Fallback for legacy systems
    PortGroup       qt4 1.0

    github.setup    Gnurou tagainijisho 1.0.3

    checksums       rmd160  eda4b6c645ffce4298da6890260a246747bf3612 \
                    sha256  6fe3c579ec1cea6c41393ac9a82dd12d0e240032d2bb7837a90e470f480aaf4e \
                    size    24816175

    patchfiles      patch-CMakeLists.txt-1.0.3.diff \
                    patch-pack-CMakeLists.txt-1.0.3.diff
}

license             GPL-3+
categories          aqua education japanese
maintainers         {khindenburg @kurthindenburg} openmaintainer

description         A free Japanese dictionary and study assistant

long_description    Tagaini Jisho is a free, open-source Japanese \
                    dictionary and kanji lookup tool that is available \
                    for Windows, Mac OS X and Linux and aims at \
                    becoming your Japanese study assistant. It allows \
                    you to quickly search for entries and mark those \
                    that you wish to study, along with tags and \
                    personal notes. \
                    It also let you train entries you are studying \
                    and follows your progression in remembering them. \
                    Finally, it makes it easy to review entries you \
                    did not remember by listing them on screen \
                    or printing them on a small booklet.

homepage            http://www.tagaini.net/
github.tarball_from releases

configure.pre_args  -DCMAKE_INSTALL_PREFIX=${applications_dir}
