|
1 |
| -use std::env; |
2 |
| -use std::str::FromStr; |
3 |
| - |
4 | 1 | use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
5 |
| -use rustc_session::Session; |
6 | 2 | use rustc_target::spec::Target;
|
7 | 3 | pub(super) use rustc_target::spec::apple::OSVersion;
|
8 | 4 |
|
9 |
| -use crate::errors::AppleDeploymentTarget; |
10 |
| - |
11 | 5 | #[cfg(test)]
|
12 | 6 | mod tests;
|
13 | 7 |
|
@@ -110,54 +104,6 @@ pub(super) fn add_data_and_relocation(
|
110 | 104 | Ok(())
|
111 | 105 | }
|
112 | 106 |
|
113 |
| -/// Name of the environment variable used to fetch the deployment target on the given OS. |
114 |
| -pub fn deployment_target_env_var(os: &str) -> &'static str { |
115 |
| - match os { |
116 |
| - "macos" => "MACOSX_DEPLOYMENT_TARGET", |
117 |
| - "ios" => "IPHONEOS_DEPLOYMENT_TARGET", |
118 |
| - "watchos" => "WATCHOS_DEPLOYMENT_TARGET", |
119 |
| - "tvos" => "TVOS_DEPLOYMENT_TARGET", |
120 |
| - "visionos" => "XROS_DEPLOYMENT_TARGET", |
121 |
| - _ => unreachable!("tried to get deployment target env var for non-Apple platform"), |
122 |
| - } |
123 |
| -} |
124 |
| - |
125 |
| -/// Get the deployment target based on the standard environment variables, or fall back to the |
126 |
| -/// minimum version supported by `rustc`. |
127 |
| -pub fn deployment_target(sess: &Session) -> OSVersion { |
128 |
| - let min = OSVersion::minimum_deployment_target(&sess.target); |
129 |
| - let env_var = deployment_target_env_var(&sess.target.os); |
130 |
| - |
131 |
| - if let Ok(deployment_target) = env::var(env_var) { |
132 |
| - match OSVersion::from_str(&deployment_target) { |
133 |
| - Ok(version) => { |
134 |
| - let os_min = OSVersion::os_minimum_deployment_target(&sess.target.os); |
135 |
| - // It is common that the deployment target is set a bit too low, for example on |
136 |
| - // macOS Aarch64 to also target older x86_64. So we only want to warn when variable |
137 |
| - // is lower than the minimum OS supported by rustc, not when the variable is lower |
138 |
| - // than the minimum for a specific target. |
139 |
| - if version < os_min { |
140 |
| - sess.dcx().emit_warn(AppleDeploymentTarget::TooLow { |
141 |
| - env_var, |
142 |
| - version: version.fmt_pretty().to_string(), |
143 |
| - os_min: os_min.fmt_pretty().to_string(), |
144 |
| - }); |
145 |
| - } |
146 |
| - |
147 |
| - // Raise the deployment target to the minimum supported. |
148 |
| - version.max(min) |
149 |
| - } |
150 |
| - Err(error) => { |
151 |
| - sess.dcx().emit_err(AppleDeploymentTarget::Invalid { env_var, error }); |
152 |
| - min |
153 |
| - } |
154 |
| - } |
155 |
| - } else { |
156 |
| - // If no deployment target variable is set, default to the minimum found above. |
157 |
| - min |
158 |
| - } |
159 |
| -} |
160 |
| - |
161 | 107 | pub(super) fn add_version_to_llvm_target(
|
162 | 108 | llvm_target: &str,
|
163 | 109 | deployment_target: OSVersion,
|
|
0 commit comments