File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11extern  crate  cc; 
22
33use  std:: env; 
4+ use  std:: path:: Path ; 
45
5- fn  main ( )  { 
6+ // Must be public so the build script of `std` can call it. 
7+ pub  fn  main ( )  { 
68    match  env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap_or_default ( ) . as_str ( )  { 
79        "android"  => build_android ( ) , 
810        _ => { } 
911    } 
1012} 
1113
1214fn  build_android ( )  { 
13-     let  expansion = match  cc:: Build :: new ( ) . file ( "src/android-api.c" ) . try_expand ( )  { 
15+     // Resolve `src/android-api.c` relative to this file. 
16+     // Required to support calling this from the `std` build script. 
17+     let  android_api_c = Path :: new ( file ! ( ) ) . parent ( ) . unwrap ( ) . join ( "src/android-api.c" ) ; 
18+     let  expansion = match  cc:: Build :: new ( ) . file ( android_api_c) . try_expand ( )  { 
1419        Ok ( result)  => result, 
1520        Err ( e)  => { 
1621            println ! ( "failed to run C compiler: {}" ,  e) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments