@@ -15,7 +15,7 @@ fn main() {
1515 if try_to_use_system_libgit2 {
1616 let mut cfg = pkg_config:: Config :: new ( ) ;
1717 if let Ok ( lib) = cfg
18- . range_version ( "1.4.0 " .."1.5.0" )
18+ . range_version ( "1.4.5 " .."1.5.0" )
1919 . print_system_libs ( false )
2020 . probe ( "libgit2" )
2121 {
@@ -45,21 +45,19 @@ fn main() {
4545 cp_r ( "libgit2/include" , & include) ;
4646
4747 cfg. include ( & include)
48- . include ( "libgit2/src/libgit2" )
49- . include ( "libgit2/src/util" )
48+ . include ( "libgit2/src" )
5049 . out_dir ( dst. join ( "build" ) )
5150 . warnings ( false ) ;
5251
5352 // 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" ) ;
5755
5856 // These are activated by features, but they're all unconditionally always
5957 // compiled apparently and have internal #define's to make sure they're
6058 // 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" ) ;
6361
6462 // Always use bundled http-parser for now
6563 cfg. include ( "libgit2/deps/http-parser" )
@@ -88,11 +86,11 @@ fn main() {
8886 // when when COMPILE_PCRE8 is not defined, which is the default.
8987 add_c_files ( & mut cfg, "libgit2/deps/pcre" ) ;
9088
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" ) ;
9391
9492 if windows {
95- add_c_files ( & mut cfg, "libgit2/src/util/ win32" ) ;
93+ add_c_files ( & mut cfg, "libgit2/src/win32" ) ;
9694 cfg. define ( "STRSAFE_NO_DEPRECATE" , None ) ;
9795 cfg. define ( "WIN32" , None ) ;
9896 cfg. define ( "_WIN32_WINNT" , Some ( "0x0600" ) ) ;
@@ -104,7 +102,7 @@ fn main() {
104102 cfg. define ( "__USE_MINGW_ANSI_STDIO" , "1" ) ;
105103 }
106104 } else {
107- add_c_files ( & mut cfg, "libgit2/src/util/ unix" ) ;
105+ add_c_files ( & mut cfg, "libgit2/src/unix" ) ;
108106 cfg. flag ( "-fvisibility=hidden" ) ;
109107 }
110108 if target. contains ( "solaris" ) || target. contains ( "illumos" ) {
@@ -162,9 +160,9 @@ fn main() {
162160 cfg. define ( "SHA1DC_NO_STANDARD_INCLUDES" , "1" ) ;
163161 cfg. define ( "SHA1DC_CUSTOM_INCLUDE_SHA1_C" , "\" common.h\" " ) ;
164162 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" ) ;
168166
169167 if let Some ( path) = env:: var_os ( "DEP_Z_INCLUDE" ) {
170168 cfg. include ( path) ;
@@ -216,12 +214,8 @@ fn cp_r(from: impl AsRef<Path>, to: impl AsRef<Path>) {
216214}
217215
218216fn 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- }
223217 // 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 ( ) ;
225219 let mut paths = dir. collect :: < io:: Result < Vec < _ > > > ( ) . unwrap ( ) ;
226220 paths. sort_by_key ( |e| e. path ( ) ) ;
227221
0 commit comments