source: release-kits/shared/apache-ant-1.6.5/bootstrap.sh@ 15024

Last change on this file since 15024 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 4.3 KB
Line 
1#!/bin/sh
2
3# Copyright 2000-2004 Apache Software Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# OS specific support. $var _must_ be set to either true or false.
18cygwin=false;
19darwin=false;
20case "`uname`" in
21 CYGWIN*) cygwin=true ;;
22 Darwin*) darwin=true
23 if [ -z "$JAVA_HOME" ] ; then
24 JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
25 fi
26 ;;
27esac
28
29# For Cygwin, ensure paths are in UNIX format before anything is touched
30if $cygwin ; then
31 [ -n "$JAVA_HOME" ] &&
32 JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
33 [ -n "$CLASSPATH" ] &&
34 CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
35fi
36
37# You will need to specify JAVA_HOME if compiling with 1.2 or later.
38
39if [ -n "$JAVA_HOME" ] ; then
40 if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
41 CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
42 fi
43
44 if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
45 CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
46 fi
47else
48 echo "Warning: JAVA_HOME environment variable not set."
49 echo " If build fails because sun.* classes could not be found"
50 echo " you will need to set the JAVA_HOME environment variable"
51 echo " to the installation directory of java."
52fi
53
54# IBM's JDK on AIX uses strange locations for the executables:
55# JAVA_HOME/jre/sh for java and rmid
56# JAVA_HOME/sh for javac and rmic
57if [ -z "$JAVAC" ] ; then
58 if [ -n "$JAVA_HOME" ] ; then
59 if [ -x "$JAVA_HOME/sh/javac" ] ; then
60 JAVAC=${JAVA_HOME}/sh/javac;
61 else
62 JAVAC=${JAVA_HOME}/bin/javac;
63 fi
64 else
65 JAVAC=javac
66 fi
67fi
68if [ -z "$JAVACMD" ] ; then
69 if [ -n "$JAVA_HOME" ] ; then
70 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
71 JAVACMD=$JAVA_HOME/jre/sh/java
72 else
73 JAVACMD=$JAVA_HOME/bin/java
74 fi
75 else
76 JAVACMD=java
77 fi
78fi
79
80if [ ! -x "$JAVACMD" ] ; then
81 echo "Error: JAVA_HOME is not defined correctly."
82 echo " We cannot execute $JAVACMD"
83 exit
84fi
85
86ANT_HOME=.
87export ANT_HOME
88
89echo ... Bootstrapping Ant Distribution
90
91if [ -d "bootstrap" ] ; then
92 rm -r bootstrap
93fi
94
95if [ -d "build" ] ; then
96 rm -r build
97fi
98
99CLASSPATH=lib/xercesImpl.jar:lib/xml-apis.jar:${CLASSPATH}
100
101DIRLIBS=lib/optional/*.jar
102for i in ${DIRLIBS}
103do
104 # if the directory is empty, then it will return the input string
105 # this is stupid, so case for it
106 if [ "$i" != "${DIRLIBS}" ] ; then
107 CLASSPATH=$CLASSPATH:"$i"
108 fi
109done
110
111TOOLS=src/main/org/apache/tools
112CLASSDIR=build/classes
113
114CLASSPATH=${CLASSDIR}:src/main:${CLASSPATH}
115
116# For Cygwin, switch to Windows format before running java
117if $cygwin; then
118 CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
119fi
120
121export CLASSPATH
122
123mkdir -p build
124mkdir -p ${CLASSDIR}
125mkdir -p bin
126
127echo ... Compiling Ant Classes
128
129"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
130 ${TOOLS}/ant/util/regexp/RegexpMatcher.java \
131 ${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
132 ${TOOLS}/ant/types/*.java \
133 ${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java \
134 ${TOOLS}/ant/taskdefs/compilers/*.java \
135 ${TOOLS}/ant/taskdefs/condition/*.java
136ret=$?
137if [ $ret != 0 ]; then
138 echo ... Failed compiling Ant classes !
139 exit $ret
140fi
141
142echo ... Copying Required Files
143
144cp src/main/org/apache/tools/ant/taskdefs/defaults.properties \
145 ${CLASSDIR}/org/apache/tools/ant/taskdefs
146cp src/main/org/apache/tools/ant/types/defaults.properties \
147 ${CLASSDIR}/org/apache/tools/ant/types
148cp src/script/antRun bin
149chmod +x bin/antRun
150
151echo ... Building Ant Distribution
152
153"${JAVACMD}" -classpath "${CLASSPATH}" -Dant.home=. $ANT_OPTS org.apache.tools.ant.Main -emacs "$@" bootstrap
154ret=$?
155if [ $ret != 0 ]; then
156 echo ... Failed Building Ant Distribution !
157 exit $ret
158fi
159
160
161echo ... Cleaning Up Build Directories
162
163rm -rf ${CLASSDIR}
164rm -rf bin
165
166echo ... Done Bootstrapping Ant Distribution
Note: See TracBrowser for help on using the repository browser.