OpenSUSE 13: Build LLVM/Clang from svn repository

For using latest LLVM/Clang, this article will describe building LLVM/Clang from svn repository.

1 Install cmake 3.6

Latest LLVM/Clangs needs cmake 3.4 or later. Install cmake 3.6 with this.

2 Download LLVM/Clang from svn repository

Acording to Clang page, download source code except libcxx.

$ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
$ cd llvm/tools
$ svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
$ cd clang/tools
$ svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
$ cd ../../../projects
$ svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
$ cd ../..

3 Build LLVM/Clang

Create build directory, build LLVM/Clang as a release binary and install binary to /usr/local.

$ mkdir llvm.build
$ cd llvm.build
$ cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local ../llvm
$ make
$ sudo make install