# -*- 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           active_variants 1.1
PortGroup           legacysupport 1.1

# _strndup
legacysupport.newest_darwin_requires_legacy 10

name                bluefish
version             2.2.17
revision            0
checksums           rmd160  eff08725df4cfb2a75250daecc2fefcaca4b2fa6 \
                    sha256  3a79f6425e14939ea134f96c1424e3aac05bee95904be434581883078a7b7253 \
                    size    4822187

categories          editors www
license             GPL-3+
maintainers         {mascguy @mascguy} openmaintainer

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.

homepage            https://bluefish.openoffice.nl
master_sites        http://www.bennewitz.com/bluefish/stable/source/ \
                    http://bluefish.mrball.net/stable/source/ \
                    sourceforge:project/bluefish/bluefish/${version}

use_bzip2           yes

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility
# Also, we are patching configure.ac.
use_autoreconf      yes
autoreconf.cmd      ./autogen.sh
autoreconf.env      LIBTOOLIZE=${prefix}/bin/glibtoolize
# Project's autogen.sh doesn't recognize the default args (--install --verbose), so use our own
autoreconf.args     -v

patchfiles-append   gtk-mac-integration-gtk3.patch
patchfiles-append   enchant2.patch

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:gettext \
                    port:libtool \
                    path:bin/pkg-config:pkgconfig

depends_lib-append \
                    port:desktop-file-utils \
                    port:enchant2 \
                    port:gettext-runtime \
                    port:gucharmap \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:libxml2 \
                    port:shared-mime-info

depends_run-append \
                    port:adwaita-icon-theme

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

variant python313 description {Enable zen-coding plugin using Python 3.13} {
    depends_lib-append    port:python313
    configure.python      ${prefix}/bin/python3.13
    configure.args-delete --disable-python
}

default_variants +python313

variant quartz {}

if {[variant_isset quartz]} {
    PortGroup               app 1.1

    require_active_variants gtk3 quartz
    depends_lib-append      port:gtk-osx-application-gtk3
    app.icon                images/bluefish-icon_128.png
} else {
    require_active_variants gtk3 x11
}

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

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