# -*- 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 116470 2014-01-26 11:49:24Z devans@macports.org $

PortSystem          1.0

name                bluefish
version             2.2.4
revision            1
license             GPL-3+
categories          editors www
platforms           darwin
maintainers         nomaintainer
homepage            http://bluefish.openoffice.nl/
description         A powerful editor for web designers

long_description    Bluefish is a powerful editor for experienced web designers and \
                    programmers. Bluefish supports many programming and markup languages \
                    but it focuses on editing dynamic and interactive websites.

dist_subdir         bluefish

master_sites        sourceforge:project/bluefish/bluefish/${version} \
                    http://www.bennewitz.com/bluefish/stable/source/

checksums           rmd160  56e8a1478ea6939cef0229fcfd40c44a52c49e83 \
                    sha256  771621d848af6342fbab50a52bc7d6fddb29c4616f31ab939c508175c146b3a3

use_bzip2           yes

depends_build       port:pkgconfig \
                    port:intltool

depends_lib         port:desktop-file-utils \
                    port:shared-mime-info \
                    port:gtk3 \
                    port:libxml2 \
                    port:enchant \
                    port:gucharmap

# autoreconf to use MacPorts patched intltool.m4
# update gettext files in po dirs to avoid gettext version mismatch errors during build
# bluefish tarball version 2.2.4 includes files from gettext 0.17
# we have gettext 0.18

post-patch {
    set po_dirs         "src/plugin_about/po \
                        src/plugin_charmap/po \
                        src/plugin_entities/po \
                        src/plugin_htmlbar/po \
                        src/plugin_infbrowser/po \
                        src/plugin_snippets/po \
                        src/plugin_zencoding/po"

    set gettext_files   "Makefile.in.in \
                        boldquot.sed \
                        en@boldquot.header \
                        en@quot.header \
                        insert-header.sin \
                        quot.sed \
                        remove-potcdate.sin \
                        Rules-quot"

    foreach po_dir ${po_dirs} {
        foreach gettext_file ${gettext_files} {
            copy -force ${prefix}/share/gettext/po/${gettext_file} ${worksrcpath}/${po_dir}
        }
    }
}

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --with-gtk2=no \
                    --disable-update-databases \
                    --disable-silent-rules \
                    --disable-python

variant python27 description {Enable zen-coding plugin using Python 2.7} {
    depends_lib-append  port:python27
    configure.python    ${prefix}/bin/python2.7
    configure.args-delete --disable-python
}

default_variants +python27

post-activate {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
    system "${prefix}/bin/update-mime-database ${prefix}/share/mime"
}

livecheck.type      regex
livecheck.url       http://www.bennewitz.com/bluefish/stable/source/
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
