create-snapshots.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. #
  3. # Creates LLVM SVN snapshots: llvm-$REV.tar.bz2 and llvm-gcc-4.2-$REV.tar.bz2,
  4. # where $REV is an SVN revision of LLVM. This is used for creating stable
  5. # tarballs which can be used to build known-to-work crosstools.
  6. #
  7. # Syntax:
  8. # $0 [REV] -- grabs the revision $REV from SVN; if not specified, grabs the
  9. # latest SVN revision.
  10. set -o nounset
  11. set -o errexit
  12. readonly LLVM_PROJECT_SVN="http://llvm.org/svn/llvm-project"
  13. getLatestRevisionFromSVN() {
  14. svn info ${LLVM_PROJECT_SVN} | egrep ^Revision | sed 's/^Revision: //'
  15. }
  16. readonly REV="${1:-$(getLatestRevisionFromSVN)}"
  17. createTarballFromSVN() {
  18. local module=$1
  19. local log="${module}.log"
  20. echo "Running: svn export -r ${REV} ${module}; log in ${log}"
  21. svn -q export -r ${REV} ${LLVM_PROJECT_SVN}/${module}/trunk \
  22. ${module} > ${log} 2>&1
  23. # Create "module-revision.tar.bz2" packages from the SVN checkout dirs.
  24. local tarball="${module}-${REV}.tar.bz2"
  25. echo "Creating tarball: ${tarball}"
  26. tar cjf ${tarball} ${module}
  27. echo "Cleaning up '${module}'"
  28. rm -rf ${module} ${log}
  29. }
  30. for module in "llvm" "llvm-gcc-4.2"; do
  31. createTarballFromSVN ${module}
  32. done