# -*- 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.4.0
revision            0
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/ \
                    sourceforge:project/bluefish/bluefish/${version}

use_bzip2           yes
checksums           rmd160  0b8b6dcfe6d8878c4f827ec08a0ec04deb63ba0d \
                    sha256  3d0d0ac6553c83251a2031d4ea9e36a8c8947dd6e5e40a868e34ad0f5d2ea822 \
                    size    5012280

# 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: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 \
                    port:desktop-file-utils

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

# ld: library not found for -latomic
compiler.c_standard 2011

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}"
