Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 82 lines (65 sloc) 1.89 KB
#! /bin/bash
PKG=llvm
VERSION=15.0.4
BUILD=0
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 </dev/null
mkdir -p $PREFIX
cat >$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 https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$VERSION.tar.gz
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_llvm
cmake \
-S llvm \
-B build_llvm \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_TARGETS_TO_BUILD="all" \
-Wno-dev
ninja -v -C build_llvm
ninja -v -C build_llvm install
mkdir -p build_clang
cmake \
-S clang \
-B build_clang \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_BUILD_TYPE=Release \
-Wno-dev
ninja -v -C build_clang
ninja -v -C build_clang install
mkdir -p build_lld
cmake \
-S lld \
-B build_lld \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release
ninja -v -C build_lld
ninja -v -C build_lld install
exit