guix: consolidate LLVM toolchain setup

This commit is contained in:
fanquake
2026-07-23 14:19:06 +01:00
parent b12a70f330
commit cc9b0f2266
3 changed files with 20 additions and 30 deletions

View File

@@ -8,21 +8,8 @@ set -o errexit -o pipefail
# shellcheck source=setup.sh
source "$(dirname "${BASH_SOURCE[0]}")/setup.sh"
# Set toolchain
CLANG_TOOLCHAIN="$(store_path clang-toolchain)"
LIBCXX="$(store_path libcxx)"
build_CC="${CLANG_TOOLCHAIN}/bin/clang \
-isystem ${CLANG_TOOLCHAIN}/include"
build_CXX="${CLANG_TOOLCHAIN}/bin/clang++ \
-stdlib=libc++ \
-isystem ${LIBCXX}/include/c++/v1 \
-isystem ${CLANG_TOOLCHAIN}/include"
build_LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -L${LIBCXX}/lib -Wl,-rpath,${LIBCXX}/lib"
build_AR="${CLANG_TOOLCHAIN}/bin/llvm-ar"
build_RANLIB="${CLANG_TOOLCHAIN}/bin/llvm-ranlib"
build_OBJDUMP="${CLANG_TOOLCHAIN}/bin/llvm-objdump"
build_NM="${CLANG_TOOLCHAIN}/bin/llvm-nm"
build_STRIP="${CLANG_TOOLCHAIN}/bin/llvm-strip"
# Setup toolchain
llvm_toolchain
# Build the depends tree
make -C depends --jobs="$JOBS" HOST="$HOST" \

View File

@@ -8,21 +8,8 @@ set -o errexit -o pipefail
# shellcheck source=setup.sh
source "$(dirname "${BASH_SOURCE[0]}")/setup.sh"
# Set toolchain
CLANG_TOOLCHAIN="$(store_path clang-toolchain)"
LIBCXX="$(store_path libcxx)"
build_CC="${CLANG_TOOLCHAIN}/bin/clang \
-isystem ${CLANG_TOOLCHAIN}/include"
build_CXX="${CLANG_TOOLCHAIN}/bin/clang++ \
-stdlib=libc++ \
-isystem ${LIBCXX}/include/c++/v1 \
-isystem ${CLANG_TOOLCHAIN}/include"
build_LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -L${LIBCXX}/lib -Wl,-rpath,${LIBCXX}/lib"
build_AR="${CLANG_TOOLCHAIN}/bin/llvm-ar"
build_RANLIB="${CLANG_TOOLCHAIN}/bin/llvm-ranlib"
build_OBJDUMP="${CLANG_TOOLCHAIN}/bin/llvm-objdump"
build_NM="${CLANG_TOOLCHAIN}/bin/llvm-nm"
build_STRIP="${CLANG_TOOLCHAIN}/bin/llvm-strip"
# Setup toolchain
llvm_toolchain
# Build the depends tree
make -C depends --jobs="$JOBS" HOST="$HOST" \

View File

@@ -86,6 +86,22 @@ glibc_dynamic_linker() {
esac
}
llvm_toolchain() {
local CLANG_TOOLCHAIN LIB_CXX
CLANG_TOOLCHAIN="$(store_path clang-toolchain)"
LIB_CXX="$(store_path libcxx)"
export build_CC="${CLANG_TOOLCHAIN}/bin/clang -isystem ${CLANG_TOOLCHAIN}/include"
export build_CXX="${CLANG_TOOLCHAIN}/bin/clang++ -stdlib=libc++ -isystem ${LIB_CXX}/include/c++/v1 -isystem ${CLANG_TOOLCHAIN}/include"
export build_LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -L${LIB_CXX}/lib -Wl,-rpath,${LIB_CXX}/lib"
export build_AR="${CLANG_TOOLCHAIN}/bin/llvm-ar"
export build_RANLIB="${CLANG_TOOLCHAIN}/bin/llvm-ranlib"
export build_OBJDUMP="${CLANG_TOOLCHAIN}/bin/llvm-objdump"
export build_NM="${CLANG_TOOLCHAIN}/bin/llvm-nm"
export build_STRIP="${CLANG_TOOLCHAIN}/bin/llvm-strip"
}
# Disable Guix ld auto-rpath behavior
export GUIX_LD_WRAPPER_DISABLE_RPATH=yes