# -*- 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               active_variants 1.1

name                    libgdiplus
version                 6.0.5
revision                3
categories              devel
maintainers             {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
license                 MIT
description             An Open Source implementation of the GDI+ API
long_description        An implementation of the GDI+ API for Mono, an \
                        effort to create an open source implementation of \
                        the .NET Development Framework including a C# compiler.

homepage                https://www.mono-project.com/Libgdiplus
master_sites            https://download.mono-project.com/sources/libgdiplus/

checksums               rmd160  dca604e6298a95d55a5e4d45d0186c4e0e592b38 \
                        sha256  b81e4e5cc3e4831b2945de08bef26eb1bdcd795aeaf8f971b221c51213a025ef \
                        size    1391332

depends_build           path:bin/pkg-config:pkgconfig

depends_lib             path:include/turbojpeg.h:libjpeg-turbo \
                        port:tiff \
                        port:giflib \
                        port:libpng \
                        port:fontconfig \
                        port:libexif \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        path:lib/pkgconfig/pango.pc:pango \
                        path:lib/pkgconfig/cairo.pc:cairo

patchfiles              patch-no_zlib.diff \
                        patch-fix_flags.diff \
                        patch-fix_pangoft2.diff

# jmorecfg.h: error: redefinition of typedef ‘UINT16’
compiler.c_standard     2011

configure.args-append   --without-x11 \
                        --with-pango

if {${os.platform} eq "darwin" && ${os.major} > 11} {
    configure.ldflags-append \
                        -framework CoreGraphics
}

test.run                yes
test.target             check

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
                        AUTHORS COPYING ChangeLog LICENSE NEWS \
                        README.md TODO \
                        ${destroot}${docdir}
}

variant x11 {
    depends_lib-append      port:xorg-libX11
    configure.args-delete   --without-x11
    require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
}
default_variants +x11
