# -*- 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 86020 2011-10-18 15:52:50Z devans@macports.org $

PortSystem          1.0

name                libwmf
version             0.2.8.4
revision            5
categories          graphics fonts
license             LGPL
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 \
                    sha1 822ab3bd0f5e8f39ad732f2774a8e9f18fc91e89

depends_build \
    port:pkgconfig

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

patchfiles          configure.ac.diff

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --with-jpeg \
                    --with-expat \
                    --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 x11 {
    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 description {Use libxml2 not expat} {
    depends_lib-delete  port:expat
    depends_lib-append  port:libxml2
    configure.args-delete   --with-expat
    configure.args-append   --with-libxml2
}

livecheck.url   http://sourceforge.net/projects/wvware/files/libwmf/
livecheck.regex "${name}\/(\\d+(?:\\.\\d+)*)"
