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