From e23a0e5e2d34c9c628773bfa21efa56ad951f03c Mon Sep 17 00:00:00 2001 From: heitbaum Date: Sat, 19 Jun 2021 05:31:08 +0000 Subject: [PATCH] rust: update to 1.54.0 and enable host cross compiles Until target-applies-to-host is incorporated into stable this "target-applies-to-host" option is required for a matching host-target triple to be compiled by the cross compiler. Read more here: https://doc.rust-lang.org/cargo/reference/unstable.html#target-applies-to-host When rust-lang/cargo merges the following and it is released - then this "rust" package will need to be revisted if it is bumped. - Stabilize target-applies-to-host feature. #9753 The following are the rust-lang/cargo PRs that made this possible: - Configure hosts separately from targets when --target is specified. #9322 - Tracking Issue for target-applies-to-host #9453 --- .../librespot-depends/rust/package.mk | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/addons/addon-depends/librespot-depends/rust/package.mk b/packages/addons/addon-depends/librespot-depends/rust/package.mk index 34ddd50ee5..4e53c3a3ab 100644 --- a/packages/addons/addon-depends/librespot-depends/rust/package.mk +++ b/packages/addons/addon-depends/librespot-depends/rust/package.mk @@ -2,7 +2,7 @@ # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rust" -PKG_VERSION="1.50.0" +PKG_VERSION="1.54.0" PKG_LICENSE="MIT" PKG_SITE="https://www.rust-lang.org" PKG_DEPENDS_TARGET="toolchain rustup.rs" @@ -25,11 +25,13 @@ make_target() { ;; esac "$(get_build_dir rustup.rs)/rustup-init.sh" \ - --default-toolchain "${PKG_VERSION}" \ + --default-toolchain none \ --no-modify-path \ --profile minimal \ --target "${RUST_TARGET_TRIPLE}" \ -y + cargo/bin/rustup toolchain install ${PKG_VERSION} --allow-downgrade --profile minimal --component clippy + cargo/bin/rustup target add ${RUST_TARGET_TRIPLE} cat <"${CARGO_HOME}/config" [build] @@ -43,6 +45,15 @@ EOF cat <"${CARGO_HOME}/env" export CARGO_HOME="${CARGO_HOME}" export CARGO_TARGET_DIR="\${PKG_BUILD}/.\${TARGET_NAME}" +if [ "${HOSTTYPE}" = "${TARGET_ARCH}" ]; then + # Until target-applies-to-host is incorporated into stable this + # option is required for a matching host-target triple to be compiled + # by the cross compiler. Read more here. + # https://doc.rust-lang.org/cargo/reference/unstable.html#target-applies-to-host + export __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" + export CARGO_TARGET_APPLIES_TO_HOST="false" + export CARGO_Z_TARGET_APPLIES_TO_HOST="-Z target-applies-to-host" +fi export PATH="${CARGO_HOME}/bin:${PATH}" export PKG_CONFIG_ALLOW_CROSS="1" export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}"