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

github.setup                mypaint mypaint 2.0.1 v
revision                    3
checksums                   rmd160  60718b6e9c4f26253f1887a527e0ba24554bcfac \
                            sha256  f3e437d7cdd5fd28ef6532e8ab6b4b05d842bcdd644f16a0162dad3d8e57bb16 \
                            size    7295048

name                        MyPaint
categories                  graphics
maintainers                 {ryandesign @ryandesign} openmaintainer
license                     GPL-2+
use_parallel_build          yes
installs_libs               no

description                 a fast and easy graphics application for digital painters

long_description            ${name} is ${description}. It lets you focus on the art \
                            instead of the program. You work on your canvas with \
                            minimum distractions, bringing up the interface only \
                            when you need it.

homepage                    https://mypaint.app
github.tarball_from         releases
use_xz                      yes

compiler.cxx_standard       2011

# Remember to update the python version in libmypaint too.
python.versions             312

# CRITICAL: mypaint: Installation layout: unknown!
# RuntimeError: Unknown install type; could not determine paths
python.pep517               no

depends_build-append        path:bin/pkg-config:pkgconfig \
                            port:py${python.version}-setuptools \
                            port:swig-python

depends_lib-append          path:lib/pkgconfig/glib-2.0.pc:glib2 \
                            path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                            port:json-c \
                            port:lcms2 \
                            port:libmypaint \
                            port:libpng \
                            path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                            port:mypaint-brushes \
                            port:python${python.version} \
                            port:py${python.version}-cairo \
                            port:py${python.version}-gobject3 \
                            port:py${python.version}-numpy \
                            port:py${python.version}-pyobjc

depends_run-append          port:hicolor-icon-theme

patchfiles                  _DARWIN_C_SOURCE.patch \
                            compatibiliby-newer-Python-versions.diff

configure.pkg_config_path-prepend \
                            ${frameworks_dir}/Python.framework/Versions/${python.branch}/lib/pkgconfig

build.env-append            "PKG_CONFIG_PATH=[join ${configure.pkg_config_path} :]"

destroot.env                {*}${build.env}

set docdir                  ${prefix}/share/doc/${name}
post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        CODE_OF_CONDUCT.md \
        CONTRIBUTING.md \
        COPYING \
        DEBUGGING.md \
        Licenses.md \
        README.md \
        ${destroot}${docdir}
}

app.executable              ${frameworks_dir}/Python.framework/Versions/${python.branch}/bin/mypaint
app.icon                    pixmaps/mypaint_logo.png

post-activate {
    system "${prefix}/bin/gtk-update-icon-cache -tf ${prefix}/share/icons/hicolor"
}

github.livecheck.regex      {([0-9.]+)}