2019-01-21 04:48:30 +01:00
|
|
|
# Define equivalent of TOML config in environment
|
|
|
|
# [build]
|
|
|
|
# jobs = $XBPS_MAKEJOBS
|
|
|
|
export CARGO_BUILD_JOBS="$XBPS_MAKEJOBS"
|
2019-12-11 22:36:06 +01:00
|
|
|
export CARGO_HOME="/host/cargo"
|
2019-01-21 04:48:30 +01:00
|
|
|
|
|
|
|
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
|
2023-01-30 15:34:51 +01:00
|
|
|
|
2019-01-21 04:48:30 +01:00
|
|
|
# Define equivalent of TOML config in environment
|
|
|
|
# [build]
|
|
|
|
# target = ${RUST_TARGET}
|
|
|
|
export CARGO_BUILD_TARGET="$RUST_TARGET"
|
2021-02-04 04:41:02 +01:00
|
|
|
|
|
|
|
# If cc-rs needs to build host binaries, it guesses the compiler and
|
|
|
|
# uses default (wrong) flags unless they are specified explicitly;
|
|
|
|
# innocuous flags are used here just to disable its defaults
|
|
|
|
export HOST_CC="gcc"
|
|
|
|
export HOST_CFLAGS="-O2"
|
2022-02-24 05:55:47 +01:00
|
|
|
|
|
|
|
# Crates that use bindgen via build.rs are not cross-aware unless these are set
|
2023-03-25 02:01:11 +01:00
|
|
|
export BINDGEN_EXTRA_CLANG_ARGS+=" --sysroot=${XBPS_CROSS_BASE} -I${XBPS_CROSS_BASE}/usr/include"
|
2019-02-08 17:36:42 +01:00
|
|
|
else
|
|
|
|
unset CARGO_BUILD_TARGET
|
2019-01-21 04:48:30 +01:00
|
|
|
fi
|
|
|
|
|
2023-11-28 11:54:54 +01:00
|
|
|
# prevent cargo stripping debug symbols
|
|
|
|
export CARGO_PROFILE_RELEASE_STRIP=false
|
|
|
|
|
2019-01-21 04:48:30 +01:00
|
|
|
# For cross-compiling rust -sys crates
|
|
|
|
export PKG_CONFIG_ALLOW_CROSS=1
|
|
|
|
|
2023-09-16 16:49:40 +02:00
|
|
|
# For cross-compiling pyo3 bindings
|
|
|
|
export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
|
|
|
|
export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
|
|
|
|
|
2019-01-21 04:48:30 +01:00
|
|
|
# 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
|
2023-01-30 15:34:51 +01:00
|
|
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
2019-06-15 16:35:53 +02:00
|
|
|
|
|
|
|
# sodium-sys
|
|
|
|
export SODIUM_LIB_DIR="${XBPS_CROSS_BASE}/usr/include"
|
|
|
|
export SODIUM_INC_DIR="${XBPS_CROSS_BASE}/usr/lib"
|
2022-03-14 01:51:03 +01:00
|
|
|
export SODIUM_SHARED=1
|
2020-05-31 05:02:37 +02:00
|
|
|
|
|
|
|
# openssl-sys
|
|
|
|
export OPENSSL_NO_VENDOR=1
|
2020-09-29 01:55:05 +02:00
|
|
|
|
|
|
|
# pcre2-sys, only necessary for musl targets
|
|
|
|
export PCRE2_SYS_STATIC=0
|
2023-04-02 12:24:12 +02:00
|
|
|
|
|
|
|
# zstd-sys
|
|
|
|
export ZSTD_SYS_USE_PKG_CONFIG=1
|
2023-04-02 10:41:11 +02:00
|
|
|
|
|
|
|
# onig-sys
|
|
|
|
export RUSTONIG_SYSTEM_LIBONIG=1
|
2023-08-06 21:34:55 +02:00
|
|
|
|
|
|
|
# libsqlite3-sys
|
|
|
|
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
|