@@ -32,15 +32,27 @@ pub struct GccOutput {
3232impl  GccOutput  { 
3333    /// Install the required libgccjit library file(s) to the specified `path`. 
3434pub  fn  install_to ( & self ,  builder :  & Builder < ' _ > ,  directory :  & Path )  { 
35+         if  builder. config . dry_run ( )  { 
36+             return ; 
37+         } 
38+ 
3539        // At build time, cg_gcc has to link to libgccjit.so (the unversioned symbol). 
3640        // However, at runtime, it will by default look for libgccjit.so.0. 
3741        // So when we install the built libgccjit.so file to the target `directory`, we add it there 
3842        // with the `.0` suffix. 
3943        let  mut  target_filename = self . libgccjit . file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ; 
4044        target_filename. push_str ( ".0" ) ; 
4145
46+         // If we build libgccjit ourselves, then `self.libgccjit` can actually be a symlink. 
47+         // In that case, we have to resolve it first, otherwise we'd create a symlink to a symlink, 
48+         // which wouldn't work. 
49+         let  actual_libgccjit_path = t ! ( 
50+             self . libgccjit. canonicalize( ) , 
51+             format!( "Cannot find libgccjit at {}" ,  self . libgccjit. display( ) ) 
52+         ) ; 
53+ 
4254        let  dst = directory. join ( target_filename) ; 
43-         builder. copy_link ( & self . libgccjit ,  & dst,  FileType :: NativeLibrary ) ; 
55+         builder. copy_link ( & actual_libgccjit_path ,  & dst,  FileType :: NativeLibrary ) ; 
4456    } 
4557} 
4658
0 commit comments