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.4 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. CLASSPATH=lib/crimson.jar:lib/jaxp.jar:${CLASSPATH}
  35. DIRLIBS=lib/optional/*.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. TOOLS=src/main/org/apache/tools
  45. CLASSDIR=classes
  46. CLASSPATH=${CLASSDIR}:src/main:${CLASSPATH}
  47. # convert the unix path to windows
  48. if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
  49. CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  50. fi
  51. export CLASSPATH
  52. mkdir -p ${CLASSDIR}
  53. mkdir -p build
  54. echo ... Compiling Ant Classes
  55. ${JAVAC} -d ${CLASSDIR} ${TOOLS}/tar/*.java \
  56. ${TOOLS}/ant/util/regexp/RegexpMatcher.java \
  57. ${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
  58. ${TOOLS}/ant/util/*.java ${TOOLS}/ant/types/*.java \
  59. ${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java
  60. echo ... Copying Required Files
  61. cp src/main/org/apache/tools/ant/taskdefs/defaults.properties \
  62. ${CLASSDIR}/org/apache/tools/ant/taskdefs
  63. cp src/main/org/apache/tools/ant/types/defaults.properties \
  64. ${CLASSDIR}/org/apache/tools/ant/types
  65. echo ... Building Ant Distribution
  66. cp -r ${CLASSDIR} build
  67. ${JAVA_HOME}/bin/java -classpath ${CLASSPATH} org.apache.tools.ant.Main -emacs bootstrap
  68. echo ... Cleaning Up Build Directories
  69. chmod +x bootstrap/bin/ant bootstrap/bin/antRun
  70. rm -rf ${CLASSDIR}
  71. echo ... Done Bootstrapping Ant Distribution