@@ -112,7 +112,9 @@ fn install_prebuilt() {
112
112
// Extract the tarball.
113
113
let unpacked_dir = download_dir. join ( base_name) ;
114
114
let lib_dir = unpacked_dir. join ( "lib" ) ;
115
- if !lib_dir. join ( format ! ( "lib{}.so" , LIBRARY ) ) . exists ( ) {
115
+ let library_file = format ! ( "lib{}.so" , LIBRARY ) ;
116
+ let library_full_path = lib_dir. join ( & library_file) ;
117
+ if !library_full_path. exists ( ) {
116
118
extract ( file_name, & unpacked_dir) ;
117
119
}
118
120
@@ -122,7 +124,16 @@ fn install_prebuilt() {
122
124
} ) ; // TODO: remove
123
125
124
126
println ! ( "cargo:rustc-link-lib=dylib={}" , LIBRARY ) ;
125
- println ! ( "cargo:rustc-link-search={}" , lib_dir. display( ) ) ;
127
+ let output = PathBuf :: from ( & get ! ( "OUT_DIR" ) ) ;
128
+ let new_library_full_path = output. join ( & library_file) ;
129
+ if new_library_full_path. exists ( ) {
130
+ log ! ( "File {} already exists, deleting." , new_library_full_path. display( ) ) ;
131
+ std:: fs:: remove_file ( & new_library_full_path) . unwrap ( ) ;
132
+ }
133
+
134
+ log ! ( "Copying {} to {}..." , library_full_path. display( ) , new_library_full_path. display( ) ) ;
135
+ std:: fs:: copy ( & library_full_path, & new_library_full_path) . unwrap ( ) ;
136
+ println ! ( "cargo:rustc-link-search={}" , output. display( ) ) ;
126
137
}
127
138
128
139
fn build_from_src ( ) {
0 commit comments