ladybird/Ports/llvm/package.sh
Daniel Bertalan 01b31d9858 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.
2022-04-23 10:43:32 -07:00

59 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env -S bash ../.port_include.sh
port=llvm
useconfigure=true
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/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz llvm-project-${version}.src.tar.xz 1a3c2e57916c5a70153aaf0a0e6f1230d6368b9e0f4d04dcb9e039a31b1cd4e6"
auth_type=sha256
depends=("ncurses" "zlib")
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 \
-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() {
ninja -C llvm-build
}
install() {
ninja -C llvm-build install
}