1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
#!/bin/sh
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * This source file is part of SableVM. *
# * *
# * See the file "LICENSE" for the copyright information and for *
# * the terms and conditions for copying, distribution and *
# * modification of this source file. *
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
JVM=SABLEVM_BINARY
REST=
OPTS=
VER=-Y
if [ $# -eq 0 ]; then
echo "You need to specify some parameters for java-sablevm wrapper."
echo "java-sablevm is parameter-compatible with 'java' command."
echo "Help option is not implemented yet. See 'man java-sablevm' for now."
exit 0
fi
# Timezone detection should be handled in Classpath, but used to be broken, so
# we worked it around here. Disabled for now, not yet removed.
##if [ -r /etc/timezone ]; then
## ZONE_NAME=`cat /etc/timezone | sed 's/[ \t]*#/#/g' | grep -v '^#' | \
## grep -v '^[ \t]*$' | head -n 1 | awk '{ print $1 }'`
## if [ "X$ZONE_NAME" != "X" ]; then
## OPTS="-p user.timezone=${ZONE_NAME}"
## fi
##fi
if [ "$1" != "" ]; then OPTSDONE=0; else OPTSDONE=1; fi
while [ $OPTSDONE -eq 0 ]
do
case "$1" in
-help|--help|-h|-\?|-X)
echo "Help option is not implemented yet. See 'man java-sablevm' for now."
exit 0
;;
-debug|-Xdebug|--debug)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2
;;
-version|--version|-V)
exec $JVM -V
;;
-ss|-ms|-mx)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2
shift
;;
-Xgnuclasspath:*)
# GNU Classpath *CVS* compatible mode
rest=${1#-Xgnuclasspath:}
value=${rest#*-Xgnuclasspath:}
# check existence of gnucp-override.jar
SVM_TOPDIR=`dirname $0`/..
if [ ! -e $SVM_TOPDIR/share/sablevm/gnucp-overrides.jar ]; then
echo "Error processing $1 directive. Could not find gnucp-overrides.jar in:"
echo "$SVM_TOPDIR/share/sablevm/gnucp-overrides.jar"
echo "Try fetching one from http://sablevm.org/downloads/snapshots"
echo "or install classpath from SableVM-Classpath package."
exit 1
fi
# check existence of glibj.jar
if [ ! -e $value/share/classpath/glibj.zip ]; then
echo "Error processing $1 directive. Could not find glibj.jar in:"
echo "$value/share/classpath/glibj.zip"
echo "Make sure path you gave is correct or install classpath from"
echo "SableVM-Classpath package. See: http://sablevm.org/download"
exit 1
fi
# Setup things
SVM_LIBRARY_PATH="$SVM_LIBRARY_PATH:$value/lib/classpath"
OPTS="$OPTS -p sablevm.boot.class.path=$SVM_TOPDIR/share/sablevm/gnucp-overrides.jar:$value/share/classpath/glibj.zip"
;;
-Xgnuclass*)
echo "The '$1' parameter not well formed. The proper usage woul be ie."
echo " -Xbootclasspath:/usr/local"
echo "so that /usr/local/share/classpath/glibj.zip existed."
echo "Also remember to fetch and install gnu-overrides.jar file from"
echo "http://sablevm.org/downloads/snapshots and put it into ie."
echo "\$prefix/share/sablevm, so that \$prefix/share/sablevm/gnucp-overrides.jar"
echo "existed."
exit 1
;;
-Xbootclasspath/p:*)
rest=${1#-Xbootclasspath/p:}
value=${rest#*-Xbootclasspath/p:}
OPTS="$OPTS -p sablevm.boot.class.path.prepend=$value"
;;
-Xbootclasspath/a:*)
rest=${1#-Xbootclasspath/a:}
value=${rest#*-Xbootclasspath/a:}
OPTS="$OPTS -p sablevm.boot.class.path.append=$value"
;;
-Xbootclasspath:*)
rest=${1#-Xbootclasspath:}
value=${rest#*-Xbootclasspath:}
OPTS="$OPTS -p sablevm.boot.class.path=$value"
;;
-X*)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2
;;
-client|-server|-noclassgc|-noverify|--noverify)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2 ;;
-da|-disableassertions|-dsa|-disablesystemassertions)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2 ;;
-ea|-enableassertions|-esa|-enablesystemassertions)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2
echo "You can compile SableVM with --enable-debugging-features option instead." >&2
;;
-classpath|--classpath|-cp|--cp)
CMD_CLASSPATH="$2"
shift
;;
-classpath=*)
rest=${1#-classpath}
value=${rest#*=}
CMD_CLASSPATH="$value"
;;
--classpath=*)
rest=${1#--classpath}
value=${rest#*=}
CMD_CLASSPATH="$value"
;;
-addclasspath|--addclasspath)
if [ "X$CMD_CLASSPATH" = "X" ]; then
CMD_CLASSPATH="$2"
else
CMD_CLASSPATH="$CMD_CLASSPATH:$2"
fi
shift
;;
-Djava.library.path=*)
# FIXME: we don't handle property names and values containing spaces and special chars
value=${1#-Djava.library.path=}
SVM_LIBRARY_PATH="$value:$SVM_LIBRARY_PATH"
;;
-D*)
# FIXME: we don't handle property names and values containing spaces and special chars
rest=${1#-D}
value=${rest#*=}
key=${rest%%=$value}
#echo "rest='$rest' key='$key' value='$value'"
OPTS="$OPTS --property=${key}=${value}"
;;
-jar|--jar)
JAR_CLASSPATH="$2"
CLASS=`unzip -p $2 META-INF/MANIFEST.MF|grep -i "Main-Class: "|tr -d \\\\r | awk '{ print $2 }'`
RES=$?
if [ $RES -ne 0 ]; then
echo "Error: Unable to uncompress $2"; exit 1;
fi
if [ "$CLASS" = "" ]; then
echo "Error: No MANIFEST.MF or Main-Class: in MANIFEST.MF found in $2"; exit 1;
fi
OPTS="$OPTS $CLASS"
# -jar is always the last option passed to java - the rest is being
# passed to executed program (main method)
OPTSDONE=1
shift
shift
;;
-v|-verbose|--verbose)
OPTS="$OPTS -v"
;;
-verbose-gc|--verbose-gc)
OPTS="$OPTS -g"
;;
-verbose*jni)
OPTS="$OPTS -j"
;;
-verbosemem|-verbosejit|-verbose*)
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2 ;;
-showversion|--showversion)
VER=
;;
-vmdebug)
shift # a string of comma-separated flags follows -vmdebug
echo "Warning: $1 option not implemented in java-sablevm wrapper." >&2
echo "You can compile SableVM with --enable-debugging-features option instead." >&2
;;
-*)
echo "Warning: $1 option NOT RECOGNIZED by java-sablevm." >&2
echo "A not recognized option will be just passed to SableVM." >&2
echo "Note that we don't know if we should expect an argument after it." >&2
echo "It almost _surely_ will result in an errors when the param is followed" >&2
echo "by an argument. Refer to 'man java-sablevm' and 'man sablevm'." >&2
REST="$REST $1"
;;
--)
OPTSDONE=1
;;
*)
OPTSDONE=1
;;
esac
if [ $OPTSDONE -ne 1 ]; then shift; fi
done
# setting -jar or -classpath nullfies CLASSPATH env var
if [ "X$JAR_CLASSPATH" != "X" ]; then
if [ "X$CMD_CLASSPATH" != "X" ]; then
CLASSPATH="$JAR_CLASSPATH:$CMD_CLASSPATH"
else
CLASSPATH="$JAR_CLASSPATH"
fi
else
if [ "X$CMD_CLASSPATH" != "X" ]; then
CLASSPATH="$CMD_CLASSPATH"
else
if [ "X$CLASSPATH" = "X" ]; then
CLASSPATH="."
fi
fi
fi
OPTS="--classpath=$CLASSPATH $OPTS"
# this is so that jikes worked w/o problems, i.e. when called by Ant
BOOTCLASSPATH="SABLEVM_CLASSDIR:SABLEVM_CLASSDIR/libclasspath.jar:SABLEVM_CLASSDIR/resources.jar"
if [ "X$LD_LIBRARY_PATH" != "X" -o "X$SVM_LIBRARY_PATH" != "X" ]; then
OPTS="-p java.library.path=$SVM_LIBRARY_PATH:$LD_LIBRARY_PATH:/usr/lib $OPTS"
fi
export CLASSPATH BOOTCLASSPATH
#echo $JVM $VER $OPTS $REST "$@"
exec $JVM $VER $OPTS $REST "$@"
echo "Error: unable to execute $JVM." >&2
exit 1
|