File tree Expand file tree Collapse file tree 6 files changed +22
-2
lines changed 
compiler/rustc_windows_rc/src Expand file tree Collapse file tree 6 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 325325#  Defaults to the Python interpreter used to execute x.py.
326326# build.python = "python"
327327
328+ #  The path to (or name of) the resource compiler executable to use on Windows.
329+ # build.windows-rc = "rc.exe"
330+ 
328331#  The path to the REUSE executable to use. Note that REUSE is not required in
329332#  most cases, as our tooling relies on a cached (and shrunk) copy of the
330333#  REUSE output present in the git repository and in our source tarballs.
Original file line number Diff line number Diff line change @@ -35,8 +35,11 @@ pub fn compile_windows_resource_file(
3535    resources_dir. push ( "resources" ) ; 
3636    fs:: create_dir_all ( & resources_dir) . unwrap ( ) ; 
3737
38-     let  resource_compiler =
39-         find_resource_compiler ( & env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ) . expect ( "found rc.exe" ) ; 
38+     let  resource_compiler = if  let  Ok ( path)  = env:: var ( "RUSTC_WINDOWS_RC" )  { 
39+         path. into ( ) 
40+     }  else  { 
41+         find_resource_compiler ( & env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ) . expect ( "found rc.exe" ) 
42+     } ; 
4043
4144    let  rc_path = resources_dir. join ( file_stem. with_extension ( "rc" ) ) ; 
4245
Original file line number Diff line number Diff line change @@ -1221,6 +1221,11 @@ impl Builder<'_> {
12211221            rustflags. arg ( "-Zehcont-guard" ) ; 
12221222        } 
12231223
1224+         // Optionally override the rc.exe when compiling rustc on Windows. 
1225+         if  let  Some ( windows_rc)  = & self . config . windows_rc  { 
1226+             cargo. env ( "RUSTC_WINDOWS_RC" ,  windows_rc) ; 
1227+         } 
1228+ 
12241229        // For `cargo doc` invocations, make rustdoc print the Rust version into the docs 
12251230        // This replaces spaces with tabs because RUSTDOCFLAGS does not 
12261231        // support arguments with regular spaces. Hopefully someday Cargo will 
Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ pub struct Config {
272272    pub  gdb :  Option < PathBuf > , 
273273    pub  lldb :  Option < PathBuf > , 
274274    pub  python :  Option < PathBuf > , 
275+     pub  windows_rc :  Option < PathBuf > , 
275276    pub  reuse :  Option < PathBuf > , 
276277    pub  cargo_native_static :  bool , 
277278    pub  configure_args :  Vec < String > , 
@@ -449,6 +450,7 @@ impl Config {
449450            nodejs :  build_nodejs, 
450451            npm :  build_npm, 
451452            python :  build_python, 
453+             windows_rc :  build_windows_rc, 
452454            reuse :  build_reuse, 
453455            locked_deps :  build_locked_deps, 
454456            vendor :  build_vendor, 
@@ -1339,6 +1341,7 @@ impl Config {
13391341                . unwrap_or ( rust_debug == Some ( true ) ) , 
13401342            vendor, 
13411343            verbose_tests, 
1344+             windows_rc :  build_windows_rc. map ( PathBuf :: from) , 
13421345            // tidy-alphabetical-end 
13431346        } 
13441347    } 
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ define_config! {
3737        nodejs:  Option <String > = "nodejs" , 
3838        npm:  Option <String > = "npm" , 
3939        python:  Option <String > = "python" , 
40+         windows_rc:  Option <String > = "windows-rc" , 
4041        reuse:  Option <String > = "reuse" , 
4142        locked_deps:  Option <bool > = "locked-deps" , 
4243        vendor:  Option <bool > = "vendor" , 
Original file line number Diff line number Diff line change @@ -546,4 +546,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
546546        severity :  ChangeSeverity :: Info , 
547547        summary :  "The default value of the `gcc.download-ci-gcc` option has been changed to `true`." , 
548548    } , 
549+     ChangeInfo  { 
550+         change_id :  146663 , 
551+         severity :  ChangeSeverity :: Info , 
552+         summary :  "New option `build.windows-rc` that will override which resource compiler on Windows will be used to compile Rust." , 
553+     } , 
549554] ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments