3 # Copyright (C) 2001 Free Software Foundation, Inc.
5 # Author: Nicola Pero <nicola@brainstorm.co.uk>
8 # This file is part of the GNUstep Makefile Package.
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License
12 # as published by the Free Software Foundation; either version 2
13 # of the License, or (at your option) any later version.
15 # You should have received a copy of the GNU General Public
16 # License along with this library; see the file COPYING.LIB.
17 # If not, write to the Free Software Foundation,
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # This is a shell script which attempts to execute a specific Java
21 # class (hardcoded when the shell script is installed), preparing
22 # CLASSPATH and LD_LIBRARY_PATH for it.
25 # The name of the script
30 # The directory we are in
32 tool_dir=`dirname $tool`
35 # The java class to execute - harcoded when the template is intalled
38 java_obj_file=JAVA_OBJ_FILE
41 # Check that the java class exists
43 full_java_obj_file=${tool_dir}/Java/${java_obj_file}.class
45 if [ ! -f "$full_java_obj_file" ]; then
46 echo "$tool: Installation problem: Can't find java class $java_obj_file !"
51 # Determine the host information if needed
53 if [ -z "$GNUSTEP_HOST" ]; then
54 GNUSTEP_HOST=`(cd /tmp; $GNUSTEP_SYSTEM_ROOT/Library/Makefiles/config.guess)`
55 GNUSTEP_HOST=`(cd /tmp; $GNUSTEP_SYSTEM_ROOT/Library/Makefiles/config.sub $GNUSTEP_HOST)`
58 if [ -z "$GNUSTEP_HOST_CPU" ]; then
59 GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/cpu.sh $GNUSTEP_HOST`
60 GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/clean_cpu.sh $GNUSTEP_HOST_CPU`
61 export GNUSTEP_HOST_CPU
63 if [ -z "$GNUSTEP_HOST_VENDOR" ]; then
64 GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/vendor.sh $GNUSTEP_HOST`
65 GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/clean_vendor.sh $GNUSTEP_HOST_VENDOR`
66 export GNUSTEP_HOST_VENDOR
68 if [ -z "$GNUSTEP_HOST_OS" ]; then
69 GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/os.sh $GNUSTEP_HOST`
70 GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Library/Makefiles/clean_os.sh $GNUSTEP_HOST_OS`
71 export GNUSTEP_HOST_OS
75 # Load up LD_LIBRARY_PATH
77 . $GNUSTEP_SYSTEM_ROOT/Library/Makefiles/ld_lib_path.sh
82 gnustep_class_path="$GNUSTEP_USER_ROOT/Library/Libraries/Java:$GNUSTEP_LOCAL_ROOT/Library/Libraries/Java:$GNUSTEP_NETWORK_ROOT/Library/Libraries/Java:$GNUSTEP_SYSTEM_ROOT/Library/Libraries/Java"
84 if [ -z "$CLASSPATH" ]; then
85 CLASSPATH="$gnustep_class_path"
87 if ( echo ${CLASSPATH} | grep -v "${gnustep_class_path}" >/dev/null ); then
88 CLASSPATH="$CLASSPATH:$gnustep_class_path"
92 if ( echo ${CLASSPATH} | grep -v "\./" >/dev/null ); then
93 CLASSPATH="$CLASSPATH:./"
102 if [ ! -z "$JAVA_HOME" ]; then
103 java_vm=${JAVA_HOME}/bin/java
105 if [ ! -z "$JDK_HOME" ]; then
106 java_vm=${JDK_HOME}/bin/java
111 # Run java on the object file
114 exec $java_vm $java_obj_file "$@"