# $Id: Portfile 56899 2009-09-03 11:17:10Z snc@macports.org $

PortSystem 1.0

name            poedit
version         1.4.2
categories      devel aqua
platforms       darwin
maintainers     raimue \
                openmaintainer

description     poEdit is a cross-platform gettext catalogs (.po files) editor.
long_description \
    poEdit is a cross-platform gettext catalogs (.po files) editor. It aims to \
    provide more convenient approach to editing catalogs than editing the file by \
    hand. This port installs poEdit.app.
homepage        http://poedit.sourceforge.net/

master_sites    sourceforge
checksums       md5     5aca5ed4c8c81e0f10efb20ac3a191ac \
                sha1    9c509077df2d58a32093063886a670ec7dfab9b8 \
                rmd160  dc29d626b5166675da83c032b90479bd7ebffe59

depends_build   bin:grep:grep \
                port:pkgconfig
depends_lib     port:wxWidgets \
                port:gettext

# remove some additional features, especially sparkle because macports handles updates
configure.args  --disable-transmem --disable-spellchecking --without-sparkle

build.dir           ${build.dir}/src
build.target        bundle
build.env-append    GETTEXT_BINARIES=${prefix}/bin

variant transmem description {Enables translation memory for often used phrases} {
    depends_lib-append      port:db44
    configure.args-delete   --disable-transmem
    configure.args-append   --enable-transmem
}

variant spellcheck description {Enables spellchecking} {
    depends_lib-append      port:gtkspell2
    configure.args-delete   --disable-spellchecking
    configure.args-append   --enable-spellchecking
}

destroot {
    # the gettext binaries are copied into poedit.app during build,
    # but we rather delete and symlink them to get updates to gettext automatically {
    foreach extra { msgfmt msgmerge msgunfmt xgettext } {
        file delete ${worksrcpath}/src/Poedit.app/Contents/MacOS/${extra}
        ln -s ${prefix}/bin/${extra} ${worksrcpath}/src/Poedit.app/Contents/MacOS/${extra}
    }
    file delete ${worksrcpath}/src/Poedit.app/Contents/MacOS/gnu_gettext.COPYING
    # }

    file copy ${worksrcpath}/src/Poedit.app ${destroot}${applications_dir}/poEdit.app
}

