# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           app 1.0

name                geany
version             2.0
checksums           rmd160  f3f7ffffb6183443119ff775a94d02a3b1790850 \
                    sha256  565b4cd2f0311c1e3a167ec71c4a32dba642e0fe554ae5bb6b8177b7a74ccc92 \
                    size    6836300
license             GPL-2+
categories          devel
maintainers         nomaintainer

description         A fast and lightweight GTK+ IDE

long_description    Geany is a small and lightweight integrated development \
                    environment. It was developed to provide a small and fast \
                    IDE, which has only a few dependencies from other packages. \
                    Another goal was to be as independent as possible from a \
                    special Desktop Environment like KDE or GNOME.

homepage            https://www.geany.org/
master_sites        http://download.geany.org/
use_bzip2           yes

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

depends_lib         port:atk \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    port:desktop-file-utils \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:gettext \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/pango.pc:pango \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:vte

depends_run         port:adwaita-icon-theme

# configure: error: *** A compiler with support for C++17 language features is required.
compiler.cxx_standard 2017

configure.args      --disable-silent-rules \
                    --disable-html-docs \
                    --disable-pdf-docs \
                    --disable-api-docs \
                    --disable-gtkdoc-header \
                    --with-vte-module-path=${prefix}/lib/libvte-2.91.0.dylib

# gtk-osx-application-gtk3 includes active_variants check for gtk3 +quartz
# therefore don't repeat it here

variant python310 conflicts python311 description {Use Python v3.10} {
    configure.args-append --with-python-command=${prefix}/bin/python3.10
    depends_run-append port:python310
}

variant python311 conflicts python310 description {Use Python v3.11} {
    configure.args-append --with-python-command=${prefix}/bin/python3.11
    depends_run-append port:python311
}

if {![variant_isset python310]} {
    default_variants-append +python311
}

variant quartz conflicts x11 description {Better support Mac interface conventions} {
     depends_lib-append \
                    port:gtk-osx-application-gtk3
}

variant x11 conflicts quartz description {Interface more consistent with other X11 systems} {

}

if {![variant_isset quartz]} {
    default_variants-append +x11
}

post-destroot {
    reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${applications_dir}/${app.name}.app/Contents/MacOS/${app.name}
}

app.icon            "icons/48x48/geany.png"
app.executable      ${filespath}/launch

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       ${master_sites}
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
