# $Id: Portfile 66285 2010-04-08 08:09:09Z jmr@macports.org $

PortSystem 1.0

name                nu
version             0.3.3
categories          devel
maintainers         eridius
description         Nu is an interpreted object-oriented lisp-like language written in Objective-C.
long_description    \
    Nu is an interpreted object-oriented language. \
    It uses a Lisp-style grammar, but is semantically closer to Ruby than to Lisp. \
    Nu is written in Objective-C and is designed to take full advantange of \
    the Objective-C runtime and the many mature class libraries written in Objective-C. \
    Nu code can fully interoperate with code written in Objective-C\; \
    messages can be sent to and from objects with no concern for whether those messages \
    are implemented in Objective-C or Nu.
homepage            http://programming.nu/
platforms           darwin
master_sites        http://programming.nu/releases/
distname            Nu-${version}
extract.suffix      .tgz

checksums           md5 45eabf715d3c09b41b5b07c9c93c0a7e \
                    sha1 c00a2bbc039c438eeb0b16abf4a5f4379a3c48ff

patchfiles          patch-libffi-single-arch patch-Nukefile

depends_build       port:pcre bin:rake:rb-rake

use_configure       no
test.run            yes
test.cmd            nuke

livecheck.type      regex
livecheck.url       http://programming.nu/downloads
livecheck.regex     {Nu-([\d.]+).tgz}

variant universal {
    patchfiles-delete patch-libffi-single-arch
    patchfiles-delete patch-Nukefile
}

post-patch {
    # fix the tools
    reinplace s|/usr/local|$prefix| ${worksrcpath}/tools/nubile
    
    # fix the examples
    reinplace s|/usr/local|$prefix| ${worksrcpath}/examples/NuAnywhere/nu-anywhere
}

pre-build {
    if {${os.platform} == "darwin" && ${os.major} == 8} {
        ui_info "$UI_PREFIX Building libffi"
        system "cd ${worksrcpath}/libffi && rake"
    }
}

build {
    system "cd ${worksrcpath} && PREFIX=${prefix} rake"
    system "cd ${worksrcpath} && PREFIX=${prefix} ./mininush tools/nuke"
}

pre-destroot {
    file mkdir ${destroot}/Library/Frameworks
}

destroot.cmd        "./mininush tools/nuke"
destroot.destdir    ""
destroot.env-append PREFIX=${prefix}
destroot.env-append DESTDIR=${destroot}
