File tree 2 files changed +6
-28
lines changed
cargo/cargo_build_script_runner 2 files changed +6
-28
lines changed Original file line number Diff line number Diff line change @@ -88,15 +88,13 @@ fn run_buildrs() -> Result<(), String> {
88
88
}
89
89
}
90
90
91
- for compiler_env_var in & [ "CC" , "CXX" ] {
92
- if let Some ( compiler_path) = env:: var_os ( compiler_env_var) {
93
- let mut compiler_path = exec_root. join ( compiler_path) . into_os_string ( ) ;
94
- if let Some ( sysroot_path) = env:: var_os ( "SYSROOT" ) {
95
- compiler_path. push ( " --sysroot=" ) ;
96
- compiler_path. push ( & exec_root. join ( sysroot_path) ) ;
97
- }
98
- command. env ( compiler_env_var, compiler_path) ;
91
+ if let Some ( cc_path) = env:: var_os ( "CC" ) {
92
+ let mut cc_path = exec_root. join ( cc_path) . into_os_string ( ) ;
93
+ if let Some ( sysroot_path) = env:: var_os ( "SYSROOT" ) {
94
+ cc_path. push ( " --sysroot=" ) ;
95
+ cc_path. push ( & exec_root. join ( sysroot_path) ) ;
99
96
}
97
+ command. env ( "CC" , cc_path) ;
100
98
}
101
99
102
100
if let Some ( ar_path) = env:: var_os ( "AR" ) {
Original file line number Diff line number Diff line change @@ -4,24 +4,4 @@ fn main() {
4
4
"cargo:rustc-env=TOOL_PATH={}" ,
5
5
std:: env:: var( "TOOL" ) . unwrap( )
6
6
) ;
7
-
8
- // Assert that the CC and CXX env vars existed and were executable.
9
- // We don't assert what happens when they're executed (in particular, we don't check for a
10
- // non-zero exit code), but this asserts that it's an existing file which is executable.
11
- //
12
- // Unfortunately we need to shlex the path, because we add a `--sysroot=...` arg to the env var.
13
- for env_var in & [ "CC" , "CXX" ] {
14
- let v = std:: env:: var ( env_var)
15
- . unwrap_or_else ( |err| panic ! ( "Error getting {}: {}" , env_var, err) ) ;
16
- let ( path, args) = if let Some ( index) = v. find ( "--sysroot" ) {
17
- let ( path, args) = v. split_at ( index) ;
18
- ( path, Some ( args) )
19
- } else {
20
- ( v. as_str ( ) , None )
21
- } ;
22
- std:: process:: Command :: new ( path)
23
- . args ( args. into_iter ( ) )
24
- . status ( )
25
- . unwrap ( ) ;
26
- }
27
7
}
You can’t perform that action at this time.
0 commit comments