# $Id: Portfile 55901 2009-08-20 23:31:24Z ryandesign@macports.org $

PortSystem                      1.0

name                            pure-gl
version                         0.6
revision                        1
categories                      graphics
platforms                       macosx
maintainers                     ryandesign
use_parallel_build              yes
homepage                        http://pure-lang.googlecode.com/
master_sites                    ${homepage}files/

description                     an interface to access OpenGL functions from \
                                Pure

long_description                ${name} provides ${description}.

checksums                       md5     9fd1b40fbe25a8a0c7ad2a8f654a172d \
                                sha1    47dbbf42926d9937bdc6aad3b73abf4c8617c12c \
                                rmd160  689886326ffcedf5548fd242f7a57a9a4f721654

depends_lib-append              path:lib/libpure.dylib:pure \
                                path:lib/libGL.dylib:mesa

patchfiles                      patch-Makefile.diff

post-patch {
    reinplace -E "s,#include <(OpenGL|GLUT)/,#include <GL/,g" \
        ${worksrcpath}/GL.c \
        ${worksrcpath}/GL_ARB.c \
        ${worksrcpath}/GL_ATI.c \
        ${worksrcpath}/GL_EXT.c \
        ${worksrcpath}/GL_NV.c \
        ${worksrcpath}/GLU.c \
        ${worksrcpath}/GLUT.c
}

use_configure                   no

pre-build {
    build.args-append           CC=${configure.cc} \
                                CFLAGS="${configure.cflags}" \
                                CPPFLAGS="${configure.cppflags}" \
                                LDFLAGS="${configure.ldflags}"
}

post-destroot {
    xinstall -d \
        ${destroot}${prefix}/share/doc/${name} \
        ${destroot}${prefix}/share/examples
    xinstall -m 644 -W ${worksrcpath} \
        COPYING \
        README \
        ${destroot}${prefix}/share/doc/${name}
    copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${name}
}

livecheck.check                 regex
livecheck.url                   http://code.google.com/p/pure-lang/downloads/list
livecheck.regex                 ${name}-(\[0-9.\]+)\\.tar
