Misha Brukman | cb6f9c8 | 2009-06-12 01:55:57 +0000 | [diff] [blame] | 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 | |
| 11 | set -o nounset |
| 12 | set -o errexit |
| 13 | |
| 14 | readonly REV="${1:-HEAD}" |
| 15 | |
| 16 | runOnModule() { |
| 17 | local module=$1 |
| 18 | local log="${module}.log" |
| 19 | echo "Running: svn co -r ${REV} ${module}; log in ${log}" |
| 20 | svn co -r ${REV} http://llvm.org/svn/llvm-project/${module}/trunk ${module} \ |
| 21 | > ${log} 2>&1 |
| 22 | |
| 23 | # Delete all the ".svn" dirs; they take quite a lot of space. |
| 24 | echo "Cleaning up .svn dirs" |
| 25 | find ${module} -type d -name \.svn -print0 | xargs -0 /bin/rm -rf |
| 26 | |
| 27 | # Create "module-revision.tar.bz2" packages from the SVN checkout dirs. |
| 28 | local revision=$(grep "Checked out revision" ${log} | \ |
| 29 | sed 's/[^0-9]\+\([0-9]\+\)[^0-9]\+/\1/') |
| 30 | local tarball="${module}-${revision}.tar.bz2" |
| 31 | echo "Creating tarball: ${tarball}" |
| 32 | tar cjf ${tarball} ${module} |
| 33 | |
| 34 | echo "Cleaning SVN checkout dir ${module}" |
| 35 | rm -rf ${module} ${log} |
| 36 | } |
| 37 | |
| 38 | for module in "llvm" "llvm-gcc-4.2"; do |
| 39 | runOnModule ${module} |
| 40 | done |
| 41 | |