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.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 [ ! -f "$JAVA_HOME/bin/java" ] ; then
  17. echo "Error: JAVA_HOME is not defined correctly."
  18. echo " We were unable to locate JAVA_HOME/bin/java"
  19. exit
  20. fi
  21. if [ ! -x "$JAVA_HOME/bin/java" ] ; then
  22. echo "Error: JAVA_HOME is not defined correctly."
  23. echo " We cannot execute JAVA_HOME/bin/java"
  24. exit
  25. fi
  26. # More Cygwin support
  27. if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
  28. CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  29. fi
  30. ANT_HOME=.
  31. export ANT_HOME
  32. if [ -z "$JAVAC" ] ; then
  33. JAVAC=javac;
  34. fi
  35. echo ... Bootstrapping Ant Distribution
  36. if [ -f "lib/ant.jar" ] ; then
  37. rm lib/ant.jar
  38. fi
  39. # add in the dependency .jar files
  40. DIRLIBS=${ANT_HOME}/lib/*.jar
  41. for i in ${DIRLIBS}
  42. do
  43. # if the directory is empty, then it will return the input string
  44. # this is stupid, so case for it
  45. if [ "$i" != "${DIRLIBS}" ] ; then
  46. CLASSPATH=$CLASSPATH:"$i"
  47. fi
  48. done
  49. DIRCORELIBS=${ANT_HOME}/lib/core/*.jar
  50. for i in ${DIRCORELIBS}
  51. do
  52. # if the directory is empty, then it will return the input string
  53. # this is stupid, so case for it
  54. if [ "$i" != "${DIRCORELIBS}" ] ; then
  55. CLASSPATH=$CLASSPATH:"$i"
  56. fi
  57. done
  58. TOOLS=src/main/org/apache/tools
  59. CLASSDIR=classes
  60. CLASSPATH=${CLASSDIR}:src/main:${CLASSPATH}
  61. # convert the unix path to windows
  62. if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
  63. CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  64. fi
  65. export CLASSPATH
  66. mkdir -p ${CLASSDIR}
  67. echo ... Compiling Ant Classes
  68. ${JAVAC} -d ${CLASSDIR} ${TOOLS}/tar/*.java ${TOOLS}/ant/util/regexp/RegexpMatcher.java ${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java ${TOOLS}/ant/util/*.java ${TOOLS}/ant/types/*.java ${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java
  69. echo ... Copying Required Files
  70. cp src/main/org/apache/tools/ant/taskdefs/defaults.properties ${CLASSDIR}/org/apache/tools/ant/taskdefs
  71. cp src/main/org/apache/tools/ant/types/defaults.properties ${CLASSDIR}/org/apache/tools/ant/types
  72. echo ... Building Ant Distribution
  73. ${JAVA_HOME}/bin/java -classpath ${CLASSPATH} org.apache.tools.ant.Main \
  74. -buildfile build.xml clean main bootstrap
  75. echo ... Cleaning Up Build Directories
  76. chmod +x bin/ant bin/antRun
  77. rm -rf ${CLASSDIR}
  78. echo ... Done Bootstrapping Ant Distribution