2022-12-20 10:20:10 +00:00
|
|
|
#!/bin/bash -exuo pipefail
|
|
|
|
RUSTFLAGS="-C link-arg=-s"
|
2022-03-28 02:52:14 +00:00
|
|
|
|
|
|
|
if [[ "${TARGET}" == *musl ]]; then
|
2022-12-20 10:20:10 +00:00
|
|
|
RUSTFLAGS="${flags} -C target-feature=-crt-static"
|
2022-03-28 02:52:14 +00:00
|
|
|
fi
|
|
|
|
|
2022-12-20 10:20:10 +00:00
|
|
|
export RUSTFLAGS="${RUSTFLAGS}"
|
|
|
|
|
|
|
|
target_debian=""
|
|
|
|
case "${TARGET}" in
|
|
|
|
aarch64-unknown-linux-gnu|aarch64-unknown-linux-musl)
|
|
|
|
target_debian="aarch64-linux-gnu"
|
|
|
|
;;
|
|
|
|
arm-unknown-linux-gnueabi|arm-unknown-linux-musleabi)
|
|
|
|
target_debian="arm-linux-gnueabi"
|
|
|
|
;;
|
|
|
|
arm-unknown-linux-gnueabihf|arm-unknown-linux-musleabihf)
|
|
|
|
target_debian="arm-linux-gnueabihf"
|
|
|
|
;;
|
|
|
|
armv7-unknown-linux-gnueabihf|armv7-unknown-linux-musleabihf)
|
|
|
|
target_debian="arm-linux-gnueabihf"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "${target_debian}" != "" ]]; then
|
|
|
|
export CC="${target_debian}-gcc"
|
|
|
|
export CCX="${target_debian}-g++"
|
|
|
|
export CPATH="/usr/${target_debian}/include"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export CARGO_BUILD_TARGET="${TARGET}"
|