@@ -75,19 +75,19 @@ mod build_bundled {
75
75
) ;
76
76
}
77
77
78
- fn untar_archive ( ) {
78
+ fn untar_archive ( out_dir : & str ) {
79
79
let path = "duckdb.tar.gz" ;
80
80
81
81
let tar_gz = std:: fs:: File :: open ( path) . expect ( "archive file" ) ;
82
82
let tar = flate2:: read:: GzDecoder :: new ( tar_gz) ;
83
83
let mut archive = tar:: Archive :: new ( tar) ;
84
- archive. unpack ( "." ) . expect ( "archive" ) ;
84
+ archive. unpack ( out_dir ) . expect ( "archive" ) ;
85
85
}
86
86
87
87
pub fn main ( out_dir : & str , out_path : & Path ) {
88
88
let lib_name = super :: lib_name ( ) ;
89
89
90
- untar_archive ( ) ;
90
+ untar_archive ( out_dir ) ;
91
91
92
92
if !cfg ! ( feature = "bundled" ) {
93
93
// This is just a sanity check, the top level `main` should ensure this.
@@ -97,7 +97,7 @@ mod build_bundled {
97
97
#[ cfg( feature = "buildtime_bindgen" ) ]
98
98
{
99
99
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" ) ) ;
101
101
bindings:: write_to_out_dir ( header, out_path) ;
102
102
}
103
103
#[ cfg( not( feature = "buildtime_bindgen" ) ) ]
@@ -106,7 +106,7 @@ mod build_bundled {
106
106
fs:: copy ( "src/bindgen_bundled_version.rs" , out_path) . expect ( "Could not copy bindings to output directory" ) ;
107
107
}
108
108
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" ) ;
110
110
let manifest: Manifest = serde_json:: from_reader ( manifest_file) . expect ( "reading manifest file" ) ;
111
111
112
112
let mut cpp_files = HashSet :: new ( ) ;
@@ -132,7 +132,7 @@ mod build_bundled {
132
132
133
133
// Since the manifest controls the set of files, we require it to be changed to know whether
134
134
// 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" ) ;
136
136
// Make sure to rebuild the project if tar file changed
137
137
println ! ( "cargo:rerun-if-changed=duckdb.tar.gz" ) ;
138
138
@@ -148,9 +148,9 @@ mod build_bundled {
148
148
add_extension ( & mut cfg, & manifest, "httpfs" , & mut cpp_files, & mut include_dirs) ;
149
149
}
150
150
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}" ) ) ) ;
152
152
153
- for f in cpp_files {
153
+ for f in cpp_files. into_iter ( ) . map ( |file| format ! ( "{out_dir}/{file}" ) ) {
154
154
cfg. file ( f) ;
155
155
}
156
156
@@ -166,6 +166,7 @@ mod build_bundled {
166
166
cfg. define ( "DUCKDB_BUILD_LIBRARY" , None ) ;
167
167
}
168
168
cfg. compile ( lib_name) ;
169
+
169
170
println ! ( "cargo:lib_dir={out_dir}" ) ;
170
171
}
171
172
}
0 commit comments