# -*- 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               python 1.0
PortGroup               app 1.0
PortGroup               active_variants 1.1
PortGroup               yelp 1.0

# FIXME: The build should use meson instead of setup.py. Please switch
# when updating to the next version.

name                    meld
version                 3.22.2
revision                0
set branch              [join [lrange [split ${version} .] 0 1] .]
categories              textproc devel
license                 GPL-2+
platforms               {darwin any}
supported_archs         noarch
maintainers             nomaintainer
homepage                https://meldmerge.org/
description             Visual diff and merge tool.
long_description        Meld is a visual diff and merge tool. You can compare \
                        two or three files and edit them in place (diffs \
                        update dynamically). You can compare two or three \
                        folders and launch file comparisons. You can browse \
                        and view a working copy from popular version control \
                        systems such such as CVS, Subversion, Bazaar-ng and \
                        Mercurial.

master_sites            gnome:sources/${name}/${branch}/
use_xz                  yes

checksums               rmd160  fcc7faa4e8b4fd262970a7b9a41595dc29121859 \
                        sha256  46a0a713fbcd1b153b377a1e0757c8ce255c9822467658eacfbd89b1e92316ef \
                        size    676376

python.default_version  312
python.pep517           no

# disable build phase - everything occurs (again) in destroot
build {}

# see #55092
# prevent running gtk-update-icon-cache and glib-compile-schema during install
destroot.cmd-append     --no-update-icon-cache --no-compile-schemas
# install everything under prefix, except libraries, that go under Library/Frameworks/Python...
destroot.destdir        --prefix=${prefix} --install-lib=${python.pkgd} --root=${destroot}

depends_build-append    port:intltool \
                        port:itstool \
                        port:libxml2 \
                        port:py${python.version}-distro \
                        port:py${python.version}-setuptools

depends_lib-append      port:desktop-file-utils \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                        port:gtksourceview4 \
                        port:py${python.version}-cairo \
                        port:py${python.version}-gobject3 \
                        port:shared-mime-info

depends_run             port:adwaita-icon-theme \
                        port:gsettings-desktop-schemas

app.icon                data/icons/hicolor/scalable/apps/org.gnome.meld.svg
app.use_launch_script   yes

variant x11 conflicts quartz {
   require_active_variants gtk3 x11 quartz
}

variant quartz conflicts x11 {
   require_active_variants gtk3 quartz x11
}

if {![variant_isset quartz]} {
    default_variants-append +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"
    system "${prefix}/bin/update-mime-database ${prefix}/share/mime"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type          gnome-with-unstable
