@@ -14,11 +14,7 @@ fn main() {
14
14
let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
15
15
if try_to_use_system_libgit2 {
16
16
let mut cfg = pkg_config:: Config :: new ( ) ;
17
- if let Ok ( lib) = cfg
18
- . range_version ( "1.4.3" .."1.5.0" )
19
- . print_system_libs ( false )
20
- . probe ( "libgit2" )
21
- {
17
+ if let Ok ( lib) = cfg. range_version ( "1.4.3" .."1.5.0" ) . probe ( "libgit2" ) {
22
18
for include in & lib. include_paths {
23
19
println ! ( "cargo:root={}" , include. display( ) ) ;
24
20
}
@@ -45,20 +41,21 @@ fn main() {
45
41
cp_r ( "libgit2/include" , & include) ;
46
42
47
43
cfg. include ( & include)
48
- . include ( "libgit2/src" )
44
+ . include ( "libgit2/src/libgit2 " )
49
45
. include ( "libgit2/src/util" )
50
46
. out_dir ( dst. join ( "build" ) )
51
47
. warnings ( false ) ;
52
48
53
49
// Include all cross-platform C files
54
- add_c_files ( & mut cfg, "libgit2/src" ) ;
55
- 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" ) ;
56
53
57
54
// These are activated by features, but they're all unconditionally always
58
55
// compiled apparently and have internal #define's to make sure they're
59
56
// compiled correctly.
60
- add_c_files ( & mut cfg, "libgit2/src/transports" ) ;
61
- 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" ) ;
62
59
63
60
// Always use bundled http-parser for now
64
61
cfg. include ( "libgit2/deps/http-parser" )
@@ -87,11 +84,11 @@ fn main() {
87
84
// when when COMPILE_PCRE8 is not defined, which is the default.
88
85
add_c_files ( & mut cfg, "libgit2/deps/pcre" ) ;
89
86
90
- cfg. file ( "libgit2/src/allocators/failalloc.c" ) ;
91
- 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" ) ;
92
89
93
90
if windows {
94
- add_c_files ( & mut cfg, "libgit2/src/win32" ) ;
91
+ add_c_files ( & mut cfg, "libgit2/src/util/ win32" ) ;
95
92
cfg. define ( "STRSAFE_NO_DEPRECATE" , None ) ;
96
93
cfg. define ( "WIN32" , None ) ;
97
94
cfg. define ( "_WIN32_WINNT" , Some ( "0x0600" ) ) ;
@@ -103,7 +100,7 @@ fn main() {
103
100
cfg. define ( "__USE_MINGW_ANSI_STDIO" , "1" ) ;
104
101
}
105
102
} else {
106
- add_c_files ( & mut cfg, "libgit2/src/unix" ) ;
103
+ add_c_files ( & mut cfg, "libgit2/src/util/ unix" ) ;
107
104
cfg. flag ( "-fvisibility=hidden" ) ;
108
105
}
109
106
if target. contains ( "solaris" ) || target. contains ( "illumos" ) {
@@ -161,9 +158,26 @@ fn main() {
161
158
cfg. define ( "SHA1DC_NO_STANDARD_INCLUDES" , "1" ) ;
162
159
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_SHA1_C" , "\" common.h\" " ) ;
163
160
cfg. define ( "SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C" , "\" common.h\" " ) ;
164
- cfg. file ( "libgit2/src/hash/sha1/collisiondetect.c" ) ;
165
- cfg. file ( "libgit2/src/hash/sha1/sha1dc/sha1.c" ) ;
166
- cfg. file ( "libgit2/src/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
+ }
167
181
168
182
if let Some ( path) = env:: var_os ( "DEP_Z_INCLUDE" ) {
169
183
cfg. include ( path) ;
0 commit comments