Advertisement
devinteske

Build llvm-clang on Ubuntu 14.04.6 LTS, Trusty Tahr

Mar 23rd, 2020
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.04 KB | None | 0 0
  1. #!/bin/sh
  2. maj_ver=8
  3. min_ver=0
  4. patch_ver=0
  5. version=${maj_ver}.${min_ver}.${patch_ver}
  6.  
  7. #?apt-get install -y zlib1g-dev libncurses5-dev bison cmake3 flex make \
  8. #?        libxml2-dev libelf-dev curl
  9.  
  10. Source0=http://llvm.org/releases/${version}/llvm-${version}.src.tar.xz
  11. Source1=http://llvm.org/releases/${version}/cfe-${version}.src.tar.xz
  12.  
  13. set -e
  14. set -x
  15.  
  16. # Download
  17. n=0
  18. for Source in "$Source0" "$Source1"; do
  19.         File="${Source##*/}"
  20.         eval File$n=\"\$File\"
  21.         n=$(( $n + 1 ))
  22.         [ -e "$File" ] || curl -kLo "$File" "$Source"
  23. done
  24.  
  25. # Unpack
  26. n=0
  27. for File in "$File0" "$File1"; do
  28.         Dir="${File%.tar.xz}"
  29.         eval Dir$n=\"\$Dir\"
  30.         n=$(( $n + 1 ))
  31.         [ -e "$Dir" ] || tar Jxf "$File"
  32. done
  33.  
  34. # Prep
  35. [ -e "$Dir0/tools/clang" ] || ln -sf "../../$Dir1" "$Dir0/tools/clang"
  36. [ -e "$Dir0/build" ] || mkdir "$Dir0/build"
  37. cd "$Dir0"
  38.  
  39. # Build
  40. cd build
  41. [ -e Makefile ] || cmake .. \
  42.     -DBUILD_SHARED_LIBS=OFF \
  43.     -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
  44.     -DLLVM_BUILD_LLVM_DYLIB=ON \
  45.     -DLIBCLANG_BUILD_STATIC=ON \
  46.     -DCMAKE_BUILD_TYPE=Release \
  47.     -DCMAKE_INSTALL_PREFIX=/usr \
  48.     -DLLVM_LIBDIR_SUFFIX= \
  49.     -DCLANG_BUILD_EXAMPLES=OFF \
  50.     -DCLANG_INCLUDE_DOCS=OFF \
  51.     -DCLANG_INCLUDE_TESTS=OFF \
  52.     -DLLVM_APPEND_VC_REV=OFF \
  53.     -DLLVM_BUILD_DOCS=OFF \
  54.     -DLLVM_BUILD_EXAMPLES=OFF \
  55.     -DLLVM_BUILD_TESTS=OFF \
  56.     -DLLVM_BUILD_TOOLS=ON \
  57.     -DLLVM_ENABLE_ASSERTIONS=OFF \
  58.     -DLLVM_ENABLE_CXX1Y=ON \
  59.     -DLLVM_ENABLE_EH=ON \
  60.     -DLLVM_ENABLE_LIBCXX=OFF \
  61.     -DLLVM_ENABLE_PIC=ON \
  62.     -DLLVM_ENABLE_RTTI=ON \
  63.     -DLLVM_ENABLE_SPHINX=OFF \
  64.     -DLLVM_ENABLE_TERMINFO=OFF \
  65.     -DLLVM_INCLUDE_DOCS=OFF \
  66.     -DLLVM_INCLUDE_EXAMPLES=OFF \
  67.     -DLLVM_INCLUDE_GO_TESTS=OFF \
  68.     -DLLVM_INCLUDE_TESTS=OFF \
  69.     -DLLVM_INCLUDE_TOOLS=ON \
  70.     -DLLVM_INCLUDE_UTILS=OFF \
  71.     -DLLVM_PARALLEL_LINK_JOBS=1 \
  72.     -DLLVM_TARGETS_TO_BUILD="host;BPF"
  73. [ -e lib/libbenchmark_main.a ] || make
  74.  
  75. # Install
  76. if [ ! -e /usr/lib/libclang.a ]; then
  77.         make install
  78.         cp lib/libclang.a /usr/lib/libclang.a
  79.         /sbin/ldconfig
  80. fi
  81.  
  82. # Done
  83. : Success1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement