summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-cbindgen.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtaskcluster/scripts/misc/build-cbindgen.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/build-cbindgen.sh b/taskcluster/scripts/misc/build-cbindgen.sh
new file mode 100755
index 0000000000..33127d90fb
--- /dev/null
+++ b/taskcluster/scripts/misc/build-cbindgen.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -x -e -v
+
+# Needed by osx-cross-linker.
+export TARGET="$1"
+
+case "$(uname -s)" in
+Linux)
+ COMPRESS_EXT=xz
+ ;;
+MINGW*)
+ UPLOAD_DIR=$PWD/public/build
+ COMPRESS_EXT=bz2
+
+ . $GECKO_PATH/taskcluster/scripts/misc/vs-setup.sh
+
+ export CC=clang-cl
+ ;;
+esac
+
+cd $GECKO_PATH
+
+if [ -n "$TOOLTOOL_MANIFEST" ]; then
+ . taskcluster/scripts/misc/tooltool-download.sh
+fi
+
+# OSX cross builds are a bit harder
+if [ "$TARGET" == "x86_64-apple-darwin" ]; then
+ export PATH="$MOZ_FETCHES_DIR/llvm-dsymutil/bin:$PATH"
+ export PATH="$MOZ_FETCHES_DIR/cctools/bin:$PATH"
+ export RUSTFLAGS="-C linker=$GECKO_PATH/taskcluster/scripts/misc/osx-cross-linker"
+fi
+
+export PATH="$(cd $MOZ_FETCHES_DIR && pwd)/rustc/bin:$PATH"
+
+cd $MOZ_FETCHES_DIR/cbindgen
+
+cargo build --verbose --release --target "$TARGET"
+
+mkdir cbindgen
+cp target/$TARGET/release/cbindgen* cbindgen/
+tar -acf cbindgen.tar.$COMPRESS_EXT cbindgen
+mkdir -p $UPLOAD_DIR
+cp cbindgen.tar.$COMPRESS_EXT $UPLOAD_DIR
+
+. $GECKO_PATH/taskcluster/scripts/misc/vs-cleanup.sh