@@ -41,19 +41,21 @@ fn main() {
41
41
cp_r ( "libgit2/include" , & include) ;
42
42
43
43
cfg. include ( & include)
44
- . include ( "libgit2/src" )
44
+ . include ( "libgit2/src/libgit2" )
45
+ . include ( "libgit2/src/util" )
45
46
. out_dir ( dst. join ( "build" ) )
46
47
. warnings ( false ) ;
47
48
48
49
// Include all cross-platform C files
49
- add_c_files ( & mut cfg, "libgit2/src" ) ;
50
- add_c_files ( & mut cfg, "libgit2/src/xdiff" ) ;
50
+ add_c_files ( & mut cfg, "libgit2/src/libgit2" ) ;
51
+ add_c_files ( & mut cfg, "libgit2/src/util" ) ;
52
+ add_c_files ( & mut cfg, "libgit2/src/libgit2/xdiff" ) ;
51
53
52
54
// These are activated by features, but they're all unconditionally always
53
55
// compiled apparently and have internal #define's to make sure they're
54
56
// compiled correctly.
55
- add_c_files ( & mut cfg, "libgit2/src/transports" ) ;
56
- add_c_files ( & mut cfg, "libgit2/src/streams" ) ;
57
+ add_c_files ( & mut cfg, "libgit2/src/libgit2/ transports" ) ;
58
+ add_c_files ( & mut cfg, "libgit2/src/libgit2/ streams" ) ;
57
59
58
60
// Always use bundled http-parser for now
59
61
cfg. include ( "libgit2/deps/http-parser" )
@@ -82,11 +84,11 @@ fn main() {
82
84
// when when COMPILE_PCRE8 is not defined, which is the default.
83
85
add_c_files ( & mut cfg, "libgit2/deps/pcre" ) ;
84
86
85
- cfg. file ( "libgit2/src/allocators/failalloc.c" ) ;
86
- cfg. file ( "libgit2/src/allocators/stdalloc.c" ) ;
87
+ cfg. file ( "libgit2/src/util/ allocators/failalloc.c" ) ;
88
+ cfg. file ( "libgit2/src/util/ allocators/stdalloc.c" ) ;
87
89
88
90
if windows {
89
- add_c_files ( & mut cfg, "libgit2/src/win32" ) ;
91
+ add_c_files ( & mut cfg, "libgit2/src/util/ win32" ) ;
90
92
cfg. define ( "STRSAFE_NO_DEPRECATE" , None ) ;
91
93
cfg. define ( "WIN32" , None ) ;
92
94
cfg. define ( "_WIN32_WINNT" , Some ( "0x0600" ) ) ;
@@ -98,7 +100,7 @@ fn main() {
98
100
cfg. define ( "__USE_MINGW_ANSI_STDIO" , "1" ) ;
99
101
}
100
102
} else {
101
- add_c_files ( & mut cfg, "libgit2/src/unix" ) ;
103
+ add_c_files ( & mut cfg, "libgit2/src/util/ unix" ) ;
102
104
cfg. flag ( "-fvisibility=hidden" ) ;
103
105
}
104
106
if target. contains ( "solaris" ) || target. contains ( "illumos" ) {
@@ -156,9 +158,9 @@ fn main() {
156
158
cfg. define ( "SHA1DC_NO_STANDARD_INCLUDES" , "1" ) ;
157
159
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_SHA1_C" , "\" common.h\" " ) ;
158
160
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C" , "\" common.h\" " ) ;
159
- cfg. file ( "libgit2/src/hash/sha1/collisiondetect.c" ) ;
160
- cfg. file ( "libgit2/src/hash/sha1/sha1dc/sha1.c" ) ;
161
- cfg. file ( "libgit2/src/hash/sha1/sha1dc/ubc_check.c" ) ;
161
+ cfg. file ( "libgit2/src/util/ hash/sha1/collisiondetect.c" ) ;
162
+ cfg. file ( "libgit2/src/util/ hash/sha1/sha1dc/sha1.c" ) ;
163
+ cfg. file ( "libgit2/src/util/ hash/sha1/sha1dc/ubc_check.c" ) ;
162
164
163
165
if let Some ( path) = env:: var_os ( "DEP_Z_INCLUDE" ) {
164
166
cfg. include ( path) ;
@@ -210,8 +212,12 @@ fn cp_r(from: impl AsRef<Path>, to: impl AsRef<Path>) {
210
212
}
211
213
212
214
fn add_c_files ( build : & mut cc:: Build , path : impl AsRef < Path > ) {
215
+ let path = path. as_ref ( ) ;
216
+ if !path. exists ( ) {
217
+ panic ! ( "Path {} does not exist" , path. display( ) ) ;
218
+ }
213
219
// sort the C files to ensure a deterministic build for reproducible builds
214
- let dir = path. as_ref ( ) . read_dir ( ) . unwrap ( ) ;
220
+ let dir = path. read_dir ( ) . unwrap ( ) ;
215
221
let mut paths = dir. collect :: < io:: Result < Vec < _ > > > ( ) . unwrap ( ) ;
216
222
paths. sort_by_key ( |e| e. path ( ) ) ;
217
223
0 commit comments