blob: 79f84088f59bdb322fc79d56fe7dfb20191f9d8d (
plain)
1 # Description: LLVM compiler backend
2 # URL: https://llvm.org/
3 # Maintainer: CRUX System Team, core-ports at crux dot nu
4 # Depends on: cmake libffi libxml2 ninja python3-setuptools
5 # Optional: lld
6
7 name=llvm
8 version=15.0.6
9 release=1
10 source=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/llvm-$version.src.tar.xz
11 https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/cmake-$version.src.tar.xz
12 llvm-config.h)
13
14 build() {
15 prt-get isinst ccache && PKGMK_LLVM+=' -D LLVM_CCACHE_BUILD=ON' && \
16 export PATH="$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')"
17
18 cp -r $SRC/cmake-$version.src/Modules/* $name-$version.src/cmake/modules/.
19
20 cmake -S $name-$version.src -B build -G Ninja $PKGMK_LLVM \
21 -D CMAKE_INSTALL_PREFIX=/usr \
22 -D CMAKE_BUILD_TYPE=Release \
23 -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
24 -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
25 -D LLVM_BINUTILS_INCDIR=/usr/include \
26 -D LLVM_BUILD_LLVM_DYLIB=ON \
27 -D LLVM_LINK_LLVM_DYLIB=ON \
28 -D LLVM_PARALLEL_COMPILE_JOBS="${JOBS:-1}" \
29 -D LLVM_INCLUDE_EXAMPLES=OFF \
30 -D LLVM_INCLUDE_TESTS=OFF \
31 -D LLVM_ENABLE_FFI=ON \
32 -D LLVM_ENABLE_RTTI=ON \
33 -D LLVM_ENABLE_OCAMLDOC=OFF \
34 -D LLVM_INSTALL_UTILS=ON \
35 -D LLVM_ENABLE_LIBCXX=OFF \
36 -D LLVM_ENABLE_LLD="$(prt-get isinst lld >/dev/null && echo ON || echo OFF)" \
37 -D LLVM_OPTIMIZED_TABLEGEN=ON \
38 -D LLVM_INCLUDE_BENCHMARKS=OFF \
39 -Wno-dev
40
41 cmake --build build
42 DESTDIR=$PKG cmake --install build
43
44 # multilib stub
45 mv $PKG/usr/include/llvm/Config/llvm-config{,-64}.h
46 install -m 0644 $SRC/llvm-config.h $PKG/usr/include/llvm/Config/
47
48 install -d $PKG/usr/lib/bfd-plugins
49 ln -s ../LLVMgold.so $PKG/usr/lib/bfd-plugins/
50 ln -s ../libLTO.so $PKG/usr/lib/bfd-plugins/
51
52 /usr/bin/python3 $name-$version.src/utils/lit/setup.py build
53 /usr/bin/python3 $name-$version.src/utils/lit/setup.py install --prefix=/usr --root=$PKG
54 /usr/bin/python3 -m compileall -d $name-$version.src/utils/lit $PKG
55 /usr/bin/python3 -O -m compileall -d $name-$version.src/utils/lit $PKG
56 /usr/bin/python3 -OO -m compileall -d $name-$version.src/utils/lit $PKG
57 }
|