File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,24 @@ 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
+ }
7
27
}
You can’t perform that action at this time.
0 commit comments