• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7LLVM_REVISION=$1
8CLANG_REVISION=$2
9LLVM_CONFIGURATION=$3
10
11if [ "$LLVM_REVISION" = "" ]; then
12	echo "Usage:\n    build-lldb-llvm-clang <llvm-revision> [<clang-revision> Debug|Release||BuildAndIntegration]"
13	exit 1
14fi
15
16if [ "$CLANG_REVISION" = "" ]; then
17	$CLANG_REVISION = $LLVM_REVISION
18fi
19
20# Checkout LLVM
21svn co -q -r $LLVM_REVISION http://llvm.org/svn/llvm-project/llvm/trunk llvm
22
23# change directory to "./llvm"
24cd llvm
25
26# Checkout Clang
27# change directory to "./llvm/tools"
28cd tools
29svn co -q -r $CLANG_REVISION http://llvm.org/svn/llvm-project/cfe/trunk clang
30
31# change directory to "./llvm"
32cd ..
33for patch_file in ../scripts/llvm.*.diff
34do
35	echo "Applying patch from '$patch_file'"
36    patch -p0 < "$patch_file"
37done
38
39# change directory to "./llvm/tools/clang"
40cd tools/clang
41for patch_file in ../../../scripts/clang.*.diff
42do
43	echo "Applying patch from '$patch_file'"
44    patch -p0 < "$patch_file"
45done
46
47# change directory to "./"
48cd ../../..
49pwd
50
51if [ "$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
58elif [ "$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
65elif [ "$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
71else
72	echo "checked out llvm (revision $LLVM_REVISION) and clang (revision $CLANG_REVISION)."
73	exit 0
74fi
75