From 0fbba8065d7c93b3485294739f704e9f77e0b564 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Mon, 8 Jul 2019 14:41:36 -0700 Subject: [PATCH] Add RUSTC_XCRUN_PATH var Allows rustc to know about custom xcrun wrappers instead of always assuming xcrun is on PATH. --- src/librustc_target/spec/apple_ios_base.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_target/spec/apple_ios_base.rs b/src/librustc_target/spec/apple_ios_base.rs index 3068ed8d206cd..b1811ef5c06d1 100644 --- a/src/librustc_target/spec/apple_ios_base.rs +++ b/src/librustc_target/spec/apple_ios_base.rs @@ -1,3 +1,4 @@ +use std::env; use std::io; use std::process::Command; use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; @@ -27,7 +28,9 @@ impl Arch { } pub fn get_sdk_root(sdk_name: &str) -> Result { - let res = Command::new("xcrun") + let xcrun_path = env::var("RUSTC_XCRUN_PATH"); + let xcrun = xcrun_path.as_ref().map(String::as_str).unwrap_or("xcrun"); + let res = Command::new(xcrun) .arg("--show-sdk-path") .arg("-sdk") .arg(sdk_name)