@@ -32,15 +32,27 @@ pub struct GccOutput {
32
32
impl GccOutput {
33
33
/// Install the required libgccjit library file(s) to the specified `path`.
34
34
pub fn install_to ( & self , builder : & Builder < ' _ > , directory : & Path ) {
35
+ if builder. config . dry_run ( ) {
36
+ return ;
37
+ }
38
+
35
39
// At build time, cg_gcc has to link to libgccjit.so (the unversioned symbol).
36
40
// However, at runtime, it will by default look for libgccjit.so.0.
37
41
// So when we install the built libgccjit.so file to the target `directory`, we add it there
38
42
// with the `.0` suffix.
39
43
let mut target_filename = self . libgccjit . file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
40
44
target_filename. push_str ( ".0" ) ;
41
45
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
+
42
54
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 ) ;
44
56
}
45
57
}
46
58
0 commit comments