@@ -14,11 +14,7 @@ fn main() {
1414 let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
1515 if try_to_use_system_libgit2 {
1616 let mut cfg = pkg_config:: Config :: new ( ) ;
17- if let Ok ( lib) = cfg
18- . range_version ( "1.4.0" .."1.5.0" )
19- . print_system_libs ( false )
20- . probe ( "libgit2" )
21- {
17+ if let Ok ( lib) = cfg. range_version ( "1.4.4" .."1.5.0" ) . probe ( "libgit2" ) {
2218 for include in & lib. include_paths {
2319 println ! ( "cargo:root={}" , include. display( ) ) ;
2420 }
@@ -162,9 +158,26 @@ fn main() {
162158 cfg. define ( "SHA1DC_NO_STANDARD_INCLUDES" , "1" ) ;
163159 cfg. define ( "SHA1DC_CUSTOM_INCLUDE_SHA1_C" , "\" common.h\" " ) ;
164160 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" ) ;
161+ cfg. file ( "libgit2/src/util/hash/collisiondetect.c" ) ;
162+ cfg. file ( "libgit2/src/util/hash/sha1dc/sha1.c" ) ;
163+ cfg. file ( "libgit2/src/util/hash/sha1dc/ubc_check.c" ) ;
164+
165+ if https {
166+ if windows {
167+ features. push_str ( "#define GIT_SHA256_WIN32 1\n " ) ;
168+ cfg. file ( "libgit2/src/util/hash/win32.c" ) ;
169+ } else if target. contains ( "apple" ) {
170+ features. push_str ( "#define GIT_SHA256_COMMON_CRYPTO 1\n " ) ;
171+ cfg. file ( "libgit2/src/util/hash/common_crypto.c" ) ;
172+ } else {
173+ features. push_str ( "#define GIT_SHA256_OPENSSL 1\n " ) ;
174+ cfg. file ( "libgit2/src/util/hash/openssl.c" ) ;
175+ }
176+ } else {
177+ features. push_str ( "#define GIT_SHA256_BUILTIN 1\n " ) ;
178+ cfg. file ( "libgit2/src/util/hash/builtin.c" ) ;
179+ cfg. file ( "libgit2/src/util/hash/rfc6234/sha224-256.c" ) ;
180+ }
168181
169182 if let Some ( path) = env:: var_os ( "DEP_Z_INCLUDE" ) {
170183 cfg. include ( path) ;
0 commit comments