Files
krata/hack/build/cargo.sh

25 lines
483 B
Bash
Raw Normal View History

2024-03-07 09:04:05 +00:00
#!/bin/sh
set -e
TOOLS_DIR="$(dirname "${0}")"
RUST_TARGET="$("${TOOLS_DIR}/target.sh")"
2024-03-21 21:31:10 +00:00
CROSS_COMPILE="$("${TOOLS_DIR}/cross-compile.sh")"
2024-03-07 09:04:05 +00:00
2024-03-21 21:31:10 +00:00
if [ "${TARGET_LIBC}" = "musl" ] && [ -f "/etc/alpine-release" ]
2024-03-10 00:22:24 +00:00
then
export RUSTFLAGS="-Ctarget-feature=-crt-static"
fi
2024-03-21 21:31:10 +00:00
if [ -z "${CARGO}" ]
then
if [ "${CROSS_COMPILE}" = "1" ] && command -v cross > /dev/null
then
CARGO="cross"
else
CARGO="cargo"
fi
fi
2024-03-07 09:04:05 +00:00
export CARGO_BUILD_TARGET="${RUST_TARGET}"
2024-03-21 21:31:10 +00:00
exec "${CARGO}" "${@}"