@@ -20,6 +20,7 @@ use std::collections::HashMap;
2020use std:: fs:: { self , File } ;
2121use std:: path:: { Path , PathBuf } ;
2222use std:: process:: Command ;
23+ use std:: env;
2324
2425use build_helper:: { output, mtime, up_to_date} ;
2526use filetime:: FileTime ;
@@ -44,6 +45,11 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
4445 build. clear_if_dirty ( & out_dir, & build. compiler_path ( compiler) ) ;
4546 let mut cargo = build. cargo ( compiler, Mode :: Libstd , target, "build" ) ;
4647 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+
4753 // When doing a local rebuild we tell cargo that we're stage1 rather than
4854 // stage0. This works fine if the local rust and being-built rust have the
4955 // 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) {
170176 let out_dir = build. cargo_out ( compiler, Mode :: Libtest , target) ;
171177 build. clear_if_dirty ( & out_dir, & libstd_stamp ( build, compiler, target) ) ;
172178 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+ }
173182 cargo. arg ( "--manifest-path" )
174183 . arg ( build. src . join ( "src/libtest/Cargo.toml" ) ) ;
175184 build. run ( & mut cargo) ;
0 commit comments