# -*- 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               compiler_blacklist_versions 1.0
PortGroup               legacysupport 1.1
PortGroup               meson 1.0
PortGroup               muniversal 1.0

# Please keep the libpixman and libpixman-devel ports as similar as possible.

# posix_memalign
legacysupport.newest_darwin_requires_legacy 9

name                    libpixman-devel
conflicts               libpixman
set my_name             pixman
version                 0.44.2
revision                0
checksums               rmd160  4392f22e5dc1086b9708abd91677982332f2a702 \
                        sha256  50baf820dde0c5ff9714d03d2df4970f606a3d3b1024f5404c0398a9821cc4b0 \
                        size    650012

categories              graphics
maintainers             {ryandesign @ryandesign} {mascguy @mascguy}
license                 X11

homepage                http://www.pixman.org
master_sites            https://www.x.org/archive/individual/lib/

use_xz                  yes
distname                ${my_name}-${version}
dist_subdir             ${my_name}

description             Pixel region Library

long_description        libpixman is a generic library for manipulating pixel \
                        regions. A PixRegion is a set of Y-X banded rectangles \
                        that cover the desired region.

# Disable unexpected download of subprojects
meson.wrap_mode         nodownload

# Upstream patch for dylib versioning. Expected to be included in next release.
# See: https://gitlab.freedesktop.org/pixman/pixman/-/issues/81
patchfiles-append       patch-meson-dylib-versions.diff

depends_build-append \
                        path:bin/pkg-config:pkgconfig

# llvm-gcc-4.2 makes cairo fail to generate PDFs properly
# clang on Xcode 4.1 cannot build libpixman
compiler.blacklist-append      {clang < 211.10.1} {*gcc-4.[0-2]}

configure.checks.implicit_function_declaration.whitelist-append \
                        strchr

configure.args-append \
                        -Ddemos=disabled \
                        -Dgtk=disabled \
                        -Dlibpng=disabled \
                        -Dmmx=disabled \
                        -Dopenmp=disabled \
                        -Dtests=disabled

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/libpixman
    xinstall -d ${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        COPYING \
        README \
        ${docdir}
}

variant tests description {Enable test support} {
    configure.args-replace \
                        -Dtests=disabled \
                        -Dtests=enabled

    test.run            yes
}

livecheck.type          regex
livecheck.url           [lindex ${master_sites} 0]
livecheck.regex         ${my_name}-(\[0-9.\]+)${extract.suffix}