llvm10: fix host triplet being wrong in cross builds

LLVM_HOST_TRIPLE is the triplet that llvm will be run on (build
is the build machine, host is the execution machine, target is
what it compiles for). This was not being set (only target was)
so it would default to the build machine.

This would result in issues with e.g. llvmpipe in mesa, which
would try to use the host triple to generate for, and subsequently
fail.

While at it, make sure not to clutter builddir when lldb is
unavailable.

Fixes https://github.com/void-linux/void-packages/issues/13896
This commit is contained in:
q66 2020-08-01 05:06:28 +02:00
parent d2ac638a7a
commit 56e5ac1249

View file

@ -1,7 +1,7 @@
# Template file for 'llvm10' # Template file for 'llvm10'
pkgname=llvm10 pkgname=llvm10
version=10.0.0 version=10.0.0
revision=3 revision=4
wrksrc="llvm-${version}.src" wrksrc="llvm-${version}.src"
build_style=cmake build_style=cmake
configure_args=" configure_args="
@ -103,8 +103,12 @@ post_patch() {
mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
fi fi
# Move lldb files into the llvm source. # Move lldb files into the llvm source.
if [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb if [ "$_lldb_enable" = "yes" ]; then
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
else
rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
fi
fi fi
# Move compiler-rt files into the llvm source. # Move compiler-rt files into the llvm source.
if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
@ -156,6 +160,7 @@ pre_configure() {
ppc*) _arch="PowerPC";; ppc*) _arch="PowerPC";;
esac esac
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}" configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
} }