2021-06-10 20:38:00 +03:00
|
|
|
#!/usr/bin/env -S bash ../.port_include.sh
|
|
|
|
port=llvm
|
|
|
|
useconfigure=true
|
2021-11-21 10:25:51 +03:00
|
|
|
version=13.0.0
|
2021-06-10 20:38:00 +03:00
|
|
|
workdir=llvm-project-llvmorg-${version}
|
2021-09-27 01:16:18 +03:00
|
|
|
configopts=("-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt")
|
2021-11-21 10:25:51 +03:00
|
|
|
files="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.zip llvm.zip 333a4e053fb543d9efb8dc68126d9e7a948ecb246985f2804a0ecbc5ccdb9d08"
|
2021-06-10 20:38:00 +03:00
|
|
|
auth_type=sha256
|
2021-11-21 10:25:51 +03:00
|
|
|
depends=("ncurses" "zlib")
|
2021-06-10 20:38:00 +03:00
|
|
|
|
|
|
|
pre_patch() {
|
|
|
|
host_env
|
|
|
|
mkdir -p llvm-host
|
|
|
|
cmake ${workdir}/llvm \
|
|
|
|
-B llvm-host \
|
|
|
|
-DLLVM_ENABLE_PROJECTS=clang
|
|
|
|
make -C llvm-host -j $(nproc) llvm-tblgen clang-tblgen
|
|
|
|
target_env
|
|
|
|
}
|
|
|
|
|
|
|
|
configure() {
|
2021-11-21 10:25:51 +03:00
|
|
|
if [ "$SERENITY_TOOLCHAIN" = "Clang" ]; then
|
|
|
|
stdlib=""
|
|
|
|
unwindlib=""
|
|
|
|
else
|
|
|
|
stdlib="libstdc++"
|
|
|
|
unwindlib="libgcc"
|
|
|
|
fi
|
2021-06-10 20:38:00 +03:00
|
|
|
mkdir -p llvm-build
|
|
|
|
cmake ${workdir}/llvm \
|
2021-11-21 10:25:51 +03:00
|
|
|
-G Ninja \
|
2021-09-27 01:16:18 +03:00
|
|
|
-B llvm-build "${configopts[@]}" \
|
2021-06-10 20:38:00 +03:00
|
|
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
2021-11-21 10:25:51 +03:00
|
|
|
-DCMAKE_FIND_ROOT_PATH="$SERENITY_BUILD_DIR"/Root \
|
|
|
|
-DCLANG_DEFAULT_CXX_STDLIB=$stdlib \
|
|
|
|
-DCLANG_DEFAULT_UNWINDLIB=$unwindlib \
|
|
|
|
-DCLANG_TABLEGEN=$(pwd)/llvm-host/bin/clang-tblgen \
|
|
|
|
-DCOMPILER_RT_BUILD_CRT=ON \
|
|
|
|
-DCOMPILER_RT_BUILD_ORC=OFF \
|
|
|
|
-DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=OFF \
|
|
|
|
-DCOMPILER_RT_OS_DIR=serenity \
|
|
|
|
-DHAVE_LIBRT=OFF \
|
|
|
|
-DLLVM_DEFAULT_TARGET_TRIPLE=$SERENITY_ARCH-pc-serenity \
|
2021-06-10 20:38:00 +03:00
|
|
|
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
|
2021-11-21 10:25:51 +03:00
|
|
|
-DLLVM_HAVE_LIBXAR=OFF \
|
2021-06-10 20:38:00 +03:00
|
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
2021-11-21 10:25:51 +03:00
|
|
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
|
|
|
-DLLVM_PTHREAD_LIB=pthread \
|
|
|
|
-DLLVM_TABLEGEN=$(pwd)/llvm-host/bin/llvm-tblgen \
|
|
|
|
-DLLVM_TARGETS_TO_BUILD=X86
|
2021-06-10 20:38:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2021-11-21 10:25:51 +03:00
|
|
|
ninja -C llvm-build
|
2021-06-10 20:38:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
install() {
|
2021-11-21 10:25:51 +03:00
|
|
|
ninja -C llvm-build install
|
2021-06-10 20:38:00 +03:00
|
|
|
}
|