Added two scripts to aid with building Linux/x86 -> Linux/ARM crosstools, using
CodeSourcery's provided GCC-based crosstools, from which we use binutils.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73212 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/crosstool/create-snapshots.sh b/utils/crosstool/create-snapshots.sh
new file mode 100755
index 0000000..7c640bc
--- /dev/null
+++ b/utils/crosstool/create-snapshots.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Creates LLVM SVN snapshots: llvm-$REV.tar.bz2 and llvm-gcc-4.2-$REV.tar.bz2,
+# where $REV is an SVN revision of LLVM.  This is used for creating stable
+# tarballs which can be used to build known-to-work crosstools.
+#
+# Syntax:
+#   $0 [REV] -- grabs the revision $REV from SVN; if not specified, grabs the
+#   latest SVN revision.
+
+set -o nounset
+set -o errexit
+
+readonly REV="${1:-HEAD}"
+
+runOnModule() {
+  local module=$1
+  local log="${module}.log"
+  echo "Running: svn co -r ${REV} ${module}; log in ${log}"
+  svn co -r ${REV} http://llvm.org/svn/llvm-project/${module}/trunk ${module} \
+      > ${log} 2>&1
+
+  # Delete all the ".svn" dirs; they take quite a lot of space.
+  echo "Cleaning up .svn dirs"
+  find ${module} -type d -name \.svn -print0 | xargs -0 /bin/rm -rf
+
+  # Create "module-revision.tar.bz2" packages from the SVN checkout dirs.
+  local revision=$(grep "Checked out revision" ${log} | \
+                   sed 's/[^0-9]\+\([0-9]\+\)[^0-9]\+/\1/')
+  local tarball="${module}-${revision}.tar.bz2"
+  echo "Creating tarball: ${tarball}"
+  tar cjf ${tarball} ${module}
+
+  echo "Cleaning SVN checkout dir ${module}"
+  rm -rf ${module} ${log}
+}
+
+for module in "llvm" "llvm-gcc-4.2"; do
+  runOnModule ${module}
+done
+