]>
git.argeo.org Git - gpl/argeo-slc.git/blob - config/bin/slc
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Extract launch and ant arguments, (see details below).
21 use_jikes_default
=false
25 if [ "$arg" = "--noconfig" ] ; then
27 elif [ "$arg" = "--usejikes" ] ; then
28 use_jikes_default
=true
29 elif [ "$arg" = "--execdebug" ] ; then
31 elif [ my
"$arg" = my
"--h" -o my
"$arg" = my
"--help" ] ; then
33 ant_exec_args
="$ant_exec_args -h"
35 if [ my
"$arg" = my
"-h" -o my
"$arg" = my
"-help" ] ; then
38 ant_exec_args
="$ant_exec_args \"$arg\""
42 # Source/default ant configuration
45 usejikes
=$use_jikes_default
47 # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
48 if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
49 if [ -f "/etc/ant.conf" ] ; then
54 # load user ant configuration
55 if [ -f "$HOME/.ant/ant.conf" ] ; then
58 if [ -f "$HOME/.antrc" ] ; then
62 # provide default configuration values
63 if [ -z "$rpm_mode" ] ; then
66 if [ -z "$usejikes" ] ; then
67 usejikes
=$use_jikes_default
71 # Setup Java environment in rpm mode
73 if [ -f /usr
/share
/java-utils
/java-functions
] ; then
74 .
/usr
/share
/java-utils
/java-functions
80 # OS specific support. $var _must_ be set to either true or false.
84 CYGWIN
*) cygwin
=true
;;
86 if [ -z "$JAVA_HOME" ] ; then
87 JAVA_HOME
=/System
/Library
/Frameworks
/JavaVM.framework
/Home
92 if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
93 ## resolve links - $0 may be a link to ant's home
95 progname
=`basename "$0"`
97 # need this for relative symlinks
98 while [ -h "$PRG" ] ; do
100 link
=`expr "$ls" : '.*-> \(.*\)$'`
101 if expr "$link" : '/.*' > /dev
/null
; then
104 PRG
=`dirname "$PRG"`"/$link"
108 ANT_HOME
=`dirname "$PRG"`/..
110 # make it fully qualified
111 ANT_HOME
=`cd "$ANT_HOME" && pwd`
114 # For Cygwin, ensure paths are in UNIX format before anything is touched
116 [ -n "$ANT_HOME" ] &&
117 ANT_HOME
=`cygpath --unix "$ANT_HOME"`
118 [ -n "$JAVA_HOME" ] &&
119 JAVA_HOME
=`cygpath --unix "$JAVA_HOME"`
122 # set ANT_LIB location
123 ANT_LIB
="${ANT_HOME}/lib"
125 if [ -z "$JAVACMD" ] ; then
126 if [ -n "$JAVA_HOME" ] ; then
127 # IBM's JDK on AIX uses strange locations for the executables
128 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
129 JAVACMD
="$JAVA_HOME/jre/sh/java"
130 elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then
131 JAVACMD
="$JAVA_HOME/jre/bin/java"
133 JAVACMD
="$JAVA_HOME/bin/java"
136 JAVACMD
=`which java 2> /dev/null `
137 if [ -z "$JAVACMD" ] ; then
143 if [ ! -x "$JAVACMD" ] ; then
144 echo "Error: JAVA_HOME is not defined correctly."
145 echo " We cannot execute $JAVACMD"
149 # Build local classpath using just the launcher in non-rpm mode or
150 # use the Jpackage helper in rpm mode with basic and default jars
151 # specified in the ant.conf configuration. Because the launcher is
152 # used, libraries linked in ANT_HOME/lib will also be included, but this
153 # is discouraged as it is not java-version safe. A user should
154 # request optional jars and their dependencies via the OPT_JAR_LIST
156 if $rpm_mode && [ -x /usr
/bin
/build-classpath
] ; then
157 LOCALCLASSPATH
="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)"
159 # If no optional jars have been specified then build the default list
160 if [ -z "$OPT_JAR_LIST" ] ; then
161 for file in /etc
/ant.d
/*; do
162 if [ -f "$file" ]; then
169 for dep
in `cat "$file"`; do
170 case "$OPT_JAR_LIST" in
172 *) OPT_JAR_LIST
="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep"
180 # If the user requested to try to add some other jars to the classpath
181 if [ -n "$OPT_JAR_LIST" ] ; then
182 _OPTCLASSPATH
="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)"
183 if [ -n "$_OPTCLASSPATH" ] ; then
184 LOCALCLASSPATH
="$LOCALCLASSPATH:$_OPTCLASSPATH"
188 # Explicitly add javac path to classpath, assume JAVA_HOME set
189 # properly in rpm mode
190 if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
191 LOCALCLASSPATH
="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"
193 if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
194 LOCALCLASSPATH
="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
197 # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be
198 # user CLASSPATH first and ant-found jars after.
199 # In that case, the user CLASSPATH will override ant-found jars
201 # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour
202 # with ant-found jars first and user CLASSPATH after
203 if [ -n "$CLASSPATH" ] ; then
204 # merge local and specified classpath
205 if [ -z "$LOCALCLASSPATH" ] ; then
206 LOCALCLASSPATH
="$CLASSPATH"
207 elif [ -n "$CLASSPATH_OVERRIDE" ] ; then
208 LOCALCLASSPATH
="$CLASSPATH:$LOCALCLASSPATH"
210 LOCALCLASSPATH
="$LOCALCLASSPATH:$CLASSPATH"
213 # remove class path from launcher -cp option
217 # not using rpm_mode; use launcher to determine classpaths
218 if [ -z "$LOCALCLASSPATH" ] ; then
219 LOCALCLASSPATH
=$ANT_LIB/ant-launcher.jar
221 LOCALCLASSPATH
=$ANT_LIB/ant-launcher.jar
:$LOCALCLASSPATH
225 if [ -n "$JAVA_HOME" ] ; then
226 # OSX hack to make Ant work with jikes
228 OSXHACK
="${JAVA_HOME}/../Classes"
229 if [ -d "${OSXHACK}" ] ; then
230 for i
in "${OSXHACK}"/*.jar
232 JIKESPATH
="$JIKESPATH:$i"
238 # Allow Jikes support (off by default)
240 ANT_OPTS
="$ANT_OPTS -Dbuild.compiler=jikes"
243 # For Cygwin, switch paths to appropriate format before running java
244 # For PATHs convert to unix format first, then to windows format to ensure
245 # both formats are supported. Probably this will fail on directories with ;
246 # in the name in the path. Let's assume that paths containing ; are more
247 # rare than windows style paths on cygwin.
249 if [ "$OS" = "Windows_NT" ] && cygpath
-m .
>/dev
/null
2>/dev
/null
; then
254 ANT_HOME
=`cygpath --$format "$ANT_HOME"`
255 ANT_LIB
=`cygpath --$format "$ANT_LIB"`
256 JAVA_HOME
=`cygpath --$format "$JAVA_HOME"`
257 LCP_TEMP
=`cygpath --path --unix "$LOCALCLASSPATH"`
258 LOCALCLASSPATH
=`cygpath --path --$format "$LCP_TEMP"`
259 if [ -n "$CLASSPATH" ] ; then
260 CP_TEMP
=`cygpath --path --unix "$CLASSPATH"`
261 CLASSPATH
=`cygpath --path --$format "$CP_TEMP"`
263 CYGHOME
=`cygpath --$format "$HOME"`
266 # Show script help if requested
268 echo $0 '[script options] [options] [target [target2 [target3] ..]]'
269 echo 'Script Options:'
270 echo ' --help, --h print this message and ant help'
271 echo ' --noconfig suppress sourcing of /etc/ant.conf,'
272 echo ' $HOME/.ant/ant.conf, and $HOME/.antrc'
273 echo ' configuration files'
274 echo ' --usejikes enable use of jikes by default, unless'
275 echo ' set explicitly in configuration files'
276 echo ' --execdebug print ant exec line generated by this'
277 echo ' launch script'
280 # add a second backslash to variables terminated by a backslash under cygwin
284 ANT_HOME
="$ANT_HOME\\"
294 JIKESPATH
="$JIKESPATH\\"
297 case "$LOCALCLASSPATH" in
299 LOCALCLASSPATH
="$LOCALCLASSPATH\\"
304 CLASSPATH
="$CLASSPATH\\"
308 # Execute ant using eval/exec to preserve spaces in paths,
309 # java options, and ant args
311 if [ -n "$CYGHOME" ]; then
312 if [ -n "$JIKESPATH" ]; then
313 ant_sys_opts
="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\""
315 ant_sys_opts
="-Dcygwin.user.home=\"$CYGHOME\""
318 if [ -n "$JIKESPATH" ]; then
319 ant_sys_opts
="-Djikes.class.path=\"$JIKESPATH\""
322 ant_exec_command
="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
323 if $ant_exec_debug ; then
324 echo $ant_exec_command
326 eval $ant_exec_command