@@ -27,6 +27,7 @@ pub struct Gcc {
2727#[ derive( Clone ) ]
2828pub struct GccOutput {
2929 pub libgccjit : PathBuf ,
30+ target : TargetSelection ,
3031}
3132
3233impl GccOutput {
@@ -46,7 +47,9 @@ impl GccOutput {
4647 format!( "Cannot find libgccjit at {}" , self . libgccjit. display( ) )
4748 ) ;
4849
49- let dst = directory. join ( target_filename) ;
50+ let dest_dir = directory. join ( self . target ) ;
51+ t ! ( fs:: create_dir_all( & dest_dir) ) ;
52+ let dst = dest_dir. join ( target_filename) ;
5053 builder. copy_link ( & actual_libgccjit_path, & dst, FileType :: NativeLibrary ) ;
5154 }
5255}
@@ -70,7 +73,7 @@ impl Step for Gcc {
7073
7174 // If GCC has already been built, we avoid building it again.
7275 let metadata = match get_gcc_build_status ( builder, target) {
73- GccBuildStatus :: AlreadyBuilt ( path) => return GccOutput { libgccjit : path } ,
76+ GccBuildStatus :: AlreadyBuilt ( path) => return GccOutput { libgccjit : path, target } ,
7477 GccBuildStatus :: ShouldBuild ( m) => m,
7578 } ;
7679
@@ -80,14 +83,14 @@ impl Step for Gcc {
8083
8184 let libgccjit_path = libgccjit_built_path ( & metadata. install_dir ) ;
8285 if builder. config . dry_run ( ) {
83- return GccOutput { libgccjit : libgccjit_path } ;
86+ return GccOutput { libgccjit : libgccjit_path, target } ;
8487 }
8588
8689 build_gcc ( & metadata, builder, target) ;
8790
8891 t ! ( metadata. stamp. write( ) ) ;
8992
90- GccOutput { libgccjit : libgccjit_path }
93+ GccOutput { libgccjit : libgccjit_path, target }
9194 }
9295}
9396
0 commit comments