1
1
use std:: env;
2
2
use std:: ffi:: OsString ;
3
3
use std:: fs:: { self , OpenOptions } ;
4
- use std:: io:: { self , Write } ;
4
+ use std:: io:: Write ;
5
5
use std:: path:: { Path , PathBuf } ;
6
6
use std:: process:: Command ;
7
7
@@ -39,8 +39,13 @@ fn main() {
39
39
40
40
let dir = env ! ( "CARGO_MANIFEST_DIR" ) ;
41
41
42
- let full_src_path = Path :: new ( dir) . join ( bindgen_rs_path) ;
43
- copy_with_cp ( full_src_path, & out_path) . unwrap ( ) ;
42
+ Command :: new ( "cp" )
43
+ . arg ( "--no-preserve=mode,ownership" )
44
+ . arg ( "-R" )
45
+ . arg ( format ! ( "{dir}/{bindgen_rs_path}" ) )
46
+ . arg ( & out_path)
47
+ . output ( )
48
+ . unwrap ( ) ;
44
49
45
50
println ! ( "cargo:lib_dir={out_dir}" ) ;
46
51
@@ -56,31 +61,6 @@ fn main() {
56
61
build_bundled ( & out_dir, & out_path) ;
57
62
}
58
63
59
- #[ cfg( target_os = "windows" ) ]
60
- fn copy_with_cp ( src : impl AsRef < Path > , dst : impl AsRef < Path > ) -> io:: Result < ( ) > {
61
- fs:: copy ( src, dst) ?; // do a regular file copy on Windows
62
- Ok ( ( ) )
63
- }
64
-
65
- #[ cfg( not( target_os = "windows" ) ) ]
66
- fn copy_with_cp ( src : impl AsRef < Path > , dst : impl AsRef < Path > ) -> io:: Result < ( ) > {
67
- let status = Command :: new ( "cp" )
68
- . arg ( "--no-preserve=mode,ownership" )
69
- . arg ( "-R" )
70
- . arg ( src. as_ref ( ) . to_str ( ) . unwrap ( ) )
71
- . arg ( dst. as_ref ( ) . to_str ( ) . unwrap ( ) )
72
- . status ( ) ?;
73
-
74
- if !status. success ( ) {
75
- Err ( io:: Error :: new (
76
- io:: ErrorKind :: Other ,
77
- "Failed to copy using cp" ,
78
- ) )
79
- } else {
80
- Ok ( ( ) )
81
- }
82
- }
83
-
84
64
fn make_amalgamation ( ) {
85
65
let flags = [ "-DSQLITE_ENABLE_COLUMN_METADATA=1" ] ;
86
66
0 commit comments