# $Id: Portfile 49980 2009-04-21 19:50:37Z mcalhoun@macports.org $

PortSystem  1.0
PortGroup   muniversal 1.0

name        glitz
version     0.5.6
revision    2
maintainers nomaintainer
categories  graphics devel x11
platforms   darwin 

description Glitz is an OpenGL image compositing library.
long_description \
    Glitz is an OpenGL image compositing library. Glitz \
    provides Porter/Duff compositing of images and implicit \
    mask generation for geometric primitives including \
    trapezoids, triangles, and rectangles.

homepage    http://www.freedesktop.org/Software/glitz/
master_sites    http://cairographics.org/snapshots/

depends_lib     port:mesa

checksums       md5 c507f140ecccc06aed8888c958edda4c \
                sha1 81604bf02ceda85ea32b52423f78a883aaec6dc6 \
                rmd160 547ef1be273856942e0fa36c097c4acb367336b2

configure.args  --mandir=${prefix}/share/man

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

pre-extract {
    if {"darwin" == ${os.platform} && 9 == ${os.major}} {
        set minimum_xcodeversion 3.1
        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
            ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} or later but you have Xcode ${current_xcodeversion}."
            return -code error "incompatible Xcode version"
        }
    }
}

# There is no reason to have the build directory in the .la file.
pre-destroot {
    if { ! [variant_isset universal] } {
        reinplace "s| -L${worksrcpath}/src||g" ${worksrcpath}/src/agl/.libs/libglitz-agl.lai
    } else {
        foreach arch ${universal_archs_to_use} {
            reinplace "s| -L${worksrcpath}-${arch}/src||g" ${worksrcpath}-${arch}/src/agl/.libs/libglitz-agl.lai
        }
    }
}

livecheck.check regex
livecheck.url   ${master_sites}
livecheck.regex LATEST-${name}-(\\d+(?:\\.\\d+)*)
