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

PortSystem                      1.0

name                            pure-gen
version                         0.4
revision                        1
categories                      devel
platforms                       darwin
maintainers                     ryandesign
use_parallel_build              yes
homepage                        http://pure-lang.googlecode.com/
master_sites                    ${homepage}files/

description                     a Pure C bindings generator

long_description                ${name} is ${description}.

checksums                       md5     c9e8ef5453a7e2383312e8a004d66ff5 \
                                sha1    d675544355939a04344153b5e5a99f171506fd3a \
                                rmd160  1411c196497bc6bf8569a6c04c0e5b9b1eb987e3

depends_build-append            path:bin/ghc:ghc \
                                port:hs-language-c

depends_lib-append              path:lib/libpure.dylib:pure

# pure-gen uses gcc at runtime to parse C headers but the
# -fdirectives-only option it needs is only available in gcc 4.3 and up.
depends_run-append              path:bin/gcc-mp-4.3:gcc43

patchfiles-append               patch-pure-gen.pure.diff

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
