# -*- 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           github 1.0

github.setup        mypaint libmypaint 1.6.1 v
revision            0
checksums           rmd160  1c09037ab87cadddb57345e5fc2057ba4fadfe23 \
                    sha256  741754f293f6b7668f941506da07cd7725629a793108bb31633fb6c3eae5315f \
                    size    519464

categories          graphics
maintainers         {ryandesign @ryandesign} {devans @dbevans} openmaintainer
platforms           darwin
# license ISC
license             Permissive

description         The MyPaint Brush Library

long_description    libmypaint, a.k.a. \"brushlib\", is a library for making brushstrokes \
                    which is used by MyPaint and other projects.

github.tarball_from releases
use_xz              yes

# Using the same python as MyPaint for consistency.

depends_build       port:intltool \
                    port:pkgconfig \
                    port:python37

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:json-c

# /opt/local/include/glib-2.0/glib/gtypes.h:46: error: redefinition of typedef ‘gchar’
compiler.c_standard 2011

# reconfigure with our intltool.m4 using upstream autogen.sh
post-extract {
    xinstall ${filespath}/autogen.sh ${worksrcpath}
}
use_autoreconf      yes
autoreconf.cmd      ./autogen.sh
autoreconf.env      ACLOCAL=${prefix}/bin/aclocal \
                    AUTOCONF=${prefix}/bin/autoconf \
                    AUTOHEADER=${prefix}/bin/autoheader \
                    AUTOMAKE=${prefix}/bin/automake \
                    LIBTOOLIZE=${prefix}/bin/glibtoolize \
                    PYTHON=${prefix}/bin/python3.7

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool

configure.args      --with-glib

pre-activate {
    # MyPaint and MyPaint-devel < 2.0.0 installed libmypaint files.
    # This deactivate hack can be removed after June 2021.
    if {![catch {set installed [lindex [registry_active MyPaint] 0]}]} {
        set _version [lindex $installed 1]
        if {[vercmp $_version 2.0.0] < 0} {
            registry_deactivate_composite MyPaint "" [list ports_nodepcheck 1]
        }
    }
    if {![catch {set installed [lindex [registry_active MyPaint-devel] 0]}]} {
        set _version [lindex $installed 1]
        if {[vercmp $_version 2.0.0] < 0} {
            registry_deactivate_composite MyPaint-devel "" [list ports_nodepcheck 1]
        }
    }
}

github.livecheck.regex  {(\d+(?:\.\d+)+)}
