Skip to content

Commit 1fa244d

Browse files
committed
Works under old crypto API
macOS before 10.7 requires to use OpenSSL because a lot of things is missed.
1 parent a2a413c commit 1fa244d

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

vendor/crypto-hash/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ license = "MIT"
2323
repository = "https://github.com/malept/crypto-hash"
2424
[dependencies.hex]
2525
version = "0.3"
26-
[target."cfg(not(any(target_os = \"windows\", target_os = \"macos\")))".dependencies.openssl]
26+
[target."cfg(not(any(target_os = \"windows\")))".dependencies.openssl]
2727
version = "0.10"
2828
[target."cfg(target_os = \"macos\")".dependencies.commoncrypto]
2929
version = "0.2"

vendor/crypto-hash/build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use std::env;
2+
3+
fn main() {
4+
if env::var("CRYPTO_HASH_FORCE_OPENSSL").is_ok() {
5+
println!("cargo:rustc-cfg=feature=\"openssl\"");
6+
return;
7+
}
8+
9+
#[cfg(all(target_os = "macos", not(target_os = "windows")))]
10+
println!("cargo:rustc-cfg=feature=\"commoncrypto\"");
11+
12+
#[cfg(all(not(target_os = "macos"), target_os = "windows"))]
13+
println!("cargo:rustc-cfg=feature=\"winapi\"");
14+
15+
#[cfg(all(not(target_os = "macos"), not(target_os = "windows")))]
16+
println!("cargo:rustc-cfg=feature=\"openssl\"");
17+
}

vendor/crypto-hash/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@
4343
4444
#![warn(missing_docs)]
4545

46-
#[cfg(target_os = "macos")]
46+
#[cfg(feature = "commoncrypto")]
4747
extern crate commoncrypto;
4848
extern crate hex;
49-
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
49+
#[cfg(feature = "openssl")]
5050
extern crate openssl;
51-
#[cfg(target_os = "windows")]
51+
#[cfg(feature = "winapi")]
5252
extern crate winapi;
5353

5454
use std::io::Write;
5555

56-
#[cfg(target_os = "macos")]
56+
#[cfg(feature = "commoncrypto")]
5757
#[path = "imp/commoncrypto.rs"]
5858
mod imp;
59-
#[cfg(target_os = "windows")]
59+
#[cfg(feature = "winapi")]
6060
#[path = "imp/cryptoapi.rs"]
6161
mod imp;
62-
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
62+
#[cfg(feature = "openssl")]
6363
#[path = "imp/openssl.rs"]
6464
mod imp;
6565

vendor/libgit2-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn main() {
132132

133133
if windows {
134134
features.push_str("#define GIT_WINHTTP 1\n");
135-
} else if target.contains("apple") {
135+
} else if target.contains("apple") && cfg!(not(feature = "macos_before_10_7")) {
136136
features.push_str("#define GIT_SECURE_TRANSPORT 1\n");
137137
} else {
138138
features.push_str("#define GIT_OPENSSL 1\n");

0 commit comments

Comments
 (0)