Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- maj_ver=8
- min_ver=0
- patch_ver=0
- version=${maj_ver}.${min_ver}.${patch_ver}
- #?apt-get install -y zlib1g-dev libncurses5-dev bison cmake3 flex make \
- #? libxml2-dev libelf-dev curl
- Source0=http://llvm.org/releases/${version}/llvm-${version}.src.tar.xz
- Source1=http://llvm.org/releases/${version}/cfe-${version}.src.tar.xz
- set -e
- set -x
- # Download
- n=0
- for Source in "$Source0" "$Source1"; do
- File="${Source##*/}"
- eval File$n=\"\$File\"
- n=$(( $n + 1 ))
- [ -e "$File" ] || curl -kLo "$File" "$Source"
- done
- # Unpack
- n=0
- for File in "$File0" "$File1"; do
- Dir="${File%.tar.xz}"
- eval Dir$n=\"\$Dir\"
- n=$(( $n + 1 ))
- [ -e "$Dir" ] || tar Jxf "$File"
- done
- # Prep
- [ -e "$Dir0/tools/clang" ] || ln -sf "../../$Dir1" "$Dir0/tools/clang"
- [ -e "$Dir0/build" ] || mkdir "$Dir0/build"
- cd "$Dir0"
- # Build
- cd build
- [ -e Makefile ] || cmake .. \
- -DBUILD_SHARED_LIBS=OFF \
- -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
- -DLIBCLANG_BUILD_STATIC=ON \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DLLVM_LIBDIR_SUFFIX= \
- -DCLANG_BUILD_EXAMPLES=OFF \
- -DCLANG_INCLUDE_DOCS=OFF \
- -DCLANG_INCLUDE_TESTS=OFF \
- -DLLVM_APPEND_VC_REV=OFF \
- -DLLVM_BUILD_DOCS=OFF \
- -DLLVM_BUILD_EXAMPLES=OFF \
- -DLLVM_BUILD_TESTS=OFF \
- -DLLVM_BUILD_TOOLS=ON \
- -DLLVM_ENABLE_ASSERTIONS=OFF \
- -DLLVM_ENABLE_CXX1Y=ON \
- -DLLVM_ENABLE_EH=ON \
- -DLLVM_ENABLE_LIBCXX=OFF \
- -DLLVM_ENABLE_PIC=ON \
- -DLLVM_ENABLE_RTTI=ON \
- -DLLVM_ENABLE_SPHINX=OFF \
- -DLLVM_ENABLE_TERMINFO=OFF \
- -DLLVM_INCLUDE_DOCS=OFF \
- -DLLVM_INCLUDE_EXAMPLES=OFF \
- -DLLVM_INCLUDE_GO_TESTS=OFF \
- -DLLVM_INCLUDE_TESTS=OFF \
- -DLLVM_INCLUDE_TOOLS=ON \
- -DLLVM_INCLUDE_UTILS=OFF \
- -DLLVM_PARALLEL_LINK_JOBS=1 \
- -DLLVM_TARGETS_TO_BUILD="host;BPF"
- [ -e lib/libbenchmark_main.a ] || make
- # Install
- if [ ! -e /usr/lib/libclang.a ]; then
- make install
- cp lib/libclang.a /usr/lib/libclang.a
- /sbin/ldconfig
- fi
- # Done
- : Success1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement