Last active
February 22, 2018 15:56
-
-
Save danmack/c4be9c3b36763b0fe374823fe23f0b54 to your computer and use it in GitHub Desktop.
another script to build llvm clang and friends
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
#!/bin/bash | |
# because building llvm/clang docs are bad (based on someone's blog post) | |
# don't forget commonly missed pre-reqs: | |
# - ncurses-devel, libxml2-devel, python, cmake, libedit-devel | |
version=5.0.1 | |
base="llvm" | |
bits="cfe libcxx libcxxabi libunwind lldb clang-tools-extra" | |
echo -n "fetching " | |
for part in ${base} ${bits} ; do | |
xzfile=${part}-${version}.src.tar.xz | |
echo -n "${part}[" | |
wget -qt inf -c https://releases.llvm.org/${version}/${xzfile} | |
echo -n "d" | |
tar xJf ${xzfile} | |
echo "x]" | |
echo -n " " | |
done | |
echo "" | |
echo "download and untars complete" | |
sleep 5 | |
ztop=${base}-${version}.src | |
echo TOP=$ztop | |
echo "Getting ready to build ... organizing ..." | |
mv -v cfe-${version}.src ${ztop}/tools/clang | |
mv -v clang-tools-extra-${version}.src ${ztop}/tools/clang/tools/extra | |
mv -v libcxx-${version}.src ${ztop}/projects/libcxx | |
mv -v libcxxabi-${version}.src ${ztop}/projects/libcxxabi | |
mv -v libunwind-${version}.src ${ztop}/projects/libunwind | |
mv -v lldb-${version}.src ${ztop}/tools/lldb | |
echo "src re-org complete" | |
sleep 5 | |
# | |
# configure and build | |
# | |
pyinc=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") | |
pylib=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") | |
echo "doing all the builds..." | |
echo "" | |
mkdir ${ztop}/build | |
cd ${ztop}/build | |
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=/opt/px \ | |
-DPYTHON_INCLUDE_DIR=${pyinc} -DPYTHON_LIBRARY=${pylib} \ | |
-DLLVM_TARGETS_TO_BUILD=X86 .. | |
make -j 4 | |
make install | |
echo "build complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment