2020-01-02 15:16:20 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2023-07-06 08:20:23 +00:00
|
|
|
if [ -n "$CROSSDIRECT_DEBUG" ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2020-01-02 15:16:20 +00:00
|
|
|
|
2023-07-06 08:20:23 +00:00
|
|
|
# return the correct host architecture when cargo requests it
|
|
|
|
if [ "$*" = "-vV" ]; then
|
|
|
|
exec /usr/bin/rustc -vV
|
|
|
|
fi
|
2020-01-02 15:16:20 +00:00
|
|
|
|
2023-07-06 08:20:23 +00:00
|
|
|
# We expect the right target to be set in the arguments if compiling for the
|
|
|
|
# target architecture. Our cargo wrapper passes the right "--target" argument
|
|
|
|
# automatically. If no target is provided, this is probably a macro or a
|
|
|
|
# build script, so it should be compiled for the native architecture.
|
|
|
|
if echo "$*" | grep -qFe "--target"; then
|
|
|
|
LD_LIBRARY_PATH=/native/lib:/native/usr/lib /native/usr/bin/rustc \
|
2020-01-02 15:16:20 +00:00
|
|
|
-Clinker=/native/usr/lib/crossdirect/rust-qemu-linker \
|
|
|
|
--sysroot=/usr \
|
2023-07-06 08:20:23 +00:00
|
|
|
"$@"
|
|
|
|
else
|
|
|
|
PATH=/native/usr/bin:/native/bin LD_LIBRARY_PATH=/native/lib:/native/usr/lib \
|
|
|
|
/native/usr/bin/rustc \
|
|
|
|
-Clink-arg=-Wl,-rpath,/native/lib:/native/usr/lib \
|
|
|
|
"$@"
|
2020-01-02 15:16:20 +00:00
|
|
|
fi
|