From 85b26111db89af51bd7755ce6e6e139276f9efaf Mon Sep 17 00:00:00 2001 From: Niclas Hofmann Date: Thu, 25 Apr 2024 15:53:17 +0200 Subject: [PATCH] llvm: enable clang-tools-extra and simplify build Enabling clang-tools-extra also builds for example clangd clang-format. Building in release-mode reduces binary sizes dramatically. --- llvm-17.0.6-1.build.sh | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 llvm-17.0.6-1.build.sh diff --git a/llvm-17.0.6-1.build.sh b/llvm-17.0.6-1.build.sh new file mode 100755 index 0000000..257cc07 --- /dev/null +++ b/llvm-17.0.6-1.build.sh @@ -0,0 +1,61 @@ +#! /bin/bash + +PKG=llvm +VERSION=17.0.6 +BUILD=1 + +# SRCURL="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$VERSION.tar.gz" +SRCURL="https://beehive.molgen.mpg.de/07322a7bacd6b892cba93c1502f24b49/llvmorg-17.0.6.tar.gz" + +PREFIX=/pkg/$PKG-$VERSION-$BUILD +if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi + +set -xe +umask 022 + +BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp +test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR ) +mkdir -p $BUILD_TMPDIR/home +export TMPDIR=$BUILD_TMPDIR +export HOME=$BUILD_TMPDIR/home + +exec $PREFIX/profile <<-EOF + PATH=$PREFIX/bin:\$PATH + export LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} + if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi +EOF +. $PREFIX/profile + +export MAKEFLAGS="-j $(nproc)" + +BUILDDIR=$PREFIX/build + +mkdir -p $BUILDDIR +cd $BUILDDIR + +test -e llvmorg-$VERSION.tar.gz || wget $SRCURL +test -d llvm-$VERSION || (mkdir llvm-$VERSION; tar xvf llvmorg-$VERSION.tar.gz -C llvm-$VERSION --strip-components 1) +cd llvm-$VERSION + +mkdir -p build +cmake \ + -S llvm \ + -B build \ + -G Ninja \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_TARGETS_TO_BUILD="all" \ + -Wno-dev + +cmake --build build/ +cmake --install build/ + +exit