File: java-executable.template

package info (click to toggle)
gnustep-make 1.3.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,568 kB
  • ctags: 44
  • sloc: sh: 3,432; ansic: 852; makefile: 80; csh: 77; objc: 11
file content (115 lines) | stat: -rw-r--r-- 3,091 bytes parent folder | download
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
#!/bin/sh
#
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# Author: Nicola Pero <nicola@brainstorm.co.uk>
# Date: April 2001
# 
# This file is part of the GNUstep Makefile Package.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# You should have received a copy of the GNU General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# This is a shell script which attempts to execute a specific Java
# class (hardcoded when the shell script is installed), preparing
# CLASSPATH and LD_LIBRARY_PATH for it.

#
# The name of the script
#
tool=$0

#
# The directory we are in
#
tool_dir=`dirname $tool`

#
# The java class to execute - harcoded when the template is intalled 
# by java-tool.make.
#
java_obj_file=JAVA_OBJ_FILE

#
# Check that the java class exists
#
full_java_obj_file=${tool_dir}/Java/${java_obj_file}.class

if [ ! -f "$full_java_obj_file" ]; then
  echo "$tool: Installation problem: Can't find java class $java_obj_file !"
  exit 1
fi

#
# Determine the host information if needed
#
if [ -z "$GNUSTEP_HOST" ]; then
    GNUSTEP_HOST=`(cd /tmp; $GNUSTEP_SYSTEM_ROOT/Makefiles/config.guess)`
    GNUSTEP_HOST=`(cd /tmp; $GNUSTEP_SYSTEM_ROOT/Makefiles/config.sub $GNUSTEP_HOST)`
    export GNUSTEP_HOST
fi
if [ -z "$GNUSTEP_HOST_CPU" ]; then
    GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Makefiles/cpu.sh $GNUSTEP_HOST`
    GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_cpu.sh $GNUSTEP_HOST_CPU`
    export GNUSTEP_HOST_CPU
fi
if [ -z "$GNUSTEP_HOST_VENDOR" ]; then
    GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Makefiles/vendor.sh $GNUSTEP_HOST`
    GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_vendor.sh $GNUSTEP_HOST_VENDOR`
    export GNUSTEP_HOST_VENDOR
fi
if [ -z "$GNUSTEP_HOST_OS" ]; then
    GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Makefiles/os.sh $GNUSTEP_HOST`
    GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_os.sh $GNUSTEP_HOST_OS`
   export GNUSTEP_HOST_OS
fi

#
# Load up LD_LIBRARY_PATH
#
. $GNUSTEP_SYSTEM_ROOT/Makefiles/ld_lib_path.sh

#
# Load up CLASSPATH
#
gnustep_class_path="$GNUSTEP_USER_ROOT/Libraries/Java:$GNUSTEP_LOCAL_ROOT/Libraries/Java:$GNUSTEP_NETWORK_ROOT/Libraries/Java:$GNUSTEP_SYSTEM_ROOT/Libraries/Java"

if [ -z "$CLASSPATH" ]; then
  CLASSPATH="$gnustep_class_path"
else
  if ( echo ${CLASSPATH} | grep -v "${gnustep_class_path}" >/dev/null ); then
    CLASSPATH="$CLASSPATH:$gnustep_class_path"
  fi
fi

if ( echo ${CLASSPATH} | grep -v "\./" >/dev/null ); then
  CLASSPATH="$CLASSPATH:./"
fi

export CLASSPATH

#
# Find java
#
java_vm=java
if [ ! -z "$JAVA_HOME" ]; then
  java_vm=${JAVA_HOME}/bin/java
else
  if [ ! -z "$JDK_HOME" ]; then
    java_vm=${JDK_HOME}/bin/java
  fi
fi

#
# Run java on the object file
#
cd ${tool_dir}/Java
exec $java_vm $java_obj_file "$@"