Last active
August 1, 2019 02:51
-
-
Save Leedehai/ff9f96802524c99013c43ac962dde59d to your computer and use it in GitHub Desktop.
Build LLVM/Clang on Linux/macOS from scratch (CMake required)
This file contains 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
#!/usr/bin/env sh | |
echo About to build LLVM/Clang.. Are you sure \(y/N\)? | |
read consent | |
if [ $consent != 'y' ] && [ $consent != 'Y' ]; then | |
echo Aborted | |
exit 1 | |
fi | |
echo Start downloading > time.log | |
date >> time.log | |
echo "Downloading llvm source.." | |
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm > /dev/null | |
echo "Downloading clang source.." | |
cd llvm/tools > /dev/null | |
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang > /dev/null | |
cd ../.. > /dev/null | |
echo "Downloading clang extra tools source.." | |
cd llvm/tools/clang/tools > /dev/null | |
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra > /dev/null | |
cd ../../../.. > /dev/null | |
echo "Done downloading." | |
date >> time.log | |
echo Start pre-building >> time.log | |
date >> time.log | |
mkdir build | |
cd build > /dev/null | |
cmake -G "Unix Makefiles" ../llvm | |
date >> ../time.log | |
echo Start building >> ../time.log | |
date >> ../time.log | |
make # builds both LLVM and Clang for debug mode. | |
# For subsequent Clang development, you can just run: make clang. | |
date >> ../time.log | |
echo Done. && cat ../time.log | |
# If you intend to use Clang's C++ support, use the -DGCC_INSTALL_PREFIX | |
# cmake option to tell Clang where the gcc containing the desired libstdc++ | |
# is installed | |
# Run the testsuite: make check-clang |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now you can build LLVM/Clang using GN + Ninja as well, reportedly much faster, but is not official: llvm/utils/gn
GN and Ninja were developed to facilitate Chromium dev.