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

PortSystem                      1.0

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

description                     an interface to libffi which enables you to \
                                call C functions from Pure and vice versa

long_description                ${name} provides ${description}. It goes \
                                beyond Pure's built-in C interface in that \
                                it also handles C structs and makes Pure \
                                functions callable from C. Moreover, \
                                depending on the libffi implementation, it \
                                may also be possible to call foreign \
                                languages other than C.

checksums                       md5     3416ba27d6265bc949b2cfdfbb03b1e8 \
                                sha1    d55533f67253228fa42d28dd737d6cf52d9a55fd \
                                rmd160  09fabb234bc94dcff84db171dd769027160087c3

depends_lib-append              path:lib/libpure.dylib:pure \
                                port:libffi

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}
}

platform darwin {
    configure.cflags-append     -fno-common
}

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