diff options
Diffstat (limited to 'sources/bin/nscala.unix.tmpl')
-rw-r--r-- | sources/bin/nscala.unix.tmpl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/sources/bin/nscala.unix.tmpl b/sources/bin/nscala.unix.tmpl new file mode 100644 index 0000000000..814cf69f9d --- /dev/null +++ b/sources/bin/nscala.unix.tmpl @@ -0,0 +1,79 @@ +#!/bin/bash + +############################################################################## +# Copyright @COPYRIGHT@ +# +# This is free software; see the distribution for copying conditions. +# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. +############################################################################## + +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true ;; +esac + +SOURCE=$0; +SCRIPT=`basename "$SOURCE"`; +while [ -h "$SOURCE" ]; do + SCRIPT=`basename "$SOURCE"`; + LOOKUP=`ls -ld "$SOURCE"`; + TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; + if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then + SOURCE=${TARGET:-.}; + else + SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; + fi; +done; +PREFIX=`dirname "$SOURCE"`/..; +prefix=$PREFIX; +PREFIX=`cd "$PREFIX"; pwd`; + +if [ -z "$SCRIPT" ]; then + abort "Illegal direct invocation; invoke me through a symbolic link."; +fi; + +_JAVACMD=java +_TOOLS_CPATH=@TOOLS_CPATH@ +_LIB_CPATH=@LIB_CPATH@ + +# For Cygwin, switch paths to appropriate format before running java +if $cygwin; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + format=mixed + else + format=windows + fi + _CPATH=`cygpath --path --$format "$_CPATH"` +fi + +main= +case "$SCRIPT" in + scala ) ;; + scalac* ) main=scala.tools.nsc.Main;; + scaladoc* ) main=scala.tools.scaladoc.Main;; + scalap* ) main=scala.tools.scalap.Main;; + * ) abort "Don't know what to do for $SCRIPT.";; +esac; + +if [ -z "$main" ]; then + for arg in "" "$@"; do + [ -z "$arg" ] && continue; + if [ "$arg" = "-version" ]; then + echo "$SCRIPT @VERSION@ -- @COPYRIGHT@"; + exit 0 + fi + done; + $_JAVACMD \ + -Xbootclasspath/a:"$_LIB_CPATH" \ + "$@" +else + $_JAVACMD \ + -Dscala.product="$SCRIPT" \ + -Dscala.version="@VERSION@" \ + -Dscala.home="$PREFIX" \ + -cp "$_TOOLS_CPATH" \ + $main "$@" +fi |