# -*- 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 120294 2014-05-22 00:41:07Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           github 1.0
PortGroup           cmake 1.0

github.setup        Gnurou tagainijisho 1.0.2
license             GPL-3+
categories          aqua education japanese
platforms           darwin
maintainers         strasweb.fr:rudloff 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

checksums           rmd160  a47a9702d71bd154aeaea06d3234d9e4ef75d8d4 \
                    sha256  144a516a69d440014269dd2a11e10760fd9543726affd9af152b28e1e1d57c3f

depends_lib         port:qt4-mac

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

configure.pre_args  -DCMAKE_INSTALL_PREFIX=${applications_dir}

pre-activate {
    # tagainijisho before 1.0.2_0 installed this file directly, bypassing the
    # destroot; remove it if found to prevent an activation error.
    set filepath "${applications_dir}/Tagaini Jisho.app/Contents/Resources/qt.conf"
    if {[file exists ${filepath}] && [registry_file_registered ${filepath}] == "0"} {
        if {[catch {delete ${filepath}}]} {
            return -code error "Cannot delete ${filepath}; please remove it manually"
        }
    }
}
