]> code.octet-stream.net Git - m17rt/blobdiff - buildscripts/init.sh
Add build scripts for cross-platform testing
[m17rt] / buildscripts / init.sh
diff --git a/buildscripts/init.sh b/buildscripts/init.sh
new file mode 100644 (file)
index 0000000..ed73ec8
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -euxo pipefail
+cd "$(git rev-parse --show-toplevel)"
+
+PLATFORM=$1
+
+case $PLATFORM in
+mac-x86_64)
+    RUST_TARGET=x86_64-apple-darwin
+    ;;
+mac-arm64)
+    RUST_TARGET=aarch64-apple-darwin
+    ;;
+linux-x86_64)
+    RUST_TARGET=x86_64-unknown-linux-gnu
+    ;;
+linux-armhf)
+    RUST_TARGET=armv7-unknown-linux-gnueabihf
+    ;;
+linux-arm64)
+    RUST_TARGET=aarch64-unknown-linux-gnu
+    ;;
+windows-x86_64)
+    RUST_TARGET=x86_64-pc-windows-msvc
+    ;;
+*)
+    echo "Unrecognised platform"
+    exit 1
+    ;;
+esac
+
+export RUST_TARGET