50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
# Description: LLVM compiler backend
|
|
# URL: https://llvm.org/
|
|
# Maintainer: CRUX System Team, core-ports at crux dot nu
|
|
# Depends on: cmake libxml2 ninja
|
|
|
|
name=llvm
|
|
version=12.0.1
|
|
release=2
|
|
source=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/llvm-$version.src.tar.xz
|
|
llvm-config.h
|
|
x86-twist-shuffle-mask.patch)
|
|
|
|
build() {
|
|
# https://reviews.llvm.org/D104903
|
|
# https://bugs.llvm.org/show_bug.cgi?id=50823
|
|
patch -d $name-$version.src -p2 -i $SRC/x86-twist-shuffle-mask.patch
|
|
|
|
export CC=gcc
|
|
export CXX=g++
|
|
|
|
cmake -S $name-$version.src -B build -G Ninja \
|
|
-D CMAKE_INSTALL_PREFIX=/usr \
|
|
-D CMAKE_BUILD_TYPE=Release \
|
|
-D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
|
|
-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
|
|
-D LLVM_TARGETS_TO_BUILD='X86;AMDGPU;BPF;NVPTX' \
|
|
-D LLVM_BINUTILS_INCDIR=/usr/include \
|
|
-D LLVM_BUILD_LLVM_DYLIB=1 \
|
|
-D LLVM_LINK_LLVM_DYLIB=1 \
|
|
-D LLVM_PARALLEL_COMPILE_JOBS="${JOBS:-1}" \
|
|
-D LLVM_INCLUDE_EXAMPLES=0 \
|
|
-D LLVM_INCLUDE_TESTS=0 \
|
|
-D LLVM_ENABLE_FFI=1 \
|
|
-D LLVM_ENABLE_RTTI=1 \
|
|
-D LLVM_ENABLE_OCAMLDOC=0 \
|
|
-D LLVM_INSTALL_UTILS=1 \
|
|
-Wno-dev
|
|
|
|
cmake --build build
|
|
DESTDIR=$PKG cmake --install build
|
|
|
|
# multilib stub
|
|
mv $PKG/usr/include/llvm/Config/llvm-config{,-64}.h
|
|
install -m 0644 $SRC/llvm-config.h $PKG/usr/include/llvm/Config/
|
|
|
|
install -d $PKG/usr/lib/bfd-plugins
|
|
ln -s ../LLVMgold.so $PKG/usr/lib/bfd-plugins/
|
|
ln -s ../libLTO.so $PKG/usr/lib/bfd-plugins/
|
|
}
|