blob: d70232a3ce4650696bde14716ddb52ffa86faee5 [file] [log] [blame]
Misha Brukmancb6f9c82009-06-12 01:55:57 +00001#!/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
11set -o nounset
12set -o errexit
13
Misha Brukman0307a762009-08-04 15:47:18 +000014readonly LLVM_PROJECT_SVN="http://llvm.org/svn/llvm-project"
Misha Brukmancb6f9c82009-06-12 01:55:57 +000015
Misha Brukman0307a762009-08-04 15:47:18 +000016getLatestRevisionFromSVN() {
17 svn info ${LLVM_PROJECT_SVN} | egrep ^Revision | sed 's/^Revision: //'
18}
19
20readonly REV="${1:-$(getLatestRevisionFromSVN)}"
21
22createTarballFromSVN() {
Misha Brukmancb6f9c82009-06-12 01:55:57 +000023 local module=$1
24 local log="${module}.log"
Misha Brukman0307a762009-08-04 15:47:18 +000025 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
Misha Brukmancb6f9c82009-06-12 01:55:57 +000028
29 # Create "module-revision.tar.bz2" packages from the SVN checkout dirs.
Misha Brukman0307a762009-08-04 15:47:18 +000030 local tarball="${module}-${REV}.tar.bz2"
Misha Brukmancb6f9c82009-06-12 01:55:57 +000031 echo "Creating tarball: ${tarball}"
32 tar cjf ${tarball} ${module}
33
Misha Brukman0307a762009-08-04 15:47:18 +000034 echo "Cleaning up '${module}'"
Misha Brukmancb6f9c82009-06-12 01:55:57 +000035 rm -rf ${module} ${log}
36}
37
38for module in "llvm" "llvm-gcc-4.2"; do
Misha Brukman0307a762009-08-04 15:47:18 +000039 createTarballFromSVN ${module}
Misha Brukmancb6f9c82009-06-12 01:55:57 +000040done
41