From b5bb25e41823189701e45e4ca527a0dba952fe88 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Tue, 1 Nov 2005 10:38:08 +0000 Subject: Updated SABBUS to generate functioning scalac a... Updated SABBUS to generate functioning scalac and scala script (bug #469). --- sources/bin/nscala-tool.win.tmpl | 45 +++++++++++++++++++++++ sources/bin/nscala.unix.tmpl | 79 ++++++++++++++++++++++++++++++++++++++++ sources/bin/nscala.win.tmpl | 48 ++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 sources/bin/nscala-tool.win.tmpl create mode 100644 sources/bin/nscala.unix.tmpl create mode 100644 sources/bin/nscala.win.tmpl (limited to 'sources/bin') diff --git a/sources/bin/nscala-tool.win.tmpl b/sources/bin/nscala-tool.win.tmpl new file mode 100644 index 0000000000..5006ac5ec1 --- /dev/null +++ b/sources/bin/nscala-tool.win.tmpl @@ -0,0 +1,45 @@ +@echo off + +rem ########################################################################## +rem # Copyright @COPYRIGHT@ +rem # +rem # This is free software; see the distribution for copying conditions. +rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +rem # PARTICULAR PURPOSE. +rem ########################################################################## + +if "%OS%"=="Windows_NT" @setlocal + +if "%SCALA_HOME%" == "" goto error1 +if not exist "%SCALA_HOME%\VERSION-@VERSION@" goto error2 + +set _ARGS= +:loop +if '%1' == '' goto exec +set _ARGS=%_ARGS% %1 +shift +goto loop + +:exec +set _JAVACMD=java +set _PROPS=-Dscala.product=@PRODUCT@ -Dscala.version=@VERSION@ +set _MAIN=@MAIN@ +set _CPATH=@CPATH@ + +rem echo %_JAVACMD% %_PROPS% -cp %_CPATH% %_MAIN% %_ARGS% +%_JAVACMD% %_PROPS% -cp %_CPATH% %_MAIN% %_ARGS% +goto end + +rem ########################################################################## +rem # errors + +:error1 +echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-@VERSION@". +goto end + +:error2 +echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-@VERSION@". +goto end + +:end +if "%OS%"=="Windows_NT" @endlocal 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 diff --git a/sources/bin/nscala.win.tmpl b/sources/bin/nscala.win.tmpl new file mode 100644 index 0000000000..139d3e5374 --- /dev/null +++ b/sources/bin/nscala.win.tmpl @@ -0,0 +1,48 @@ +@echo off + +rem ########################################################################## +rem # Copyright @COPYRIGHT@ +rem # +rem # This is free software; see the distribution for copying conditions. +rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +rem # PARTICULAR PURPOSE. +rem ########################################################################## + +if "%OS%"=="Windows_NT" @setlocal + +if "%SCALA_HOME%" == "" goto error1 +if not exist "%SCALA_HOME%\VERSION-@VERSION@" goto error2 + +set _ARGS= +:loop +if '%1' == '' goto exec +if '%1' == '-version' goto version +set _ARGS=%_ARGS% %1 +shift +goto loop + +:exec +set _JAVACMD=java +set _JAVAOPT=-Xbootclasspath/a:@BOOTCPATH@ + +rem echo %_JAVACMD% %_JAVAOPT% %_ARGS% +%_JAVACMD% %_JAVAOPT% %_ARGS% +goto end + +:version +echo @PRODUCT@ @VERSION@ -- @COPYRIGHT@ +goto end + +rem ########################################################################## +rem # errors + +:error1 +echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-@VERSION@". +goto end + +:error2 +echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-@VERSION@". +goto end + +:end +if "%OS%"=="Windows_NT" @endlocal -- cgit v1.2.3