about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorJake Goulding <jake.goulding@gmail.com>2020-08-27 13:51:33 -0400
committerJake Goulding <jake.goulding@gmail.com>2020-10-01 07:53:38 -0400
commit225ec813a9b25cdf94811d5b6c5207848cfef829 (patch)
tree3895b7aa4d61a28b9641557a2fc843a8f2075ff6 /src/ci/scripts
parentfc42fb8e70af6ad63998f4bfbf62451551eda073 (diff)
downloadrust-225ec813a9b25cdf94811d5b6c5207848cfef829.tar.gz
rust-225ec813a9b25cdf94811d5b6c5207848cfef829.zip
Add a cross-compiling aarch64-apple-darwin CI builder
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/install-clang.sh14
-rwxr-xr-xsrc/ci/scripts/select-xcode.sh13
2 files changed, 24 insertions, 3 deletions
diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh
index a1481f22f50..8070e90f155 100755
--- a/src/ci/scripts/install-clang.sh
+++ b/src/ci/scripts/install-clang.sh
@@ -12,10 +12,18 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
 LLVM_VERSION="10.0.0"
 
 if isMacOS; then
-    curl -f "${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz" | tar xJf -
+    # If the job selects a specific Xcode version, use that instead of
+    # downloading our own version.
+    if [[ ${USE_XCODE_CLANG-0} -eq 1 ]]; then
+        bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin"
+    else
+        file="${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
+        curl -f "${file}" | tar xJf -
+        bindir="$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin"
+    fi
 
-    ciCommandSetEnv CC "$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin/clang"
-    ciCommandSetEnv CXX "$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin/clang++"
+    ciCommandSetEnv CC "${bindir}/clang"
+    ciCommandSetEnv CXX "${bindir}/clang++"
 
     # macOS 10.15 onwards doesn't have libraries in /usr/include anymore: those
     # are now located deep into the filesystem, under Xcode's own files. The
diff --git a/src/ci/scripts/select-xcode.sh b/src/ci/scripts/select-xcode.sh
new file mode 100755
index 00000000000..3b9c77d42ba
--- /dev/null
+++ b/src/ci/scripts/select-xcode.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# This script selects the Xcode instance to use.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+if isMacOS; then
+    if [[ -s "${SELECT_XCODE-}" ]]; then
+        sudo xcode-select -s "${SELECT_XCODE}"
+    fi
+fi