Skip to content

Instantly share code, notes, and snippets.

@androm3da
Created February 15, 2017 21:42
Show Gist options
  • Save androm3da/bb5dcd767ef53d7d77b221c4fecc7e04 to your computer and use it in GitHub Desktop.
Save androm3da/bb5dcd767ef53d7d77b221c4fecc7e04 to your computer and use it in GitHub Desktop.
build clang
#!/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}
#!/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