# -*- 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
# $Id: Portfile 48961 2009-03-31 22:59:24Z jeremyhu@macports.org $

PortSystem			1.0

name				libwmf
version				0.2.8.4
revision			2
categories			graphics fonts
maintainers			nomaintainer
description			Library for converting WMF (Window Metafile Format) files
long_description \
	libwmf is a library for reading vector images in Microsoft's native \
	Windows Metafile Format (WMF) and for either (a) displaying them in, \
	e.g., an X window, or (b) converting them to more standard/open file \
	formats.

platforms			darwin

homepage			http://wvware.sourceforge.net/libwmf.html
master_sites		sourceforge:wvware

checksums			md5 d1177739bf1ceb07f57421f0cee191e0

depends_build \
        port:autoconf \
        port:automake \
        port:libtool

depends_lib \
	port:zlib \
	port:libpng \
	port:jpeg \
	port:freetype

post-patch {
	system "cd ${worksrcpath} && autoreconf -fvi"
	reinplace "s|@LIBWMF_GDK_PIXBUF_TRUE@|#|g" ${worksrcpath}/src/Makefile.in
	reinplace "s|@LIBWMF_GDK_PIXBUF_FALSE@||g" ${worksrcpath}/src/Makefile.in
}

configure.args	--with-jpeg --without-x --with-fontdir=${prefix}/share/fonts/${name}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING CREDITS ChangeLog \
		NEWS README TODO ${destroot}${prefix}/share/doc/${name}
}

variant expat conflicts xml2 description {Use expat not libxml2} {
	depends_lib-append	port:expat
	configure.args-append	--with-expat
}

variant x11 description {Enable X11 support} {
	depends_lib-append	port:xorg-libX11
	depends_build-append	bin:mkfontdir:mkfontdir bin:mkfontscale:mkfontscale

	configure.args-delete	--without-x
	configure.args-append	--with-x

	post-destroot {
		system "mkfontscale ${destroot}${prefix}/share/fonts/${name} && mkfontdir ${destroot}${prefix}/share/fonts/${name}"
	}
}

variant xml2 conflicts expat description {Use libxml2 not expat} {
	depends_lib-append	port:libxml2
	configure.args-append	--with-libxml2
}

livecheck.regex "<title>${name} (.*) released.*</title>"
