You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

bootstrap.sh 2.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/sh
  2. # You will need to specify JAVA_HOME if compiling with 1.2 or later.
  3. if [ "$JAVA_HOME" != "" ] ; then
  4. if [ -f $JAVA_HOME/lib/tools.jar ] ; then
  5. CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
  6. fi
  7. if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
  8. CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
  9. fi
  10. else
  11. echo "Warning: JAVA_HOME environment variable not set."
  12. echo " If build fails because sun.* classes could not be found"
  13. echo " you will need to set the JAVA_HOME environment variable"
  14. echo " to the installation directory of java."
  15. fi
  16. if [ ! -x "$JAVA_HOME/bin/java" ] ; then
  17. echo "Error: JAVA_HOME is not defined correctly."
  18. echo " We cannot execute JAVA_HOME/bin/java"
  19. exit
  20. fi
  21. # More Cygwin support
  22. if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
  23. CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  24. fi
  25. ANT_HOME=.
  26. export ANT_HOME
  27. if [ -z "$JAVAC" ] ; then
  28. JAVAC=${JAVA_HOME}/bin/javac;
  29. fi
  30. echo ... Bootstrapping Ant Distribution
  31. if [ -d "bootstrap" ] ; then
  32. rm -r bootstrap
  33. fi
  34. if [ -d "build/classes" ] ; then
  35. rm -r build/classes
  36. fi
  37. CLASSPATH=lib/crimson.jar:lib/jaxp.jar:${CLASSPATH}
  38. DIRLIBS=lib/optional/*.jar
  39. for i in ${DIRLIBS}
  40. do
  41. # if the directory is empty, then it will return the input string
  42. # this is stupid, so case for it
  43. if [ "$i" != "${DIRLIBS}" ] ; then
  44. CLASSPATH=$CLASSPATH:"$i"
  45. fi
  46. done
  47. TOOLS=src/main/org/apache/tools
  48. CLASSDIR=classes
  49. CLASSPATH=${CLASSDIR}:src/main:${CLASSPATH}
  50. # convert the unix path to windows
  51. if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
  52. CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  53. fi
  54. export CLASSPATH
  55. mkdir -p ${CLASSDIR}
  56. mkdir -p build
  57. echo ... Compiling Ant Classes
  58. ${JAVAC} -d ${CLASSDIR} ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
  59. ${TOOLS}/ant/util/regexp/RegexpMatcher.java \
  60. ${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
  61. ${TOOLS}/ant/util/*.java ${TOOLS}/ant/types/*.java \
  62. ${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java
  63. echo ... Copying Required Files
  64. cp src/main/org/apache/tools/ant/taskdefs/defaults.properties \
  65. ${CLASSDIR}/org/apache/tools/ant/taskdefs
  66. cp src/main/org/apache/tools/ant/types/defaults.properties \
  67. ${CLASSDIR}/org/apache/tools/ant/types
  68. echo ... Building Ant Distribution
  69. cp -r ${CLASSDIR} build
  70. ${JAVA_HOME}/bin/java -classpath ${CLASSPATH} org.apache.tools.ant.Main -emacs bootstrap
  71. echo ... Cleaning Up Build Directories
  72. chmod +x bootstrap/bin/ant bootstrap/bin/antRun
  73. rm -rf ${CLASSDIR}
  74. echo ... Done Bootstrapping Ant Distribution