1#!/bin/bash
2
3if [ -d "llvm-build" ]; then
4    echo "Using existing 'llvm-build' directory..."    
5else
6    mkdir llvm-build
7fi
8
9cd llvm-build
10
11if [ -d "llvm" ]; then
12    echo "Using existing 'llvm' directory..."
13else
14    svn co --revision 176809 http://llvm.org/svn/llvm-project/llvm/trunk llvm
15    ( cd llvm/tools ; svn co --revision 176809 http://llvm.org/svn/llvm-project/cfe/trunk clang )
16fi
17
18if [ ! -d "build" ]; then
19    mkdir build
20    cd build
21    ../llvm/configure --enable-targets=x86_64,arm --build=x86_64-apple-darwin10 --disable-optimized --disable-assertions --enable-libcpp
22    make -j8 clang-only DEBUG_SYMBOLS=1
23    rm -rf lib projects runtime unittests utils config.*
24    ( cd ./Debug/bin ; rm -rf ll* clang-check clang-tblgen count diagtool fpcmp macho-dump not opt yaml2obj FileCheck FileUpdate arcmt-test c-arcmt-test c-index-test bugpoint )
25    ( cd ./tools ; rm -rf ll* clang-check clang-tblgen count diagtool fpcmp lto macho-dump not opt yaml2obj FileCheck FileUpdate arcmt-test c-arcmt-test c-index-test bugpoint )
26    ( cd ./tools/clang ; rm -rf lib unittests utils )
27    ( cd ./tools/clang/tools ; rm -rf arcmt-test c-arcmt-test c-index-test clang-check diagtool libclang )
28    ( cd ../llvm ; rm -rf cmake configure docs examples projects *.txt *.TXT autoconf bindings test unittests utils ; find . -type d -name .svn -print0 | xargs -0 rm -rf )
29    ( cd ../llvm/tools ; rm -rf *.txt bugpoint bugpoint-passes ll* lto macho-dump opt gold )
30fi
31
32
33
34