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 LLVM_PROJECT_SVN="http://llvm.org/svn/llvm-project" 15 16 getLatestRevisionFromSVN() { 17 svn info ${LLVM_PROJECT_SVN} | egrep ^Revision | sed 's/^Revision: //' 18 } 19 20 readonly REV="${1:-$(getLatestRevisionFromSVN)}" 21 22 createTarballFromSVN() { 23 local module=$1 24 local log="${module}.log" 25 echo "Running: svn export -r ${REV} ${module}; log in ${log}" 26 svn -q export -r ${REV} ${LLVM_PROJECT_SVN}/${module}/trunk \ 27 ${module} > ${log} 2>&1 28 29 # Create "module-revision.tar.bz2" packages from the SVN checkout dirs. 30 local tarball="${module}-${REV}.tar.bz2" 31 echo "Creating tarball: ${tarball}" 32 tar cjf ${tarball} ${module} 33 34 echo "Cleaning up '${module}'" 35 rm -rf ${module} ${log} 36 } 37 38 for module in "llvm" "llvm-gcc-4.2"; do 39 createTarballFromSVN ${module} 40 done 41 42