mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
Toolchain+Ports: Update LLVM to 14.0.1
Besides a version bump, the following changes have been made to our toolchain infrastructure: - LLVM/Clang is now built with -march=native if the host compiler supports it. An exception to this is CI, as the toolchain cache is shared among many different machines there. - The LLVM tarball is not re-extracted if the hash of the applied patches doesn't differ. - The patches have been split up into atomic chunks. - Port-specific patches have been integrated into the main patches, which will aid in the work towards self-hosting. - <sysroot>/usr/local/lib is now appended to the linker's search path by default. - --pack-dyn-relocs=relr is appended to the linker command line by default, meaning ports take advantage of RELR relocations without any patches or additional compiler flags. The formatting of LLVM port's package.sh has been bothering me, so I also indented the arguments to the CMake invocation.
This commit is contained in:
parent
9a898df1cd
commit
01b31d9858
22 changed files with 664 additions and 1007 deletions
|
@ -1,54 +1,52 @@
|
|||
#!/usr/bin/env -S bash ../.port_include.sh
|
||||
port=llvm
|
||||
useconfigure=true
|
||||
version=13.0.0
|
||||
workdir=llvm-project-llvmorg-${version}
|
||||
version=14.0.1
|
||||
workdir=llvm-project-${version}.src
|
||||
configopts=("-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt")
|
||||
files="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.zip llvm.zip 333a4e053fb543d9efb8dc68126d9e7a948ecb246985f2804a0ecbc5ccdb9d08"
|
||||
files="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz llvm-project-${version}.src.tar.xz 1a3c2e57916c5a70153aaf0a0e6f1230d6368b9e0f4d04dcb9e039a31b1cd4e6"
|
||||
auth_type=sha256
|
||||
depends=("ncurses" "zlib")
|
||||
|
||||
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() {
|
||||
# The cross compilers will be picked up from the CMake toolchain file.
|
||||
# CC/CXX must point to the host compiler to let it build host tools (tblgen).
|
||||
host_env
|
||||
|
||||
if [ "$SERENITY_TOOLCHAIN" = "Clang" ]; then
|
||||
stdlib=""
|
||||
unwindlib=""
|
||||
exclude_atomic_builtin="OFF"
|
||||
else
|
||||
stdlib="libstdc++"
|
||||
unwindlib="libgcc"
|
||||
# Atomic builtins can't be cross-compiled with GCC. Use the libatomic port
|
||||
# if the program you're building has references to symbols like __atomic_load.
|
||||
exclude_atomic_builtin="ON"
|
||||
fi
|
||||
|
||||
mkdir -p llvm-build
|
||||
cmake ${workdir}/llvm \
|
||||
-G Ninja \
|
||||
-B llvm-build "${configopts[@]}" \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-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 \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
|
||||
-DLLVM_HAVE_LIBXAR=OFF \
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
||||
-DLLVM_PTHREAD_LIB=pthread \
|
||||
-DLLVM_TABLEGEN=$(pwd)/llvm-host/bin/llvm-tblgen \
|
||||
-DLLVM_TARGETS_TO_BUILD=X86
|
||||
-G Ninja \
|
||||
-B llvm-build "${configopts[@]}" \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_FIND_ROOT_PATH="$SERENITY_BUILD_DIR"/Root \
|
||||
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_C_COMPILER=$CC;-DCMAKE_CXX_COMPILER=$CXX" \
|
||||
-DCLANG_DEFAULT_CXX_STDLIB=$stdlib \
|
||||
-DCLANG_DEFAULT_UNWINDLIB=$unwindlib \
|
||||
-DCOMPILER_RT_BUILD_CRT=ON \
|
||||
-DCOMPILER_RT_BUILD_ORC=OFF \
|
||||
-DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=$exclude_atomic_builtin \
|
||||
-DCOMPILER_RT_OS_DIR=serenity \
|
||||
-DHAVE_LIBRT=OFF \
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE=$SERENITY_ARCH-pc-serenity \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
|
||||
-DLLVM_HAVE_LIBXAR=OFF \
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
||||
-DLLVM_PTHREAD_LIB=pthread \
|
||||
-DLLVM_TARGETS_TO_BUILD=X86
|
||||
}
|
||||
|
||||
build() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue