@@ -75,19 +75,19 @@ mod build_bundled {
7575 ) ;
7676 }
7777
78- fn untar_archive ( ) {
78+ fn untar_archive ( out_dir : & str ) {
7979 let path = "duckdb.tar.gz" ;
8080
8181 let tar_gz = std:: fs:: File :: open ( path) . expect ( "archive file" ) ;
8282 let tar = flate2:: read:: GzDecoder :: new ( tar_gz) ;
8383 let mut archive = tar:: Archive :: new ( tar) ;
84- archive. unpack ( "." ) . expect ( "archive" ) ;
84+ archive. unpack ( out_dir ) . expect ( "archive" ) ;
8585 }
8686
8787 pub fn main ( out_dir : & str , out_path : & Path ) {
8888 let lib_name = super :: lib_name ( ) ;
8989
90- untar_archive ( ) ;
90+ untar_archive ( out_dir ) ;
9191
9292 if !cfg ! ( feature = "bundled" ) {
9393 // This is just a sanity check, the top level `main` should ensure this.
@@ -97,7 +97,7 @@ mod build_bundled {
9797 #[ cfg( feature = "buildtime_bindgen" ) ]
9898 {
9999 use super :: { bindings, HeaderLocation } ;
100- let header = HeaderLocation :: FromPath ( format ! ( "{}/ src/include/duckdb.h" , lib_name ) ) ;
100+ let header = HeaderLocation :: FromPath ( format ! ( "{out_dir}/{lib_name}/ src/include/duckdb.h" ) ) ;
101101 bindings:: write_to_out_dir ( header, out_path) ;
102102 }
103103 #[ cfg( not( feature = "buildtime_bindgen" ) ) ]
@@ -106,7 +106,7 @@ mod build_bundled {
106106 fs:: copy ( "src/bindgen_bundled_version.rs" , out_path) . expect ( "Could not copy bindings to output directory" ) ;
107107 }
108108
109- let manifest_file = std:: fs:: File :: open ( format ! ( "{}/ manifest.json" , lib_name ) ) . expect ( "manifest file" ) ;
109+ let manifest_file = std:: fs:: File :: open ( format ! ( "{out_dir}/{lib_name}/ manifest.json" ) ) . expect ( "manifest file" ) ;
110110 let manifest: Manifest = serde_json:: from_reader ( manifest_file) . expect ( "reading manifest file" ) ;
111111
112112 let mut cpp_files = HashSet :: new ( ) ;
@@ -132,7 +132,7 @@ mod build_bundled {
132132
133133 // Since the manifest controls the set of files, we require it to be changed to know whether
134134 // to rebuild the project
135- println ! ( "cargo:rerun-if-changed={}/ manifest.json" , lib_name ) ;
135+ println ! ( "cargo:rerun-if-changed={out_dir}/{lib_name}/ manifest.json" ) ;
136136 // Make sure to rebuild the project if tar file changed
137137 println ! ( "cargo:rerun-if-changed=duckdb.tar.gz" ) ;
138138
@@ -148,9 +148,9 @@ mod build_bundled {
148148 add_extension ( & mut cfg, & manifest, "httpfs" , & mut cpp_files, & mut include_dirs) ;
149149 }
150150
151- cfg. includes ( include_dirs. iter ( ) . map ( |x | format ! ( "{}/{}" , lib_name , x ) ) ) ;
151+ cfg. includes ( include_dirs. iter ( ) . map ( |dir | format ! ( "{out_dir }/{lib_name}/{dir}" ) ) ) ;
152152
153- for f in cpp_files {
153+ for f in cpp_files. into_iter ( ) . map ( |file| format ! ( "{out_dir}/{file}" ) ) {
154154 cfg. file ( f) ;
155155 }
156156
@@ -166,6 +166,7 @@ mod build_bundled {
166166 cfg. define ( "DUCKDB_BUILD_LIBRARY" , None ) ;
167167 }
168168 cfg. compile ( lib_name) ;
169+
169170 println ! ( "cargo:lib_dir={out_dir}" ) ;
170171 }
171172}
0 commit comments