aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cross18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/cross b/bin/cross
new file mode 100755
index 0000000..7ef26b6
--- /dev/null
+++ b/bin/cross
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+arch=$(uname -m)
+if [ "${arch}" != "x86_64" ]; then
+ echo "This tool is only meant to be used on x86_64!"
+ exit 1
+fi
+
+count=$(find /usr/bin/riscv64-*-gcc -printf "%f\n" | grep -v elf -c)
+if [ "$count" -lt 1 ]; then
+ echo "There are too many options for the compiler, not even trying... Bail!"
+ exit 1
+fi
+
+bin=$(find /usr/bin/riscv64-*-gcc -printf "%f\n" | grep -v elf | rev | cut -c4- | rev)
+
+export ARCH="riscv"
+export CROSS_COMPILE="${bin}"