1 #!/bin/sh -x 2 3 # Usage: 4 # build-lldb-llvm-clang <revision> [Debug|Release|BuildAndIntegration] 5 # build-lldb-llvm-clang <llvm-revision> <clang-revision> [Debug|Release|BuildAndIntegration] 6 7 LLVM_REVISION=$1 8 CLANG_REVISION=$2 9 LLVM_CONFIGURATION=$3 10 11 if [ "$LLVM_REVISION" = "" ]; then 12 echo "Usage:\n build-lldb-llvm-clang <llvm-revision> [<clang-revision> Debug|Release||BuildAndIntegration]" 13 exit 1 14 fi 15 16 if [ "$CLANG_REVISION" = "" ]; then 17 $CLANG_REVISION = $LLVM_REVISION 18 fi 19 20 # Checkout LLVM 21 svn co -q -r $LLVM_REVISION http://llvm.org/svn/llvm-project/llvm/trunk llvm 22 23 # change directory to "./llvm" 24 cd llvm 25 26 # Checkout Clang 27 # change directory to "./llvm/tools" 28 cd tools 29 svn co -q -r $CLANG_REVISION http://llvm.org/svn/llvm-project/cfe/trunk clang 30 31 # change directory to "./llvm" 32 cd .. 33 for patch_file in ../scripts/llvm.*.diff 34 do 35 echo "Applying patch from '$patch_file'" 36 patch -p0 < "$patch_file" 37 done 38 39 # change directory to "./llvm/tools/clang" 40 cd tools/clang 41 for patch_file in ../../../scripts/clang.*.diff 42 do 43 echo "Applying patch from '$patch_file'" 44 patch -p0 < "$patch_file" 45 done 46 47 # change directory to "./" 48 cd ../../.. 49 pwd 50 51 if [ "$LLVM_CONFIGURATION" = "Debug" ]; then 52 # Configure "Debug+Asserts" build 53 mkdir llvm-debug 54 cd llvm-debug 55 ../llvm/configure --enable-targets=x86_64,arm 56 make -j8 clang-only VERBOSE=1 PROJECT_NAME='llvm' 57 make -j8 tools-only VERBOSE=1 PROJECT_NAME='llvm' EDIS_VERSION=1 58 elif [ "$LLVM_CONFIGURATION" = "Release" ]; then 59 # Configure "Release" build 60 mkdir llvm-release 61 cd llvm-release 62 ../llvm/configure --enable-targets=x86_64,arm --enable-optimized --disable-assertions 63 make -j8 clang-only VERBOSE=1 PROJECT_NAME='llvm' 64 make -j8 tools-only VERBOSE=1 PROJECT_NAME='llvm' EDIS_VERSION=1 65 elif [ "$LLVM_CONFIGURATION" = "BuildAndIntegration" ]; then 66 # Don't configure or build for "BuildAndIntegration", this configuration 67 # is a preparation step for a build submission 68 69 # Remove all patches, and the llvm and clang "test" directories 70 rm -rf ./scripts/*.diff ./llvm/test ./llvm/tools/clang/test 71 else 72 echo "checked out llvm (revision $LLVM_REVISION) and clang (revision $CLANG_REVISION)." 73 exit 0 74 fi 75