# $Id$

PortSystem 1.0

name		libgdiplus
version		2.10.9
revision	5
categories	devel
platforms	darwin
maintainers	nomaintainer
license		{LGPL-2.1 MPL-1.1} X11
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	http://www.mono-project.com/Libgdiplus
master_sites	http://download.mono-project.com/sources/libgdiplus/
use_bzip2	yes

checksums	rmd160  a4cbc7d3eaa518a2186b3f8e98fc485c7da4d30b \
		sha256  6ddeb6c327bada7cb6e06d1a20714f526a0c69520dfd42c12ddd032c3c5d964e

depends_build   port:pkgconfig

depends_lib	port:jpeg \
		port:tiff \
		port:giflib \
		port:libpng \
		port:zlib \
		port:fontconfig \
		port:libiconv \
		port:libexif \
		path:lib/pkgconfig/glib-2.0.pc:glib2 \
		path:lib/pkgconfig/cairo.pc:cairo \
		port:xorg-libsm \
		port:xrender

patchfiles      patch-freetype-2.5.1.diff \
                patch-libpng-1.5.diff

post-patch {
 	reinplace "s/-pthread/-lpthread/g" ${worksrcpath}/configure
}

post-configure {
    # https://bugs.gentoo.org/show_bug.cgi?id=431916
    reinplace {s%-L${libjpeg_prefix}/lib%%g} ${worksrcpath}/libgdiplus.pc
}

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 TODO ${destroot}${docdir}
}

variant pango description {Enable Pango font rendering support (experimental)} {
    depends_lib-append      path:lib/pkgconfig/pango.pc:pango

    configure.args-append   --with-cairo=system \
                            --with-pango

    pre-configure {
        if {[file exists ${prefix}/include/cairo/cairo-quartz.h]} {
            ui_error "cairo and pango must be installed without their +quartz variant"
            ui_error "to enable mono +pango variant."
            error "Please reinstall cairo and pango without +quartz."
        }
    }
}

if {${os.platform} eq "darwin" && ${os.major} >= 10} {
	patchfiles-append	patch-disable-atsui-support.diff
}

livecheck.type  regex
livecheck.url   [lindex ${master_sites} 0]
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)