@@ -14,7 +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. range_version ( "1.6.4 " .."1.7 .0" ) . probe ( "libgit2" ) {
17+ if let Ok ( lib) = cfg. range_version ( "1.7.0 " .."1.8 .0" ) . probe ( "libgit2" ) {
1818 for include in & lib. include_paths {
1919 println ! ( "cargo:root={}" , include. display( ) ) ;
2020 }
@@ -49,7 +49,6 @@ fn main() {
4949 // Include all cross-platform C files
5050 add_c_files ( & mut cfg, "libgit2/src/libgit2" ) ;
5151 add_c_files ( & mut cfg, "libgit2/src/util" ) ;
52- add_c_files ( & mut cfg, "libgit2/src/libgit2/xdiff" ) ;
5352
5453 // These are activated by features, but they're all unconditionally always
5554 // compiled apparently and have internal #define's to make sure they're
@@ -61,6 +60,10 @@ fn main() {
6160 cfg. include ( "libgit2/deps/http-parser" )
6261 . file ( "libgit2/deps/http-parser/http_parser.c" ) ;
6362
63+ // external/system xdiff is not yet supported
64+ cfg. include ( "libgit2/deps/xdiff" ) ;
65+ add_c_files ( & mut cfg, "libgit2/deps/xdiff" ) ;
66+
6467 // Use the included PCRE regex backend.
6568 //
6669 // Ideally these defines would be specific to the pcre files (or placed in
@@ -119,6 +122,14 @@ fn main() {
119122 features. push_str ( "#define GIT_USE_NSEC 1\n " ) ;
120123 }
121124
125+ if windows {
126+ features. push_str ( "#define GIT_IO_WSAPOLL 1\n " ) ;
127+ } else {
128+ // Should we fallback to `select` as more systems have that?
129+ features. push_str ( "#define GIT_IO_POLL 1\n " ) ;
130+ features. push_str ( "#define GIT_IO_SELECT 1\n " ) ;
131+ }
132+
122133 if target. contains ( "apple" ) {
123134 features. push_str ( "#define GIT_USE_STAT_MTIMESPEC 1\n " ) ;
124135 } else {
@@ -199,6 +210,7 @@ fn main() {
199210 println ! ( "cargo:rustc-link-lib=rpcrt4" ) ;
200211 println ! ( "cargo:rustc-link-lib=ole32" ) ;
201212 println ! ( "cargo:rustc-link-lib=crypt32" ) ;
213+ println ! ( "cargo:rustc-link-lib=secur32" ) ;
202214 }
203215
204216 if target. contains ( "apple" ) {
0 commit comments