Created
February 15, 2017 21:42
-
-
Save androm3da/8d61fdb707dd77d610c5cb11a7049f77 to your computer and use it in GitHub Desktop.
build clang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
CC="clang" | |
CXX="clang++" | |
SRCTOP=$(readlink -f ${PWD}) | |
INSTALL=${SRCTOP}/install | |
if [[ ! -d ${SRCTOP}/llvm ]]; then | |
echo Expected to find the source in ${SRCTOP}/llvm but it is missing | |
exit 3 | |
fi | |
HAS_AVX=$(egrep -c '^flags.*\bavx\b' /proc/cpuinfo) | |
#ignore: covered by -march=native | |
if [[ ${HAS_AVX} != 0 ]]; then | |
AVX_FLAG="-mavx" | |
fi | |
build() | |
{ | |
mkdir -p obj | |
cd obj | |
cmake -G Ninja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_C_COMPILER=${CC} \ | |
-DCMAKE_CXX_COMPILER=${CXX} \ | |
-DCMAKE_CXX_FLAGS="-march=native -O3" \ | |
-DCMAKE_C_FLAGS="-march=native -O3" \ | |
-DCMAKE_INSTALL_PREFIX=${INSTALL} \ | |
-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \ | |
-DLLVM_USE_LINKER=gold \ | |
-DLLVM_TARGETS_TO_BUILD="X86" \ | |
-DLLVM_PARALLEL_LINK_JOBS:INT=6 \ | |
${SRCTOP}/llvm | |
\time ninja | |
\time ninja install | |
} | |
build 2>&1 | tee build.log | |
du -hs ${INSTALL} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
git clone https://github.com/llvm-mirror/llvm/ | |
git clone -q https://github.com/llvm-mirror/clang/ llvm/tools/clang & | |
git clone -q https://github.com/llvm-mirror/compiler-rt/ llvm/projects/compiler-rt & | |
git clone -q https://github.com/llvm-mirror/libcxx/ llvm/projects/libcxx & | |
git clone -q https://github.com/llvm-mirror/libcxxabi/ llvm/projects/libcxxabi & | |
wait | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment