summaryrefslogtreecommitdiff
path: root/test/files/jvm/mkLibNatives.sh
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-06-12 12:03:29 +0000
committermichelou <michelou@epfl.ch>2007-06-12 12:03:29 +0000
commit625d525491098309f19ae61ee591539cbc9e60b8 (patch)
tree34f8943c20d6ce41806406af7dabc4fe13817362 /test/files/jvm/mkLibNatives.sh
parenta31e3c23a1d00b87b7e205740e956fad3e988eee (diff)
downloadscala-625d525491098309f19ae61ee591539cbc9e60b8.tar.gz
scala-625d525491098309f19ae61ee591539cbc9e60b8.tar.bz2
scala-625d525491098309f19ae61ee591539cbc9e60b8.zip
added .dll test library (Win32)
Diffstat (limited to 'test/files/jvm/mkLibNatives.sh')
-rwxr-xr-xtest/files/jvm/mkLibNatives.sh43
1 files changed, 37 insertions, 6 deletions
diff --git a/test/files/jvm/mkLibNatives.sh b/test/files/jvm/mkLibNatives.sh
index 9d4ded597f..e911330ab3 100755
--- a/test/files/jvm/mkLibNatives.sh
+++ b/test/files/jvm/mkLibNatives.sh
@@ -1,23 +1,54 @@
#!/bin/sh
+##############################################################################
+# Author : Stephane Micheloud
+# Revision: $Id: $
+##############################################################################
+
+##############################################################################
+# variables
+
+# set any value to enable debugging output
+debug=1
+
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ Darwin*) darwin=true ;;
+esac
+
CLASS_NAME=Test\$
CLASS_DIR=natives-jvm
OBJ_NAME=natives
LIB_NAME=libnatives
-JAVAH=javah
+if [ -z "${JAVA_HOME}" ]; then
+ echo "environment variable JAVA_HOME is undefined."
+ exit
+elif [ $cygwin ]; then
+ echo "Cygwin not supported (use 'mkLibNatives.bat')."
+ exit
+fi
+
+JAVAH=${JAVA_HOME}/bin/javah
JAVAH_OPTIONS="-jni -force -classpath ${CLASS_DIR} -o ${OBJ_NAME}.h"
CC=gcc
CC_OPTIONS=-c
CC_INCLUDES="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${OSTYPE}"
-#echo ${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME}
-#${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME}
+LNK_OPTIONS="-shared -Wl,-soname,${LIB_NAME}"
+
+##############################################################################
+# commands
+
+[ "$debug" ] && echo ${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME}
+${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME}
-#echo ${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c
+[ "$debug" ] && echo ${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c
${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c
-#echo ${CC} -shared -Wl,-soname,${LIB_NAME} -o ${LIB_NAME}.so ${OBJ_NAME}.o
-${CC} -shared -Wl,-soname,${LIB_NAME} -o ${LIB_NAME}.so ${OBJ_NAME}.o
+[ "$debug" ] && echo ${CC} -shared -Wl,-soname,${LIB_NAME} -o ${LIB_NAME}.so ${OBJ_NAME}.o
+${CC} ${LNK_OPTIONS} -o ${LIB_NAME}.so ${OBJ_NAME}.o