# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 105673 2013-04-30 23:35:17Z blair@macports.org $

PortSystem      1.0

name            sbt
version         0.12.3
categories      devel java
license         BSD
maintainers     blair openmaintainer
platforms       darwin

description     Simple build tool (sbt) simplifies building Scala projects

long_description \
    Simple build tool (sbt) is provides unintrusive and easy to set up \
    for simple Scala projects. All configuration, customization, and \
    extension are done in Scala.  Sbt supports continuous compilation \
    and testing with triggered execution in mixed Scala/Java projects.

homepage        https://github.com/harrah/xsbt/
master_sites    http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/${version}
distname        ${name}-launch
dist_subdir     ${name}/${version}

checksums       md5     124fb91b398542c23cd920360580d2d7 \
                sha1    38d15379d20a8e8113e59285ff8a1e52b01b98b6 \
                sha256  f0f5d5820d3a9084b3eff5fe3d218b4387f1303078355b8cbdd5d62f97322287

depends_build   bin:java:kaffe

# Name the wrapper shell script.
set wrapper     sbt.sh

extract.suffix  .jar
extract.mkdir   yes
extract.only
pre-extract {
    file copy ${filespath}/${wrapper} ${worksrcpath}
}

set jarname ${distname}${extract.suffix}

post-patch {
    reinplace "s|__SBT_LAUNCHER_PATH__|${prefix}/share/${name}/${jarname}|g" \
        ${worksrcpath}/${wrapper}
}

supported_archs noarch
use_configure   no
build           {}

destroot {
    set sbtdir ${destroot}${prefix}/share/${name}

    xinstall -m 755 -d ${sbtdir}
    xinstall -m 644 ${distpath}/${jarname} ${sbtdir}/
    xinstall -m 755 ${worksrcpath}/${wrapper} ${sbtdir}/${name}

    ln -s ${prefix}/share/${name}/${name} ${destroot}${prefix}/bin
}

livecheck.type  regex
livecheck.url   http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/
livecheck.regex {"([0-9.]+)/"}
