diff --git a/mk/prefix.mk b/mk/prefix.mk index 664090a0e1..d8378873cb 100644 --- a/mk/prefix.mk +++ b/mk/prefix.mk @@ -493,6 +493,22 @@ endif cp -r "$(CLANG_TARGET)/stage/usr/". "$@.partial" cp -r "$(LLD_TARGET)/stage/usr/". "$@.partial" mv "$@.partial" "$@" +# Propagate the freshly-built host LLVM (which now carries the AMDGPU + NVPTX GPU +# backends per recipes/dev/llvm21) into the redoxer toolchain. The Mesa build +# reads a host llvm-config through bin/x86_64-unknown-redox-llvm-config, which +# execs $COOKBOOK_HOST_SYSROOT/bin/llvm-config (= this toolchain). The toolchain +# ships a downloaded X86-only LLVM, so without this sync mesa's +# dependency('llvm', modules: [... amdgpu ...]) reports amdgpu(missing) and the +# GPU driver build fails. rsync WITHOUT --delete so the toolchain's gcc/rust and +# redox-target files are preserved; only the (same-version, 21.1.2) LLVM +# binaries/libs/headers/cmake are updated to the AMDGPU/NVPTX build. + @REDOXER_TC=$(HOME)/.redoxer/$(TARGET)/toolchain; \ + if [ -d "$$REDOXER_TC/bin" ]; then \ + rsync -a "$@/bin/llvm-config" "$$REDOXER_TC/bin/llvm-config"; \ + rsync -a "$@/lib/" "$$REDOXER_TC/lib/"; \ + rsync -a "$@/include/llvm" "$@/include/llvm-c" "$$REDOXER_TC/include/" 2>/dev/null || true; \ + echo " [toolchain] synced AMDGPU/NVPTX host LLVM into redoxer toolchain"; \ + fi # no longer needed, delete build files to save disk space rm -rf $(LLVM_TARGET) $(CLANG_TARGET) $(LLD_TARGET) endif