rust: use host triplet from env instead of guessing

[ci skip]
This commit is contained in:
q66 2019-02-10 19:09:44 +01:00 committed by maxice8
parent 3c47efa808
commit d283b48c39

View file

@ -97,17 +97,6 @@ else
esac
fi
# In rust terminology 'build' is the build host ($CBUILD) and `target`
# and `host` are the triplets that are supposed to run the built binaries
# ($CTARGET)
case $XBPS_MACHINE in
ppc64le) _build_triplet=powerpc64le-unknown-linux-gnu;;
ppc64le-musl) _build_triplet=powerpc64le-unknown-linux-musl;;
ppc64-musl) _build_triplet=powerpc64-unknown-linux-musl;;
*-musl) _build_triplet=${XBPS_MACHINE%-musl}-unknown-linux-musl;;
*) _build_triplet=${XBPS_MACHINE}-unknown-linux-gnu;;
esac
post_extract() {
if [ -z "$CROSS_BUILD" ]; then
mkdir -p stage0
@ -153,7 +142,7 @@ do_configure() {
--prefix=/usr
--host=${RUST_TARGET}
--target=${RUST_TARGET}
--build=${_build_triplet}
--build=${RUST_BUILD}
--disable-full-bootstrap
--release-channel=stable
--disable-rpath
@ -164,7 +153,7 @@ do_configure() {
if ! [ "$build_option_internal_llvm" ]; then
configure_args+="
--llvm-root=/usr
--set=target.${_build_triplet}.llvm-config=/usr/bin/llvm-config
--set=target.${RUST_BUILD}.llvm-config=/usr/bin/llvm-config
--set=target.${RUST_TARGET}.llvm-config=/usr/bin/llvm-config
--enable-llvm-link-shared
"
@ -178,10 +167,10 @@ do_configure() {
# Set the appropriate values for the native compilation tools
configure_args+="
--set=target.${_build_triplet}.cc=${CC_host}
--set=target.${_build_triplet}.cxx=${CXX_host}
--set=target.${_build_triplet}.ar=${AR_host}
--set=target.${_build_triplet}.linker=${CC_host}
--set=target.${RUST_BUILD}.cc=${CC_host}
--set=target.${RUST_BUILD}.cxx=${CXX_host}
--set=target.${RUST_BUILD}.ar=${AR_host}
--set=target.${RUST_BUILD}.linker=${CC_host}
"
else
configure_args+=" --local-rust-root=$wrksrc/stage0"
@ -210,7 +199,7 @@ pre_build() {
# of the cross host.
# Unset LDFLAGS, otherwise cross builds to the same arch will fail
do_build() {
env CFLAGS_${_build_triplet}="${CFLAGS_host}" LDFLAGS='' make ${makejobs} ${make_build_args}
env CFLAGS_${RUST_BUILD}="${CFLAGS_host}" LDFLAGS='' make ${makejobs} ${make_build_args}
}
do_install() {