-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathidlc-wrapper.sh
executable file
·63 lines (52 loc) · 1.75 KB
/
idlc-wrapper.sh
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
#!/bin/sh
#
# TID IDL compiler wrapper for TIDorbC
# Copyright (c) 2008 Telefonica Investigacion y Desarrollo
# All rights reserved
#
# Written by Alvaro Polo <[email protected]>
#
# This script is used as a wrapper for TIDIdlc Java jar to avoid
# the constant use of environment variables JAVA_HOME and
# TIDIDLC_HOME used in idl2cpp script distributed along TIDIdlc.
#
usage() {
echo "TID IDL compiler wrapper for TIDorbC" >&2
echo "Copyright (c) 2008 Telefonica I+D" >&2
echo "All rights reserved" >&2
echo "" >&2
[ "$1" ] && echo "Error: $1"
echo "Usage: $0 [<options>] <compiler arguments>"
echo ""
echo "Options: --java-bin=<path> Java VM binary location"
echo " --tididlc-home=<dir> TIDIdlc home directory"
echo ""
exit -1
}
# Script entry point.
java_bin=""
tididlc_home=""
for arg in $*; do
key=`echo "$arg" | cut -d= -f1`
value=`echo "$arg" | cut -d= -f2`
case "$key" in
--java-bin) java_bin=$value;;
--tididlc-home) tididlc_home=$value;;
*) args="$args $value";;
esac
done
[ "$java_bin" ] && java="$java_bin"
[ -x "$java" ] || java="$HOME/bin/java"
[ -x "$java" ] || java="/usr/local/bin/java"
[ -x "$java" ] || java="/usr/bin/java"
eval "$java -version 2>/dev/null >/dev/null" || usage "Java VM cannot be executed"
[ "$tididlc_home" ] && tididlc_jar="$tididlc_home/lib/idl2cpp.jar"
[ -f "$tididlc_jar" ] || tididlc_jar="$HOME/lib/idl2cpp.jar"
[ -f "$tididlc_jar" ] || tididlc_jar="/usr/local/lib/idl2cpp.jar"
[ -f "$tididlc_jar" ] || tididlc_jar="/usr/lib/idl2cpp.jar"
[ -f "$tididlc_jar" ] || usage "cannot find idl2cpp.jar"
if [ -x "/bin/cygpath" ]; then
[ "$args" ] && $java -jar `cygpath -m $tididlc_jar` $args
else
[ "$args" ] && $java -jar $tididlc_jar $args
fi