blob: d271e1ec2b1b63510934ce83e9ca70af270244b6 (
plain)
1 # Description: LLVM compiler backend
2 # URL: https://llvm.org
3 # Maintainer: CRUX compat-32 Team, compat-32-ports at crux dot nu
4 # Depends on: libffi-32 libxml2-32 llvm ncurses-32 zstd-32
5
6 name=llvm-32
7 version=15.0.7
8 release=1
9 source=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/llvm-$version.src.tar.xz
10 https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/cmake-$version.src.tar.xz)
11
12 build() {
13 mkdir -p $SRC/keep
14
15 #prt-get isinst ccache && PKGMK_LLVM+=' -D LLVM_CCACHE_BUILD=ON'
16
17 cp -r $SRC/cmake-$version.src/Modules/* llvm-$version.src/cmake/modules/.
18
19 cmake -S llvm-$version.src -B build -G Ninja $PKGMK_LLVM \
20 -D CMAKE_INSTALL_PREFIX=/usr \
21 -D LLVM_LIBDIR_SUFFIX=32 \
22 -D CMAKE_BUILD_TYPE=Release \
23 -D CMAKE_C_FLAGS_RELEASE="-O2 -march=x86-64 -pipe -m32" \
24 -D CMAKE_CXX_FLAGS_RELEASE="-O2 -march=x86-64 -pipe -m32" \
25 -D LLVM_TARGET_ARCH=i686 \
26 -D LLVM_BINUTILS_INCDIR=/usr/include \
27 -D LLVM_BUILD_LLVM_DYLIB=ON \
28 -D LLVM_LINK_LLVM_DYLIB=ON \
29 -D LLVM_PARALLEL_COMPILE_JOBS="${JOBS:-1}" \
30 -D LLVM_INCLUDE_EXAMPLES=OFF \
31 -D LLVM_ENABLE_OCAMLDOC=OFF \
32 -D LLVM_INCLUDE_TESTS=OFF \
33 -D LLVM_ENABLE_FFI=ON \
34 -D LLVM_ENABLE_RTTI=ON \
35 -D LLVM_ENABLE_OCAMLDOC=OFF \
36 -D LLVM_INSTALL_UTILS=ON \
37 -D LLVM_ENABLE_LIBCXX=OFF \
38 -D LLVM_ENABLE_LLD="$(prt-get isinst lld >/dev/null && echo ON || echo OFF)" \
39 -D LLVM_DEFAULT_TARGET_TRIPLE="i686-pc-linux-gnu" \
40 -D LLVM_OPTIMIZED_TABLEGEN=ON \
41 -D LLVM_INCLUDE_BENCHMARKS=OFF \
42 -Wno-dev
43
44 cmake --build build
45 DESTDIR=$PKG cmake --install build
46
47 # keep 32bit header and config
48 install -t $SRC/keep $PKG/usr/bin/llvm-config $PKG/usr/include/llvm/Config/llvm-config.h
49
50 # remove unneeded files
51 rm -r $PKG/usr/{bin,include,share/opt-viewer}
52
53 # install 32bit header and config
54 install -m 0755 -D $SRC/keep/llvm-config $PKG/usr/bin/llvm-config-32
55 install -m 0644 -D $SRC/keep/llvm-config.h $PKG/usr/include/llvm/Config/llvm-config-32.h
56 }
|