From b287b66c83676fc40da20ef26ecd87d1b98a83cb Mon Sep 17 00:00:00 2001 From: maxice8 Date: Mon, 21 Jan 2019 01:48:30 -0200 Subject: [PATCH] build-helper/rust.sh: Add --- common/build-helper/rust.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 common/build-helper/rust.sh diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh new file mode 100644 index 00000000000..550171e068a --- /dev/null +++ b/common/build-helper/rust.sh @@ -0,0 +1,33 @@ +# Define equivalent of TOML config in environment +# [build] +# jobs = $XBPS_MAKEJOBS +export CARGO_BUILD_JOBS="$XBPS_MAKEJOBS" + +if [ "$CROSS_BUILD" ]; then + # Define equivalent of TOML config in environment + # [target.${RUST_TARGET}] + # linker = ${CC} + _XBPS_CROSS_RUST_TARGET_ENV="${XBPS_CROSS_RUST_TARGET^^}" + _XBPS_CROSS_RUST_TARGET_ENV="${_XBPS_CROSS_RUST_TARGET_ENV//-/_}" + export CARGO_TARGET_${_XBPS_CROSS_RUST_TARGET_ENV}_LINKER="$CC" + unset _XBPS_CROSS_RUST_TARGET_ENV + + # Define equivalent of TOML config in environment + # [build] + # target = ${RUST_TARGET} + export CARGO_BUILD_TARGET="$RUST_TARGET" +fi + +# For cross-compiling rust -sys crates +export PKG_CONFIG_ALLOW_CROSS=1 + +# libgit2-sys +export LIBGIT2_SYS_USE_PKG_CONFIG=1 + +# gettext-rs +export GETTEXT_BIN_DIR=/usr/bin +export GETTEXT_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib/gettext" +export GETTEXT_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include" + +# libssh2-sys +export LIBSSH2_SYS_USE_PKG_CONFIG=1