@@ -20,6 +20,7 @@ use std::collections::HashMap;
20
20
use std:: fs:: { self , File } ;
21
21
use std:: path:: { Path , PathBuf } ;
22
22
use std:: process:: Command ;
23
+ use std:: env;
23
24
24
25
use build_helper:: { output, mtime, up_to_date} ;
25
26
use filetime:: FileTime ;
@@ -44,6 +45,11 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
44
45
build. clear_if_dirty ( & out_dir, & build. compiler_path ( compiler) ) ;
45
46
let mut cargo = build. cargo ( compiler, Mode :: Libstd , target, "build" ) ;
46
47
let mut features = build. std_features ( ) ;
48
+
49
+ if let Ok ( target) = env:: var ( "MACOSX_STD_DEPLOYMENT_TARGET" ) {
50
+ cargo. env ( "MACOSX_DEPLOYMENT_TARGET" , target) ;
51
+ }
52
+
47
53
// When doing a local rebuild we tell cargo that we're stage1 rather than
48
54
// stage0. This works fine if the local rust and being-built rust have the
49
55
// same view of what the default allocator is, but fails otherwise. Since
@@ -170,6 +176,9 @@ pub fn test(build: &Build, target: &str, compiler: &Compiler) {
170
176
let out_dir = build. cargo_out ( compiler, Mode :: Libtest , target) ;
171
177
build. clear_if_dirty ( & out_dir, & libstd_stamp ( build, compiler, target) ) ;
172
178
let mut cargo = build. cargo ( compiler, Mode :: Libtest , target, "build" ) ;
179
+ if let Ok ( target) = env:: var ( "MACOSX_STD_DEPLOYMENT_TARGET" ) {
180
+ cargo. env ( "MACOSX_DEPLOYMENT_TARGET" , target) ;
181
+ }
173
182
cargo. arg ( "--manifest-path" )
174
183
. arg ( build. src . join ( "src/libtest/Cargo.toml" ) ) ;
175
184
build. run ( & mut cargo) ;
0 commit comments