@@ -15,7 +15,7 @@ fn main() {
15
15
if try_to_use_system_libgit2 {
16
16
let mut cfg = pkg_config:: Config :: new ( ) ;
17
17
if let Ok ( lib) = cfg
18
- . range_version ( "1.4.0 " .."1.5.0" )
18
+ . range_version ( "1.4.5 " .."1.5.0" )
19
19
. print_system_libs ( false )
20
20
. probe ( "libgit2" )
21
21
{
@@ -45,21 +45,19 @@ fn main() {
45
45
cp_r ( "libgit2/include" , & include) ;
46
46
47
47
cfg. include ( & include)
48
- . include ( "libgit2/src/libgit2" )
49
- . include ( "libgit2/src/util" )
48
+ . include ( "libgit2/src" )
50
49
. out_dir ( dst. join ( "build" ) )
51
50
. warnings ( false ) ;
52
51
53
52
// Include all cross-platform C files
54
- add_c_files ( & mut cfg, "libgit2/src/libgit2" ) ;
55
- add_c_files ( & mut cfg, "libgit2/src/util" ) ;
56
- add_c_files ( & mut cfg, "libgit2/src/libgit2/xdiff" ) ;
53
+ add_c_files ( & mut cfg, "libgit2/src" ) ;
54
+ add_c_files ( & mut cfg, "libgit2/src/xdiff" ) ;
57
55
58
56
// These are activated by features, but they're all unconditionally always
59
57
// compiled apparently and have internal #define's to make sure they're
60
58
// compiled correctly.
61
- add_c_files ( & mut cfg, "libgit2/src/libgit2/ transports" ) ;
62
- add_c_files ( & mut cfg, "libgit2/src/libgit2/ streams" ) ;
59
+ add_c_files ( & mut cfg, "libgit2/src/transports" ) ;
60
+ add_c_files ( & mut cfg, "libgit2/src/streams" ) ;
63
61
64
62
// Always use bundled http-parser for now
65
63
cfg. include ( "libgit2/deps/http-parser" )
@@ -88,11 +86,11 @@ fn main() {
88
86
// when when COMPILE_PCRE8 is not defined, which is the default.
89
87
add_c_files ( & mut cfg, "libgit2/deps/pcre" ) ;
90
88
91
- cfg. file ( "libgit2/src/util/ allocators/failalloc.c" ) ;
92
- cfg. file ( "libgit2/src/util/ allocators/stdalloc.c" ) ;
89
+ cfg. file ( "libgit2/src/allocators/failalloc.c" ) ;
90
+ cfg. file ( "libgit2/src/allocators/stdalloc.c" ) ;
93
91
94
92
if windows {
95
- add_c_files ( & mut cfg, "libgit2/src/util/ win32" ) ;
93
+ add_c_files ( & mut cfg, "libgit2/src/win32" ) ;
96
94
cfg. define ( "STRSAFE_NO_DEPRECATE" , None ) ;
97
95
cfg. define ( "WIN32" , None ) ;
98
96
cfg. define ( "_WIN32_WINNT" , Some ( "0x0600" ) ) ;
@@ -104,7 +102,7 @@ fn main() {
104
102
cfg. define ( "__USE_MINGW_ANSI_STDIO" , "1" ) ;
105
103
}
106
104
} else {
107
- add_c_files ( & mut cfg, "libgit2/src/util/ unix" ) ;
105
+ add_c_files ( & mut cfg, "libgit2/src/unix" ) ;
108
106
cfg. flag ( "-fvisibility=hidden" ) ;
109
107
}
110
108
if target. contains ( "solaris" ) || target. contains ( "illumos" ) {
@@ -162,9 +160,9 @@ fn main() {
162
160
cfg. define ( "SHA1DC_NO_STANDARD_INCLUDES" , "1" ) ;
163
161
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_SHA1_C" , "\" common.h\" " ) ;
164
162
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C" , "\" common.h\" " ) ;
165
- cfg. file ( "libgit2/src/util/ hash/sha1/collisiondetect.c" ) ;
166
- cfg. file ( "libgit2/src/util/ hash/sha1/sha1dc/sha1.c" ) ;
167
- cfg. file ( "libgit2/src/util/ hash/sha1/sha1dc/ubc_check.c" ) ;
163
+ cfg. file ( "libgit2/src/hash/sha1/collisiondetect.c" ) ;
164
+ cfg. file ( "libgit2/src/hash/sha1/sha1dc/sha1.c" ) ;
165
+ cfg. file ( "libgit2/src/hash/sha1/sha1dc/ubc_check.c" ) ;
168
166
169
167
if let Some ( path) = env:: var_os ( "DEP_Z_INCLUDE" ) {
170
168
cfg. include ( path) ;
@@ -216,12 +214,8 @@ fn cp_r(from: impl AsRef<Path>, to: impl AsRef<Path>) {
216
214
}
217
215
218
216
fn add_c_files ( build : & mut cc:: Build , path : impl AsRef < Path > ) {
219
- let path = path. as_ref ( ) ;
220
- if !path. exists ( ) {
221
- panic ! ( "Path {} does not exist" , path. display( ) ) ;
222
- }
223
217
// sort the C files to ensure a deterministic build for reproducible builds
224
- let dir = path. read_dir ( ) . unwrap ( ) ;
218
+ let dir = path. as_ref ( ) . read_dir ( ) . unwrap ( ) ;
225
219
let mut paths = dir. collect :: < io:: Result < Vec < _ > > > ( ) . unwrap ( ) ;
226
220
paths. sort_by_key ( |e| e. path ( ) ) ;
227
221
0 commit comments