Skip to content

Commit cc49440

Browse files
authored
Fix windows build (#337)
* add CI for windows build with only `std` feature * fix windows build * bump version
1 parent 590419a commit cc49440

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,19 @@ case "$TRAVIS_RUST_VERSION" in
4343
cargo nextest run --no-default-features --features "$FEAT"no_std_deps,rdrand,time --target $TARGET
4444
cargo nextest run --no-default-features --features "$FEAT"no_std_deps --target $TARGET
4545
fi
46-
if [ "$TARGET" == "x86_64-apple-darwin" ]; then
47-
cargo nextest run --no-default-features --features no_std_deps --target $TARGET
48-
fi
49-
5046
else
5147
cargo +$TRAVIS_RUST_VERSION test --no-run --features "$FEAT" --target=$TARGET
5248
fi
5349
done
5450

51+
if [ "$TARGET" == "x86_64-apple-darwin" ]; then
52+
cargo nextest run --no-default-features --features no_std_deps --target $TARGET
53+
fi
54+
# special case: mbedtls should compile successfully on windows only with `std` feature
55+
if [[ "$TARGET" =~ ^x86_64-pc-windows- ]]; then
56+
cargo nextest run --no-default-features --features std --target $TARGET
57+
fi
58+
5559
# The SGX target cannot be run under test like a ELF binary
5660
if [ "$TARGET" != "x86_64-fortanix-unknown-sgx" ]; then
5761
cargo nextest run --test async_session --features=async-rt,ssl --target $TARGET

mbedtls/Cargo.toml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mbedtls"
33
# We jumped from v0.9 to v0.12 because v0.10 and v0.11 were based on mbedtls 3.X, which
44
# we decided not to support.
5-
version = "0.12.0"
5+
version = "0.12.1"
66
authors = ["Jethro Beekman <[email protected]>"]
77
build = "build.rs"
88
edition = "2018"
@@ -17,14 +17,17 @@ environment."""
1717
readme = "../README.md"
1818
repository = "https://github.com/fortanix/rust-mbedtls"
1919
documentation = "https://docs.rs/mbedtls/"
20-
keywords = ["MbedTLS","mbed","TLS","SSL","cryptography"]
20+
keywords = ["MbedTLS", "mbed", "TLS", "SSL", "cryptography"]
2121

2222
[dependencies]
2323
bitflags = "1"
2424
serde = { version = "1.0.7", default-features = false, features = ["alloc"] }
2525
serde_derive = "1.0.7"
2626
byteorder = { version = "1.0.0", default-features = false }
27-
yasna = { version = "0.2", optional = true, features = ["num-bigint", "bit-vec"] }
27+
yasna = { version = "0.2", optional = true, features = [
28+
"num-bigint",
29+
"bit-vec",
30+
] }
2831
num-bigint = { version = "0.2", optional = true }
2932
bit-vec = { version = "0.5", optional = true }
3033
cbc = { version = "0.1.2", optional = true }
@@ -33,18 +36,15 @@ cfg-if = "1.0.0"
3336
tokio = { version = "1.16.1", optional = true }
3437
chrono = { version = "0.4", optional = true }
3538

36-
[target.x86_64-fortanix-unknown-sgx.dependencies]
37-
rs-libc = "0.2.0"
39+
mbedtls-sys-auto = { path = "../mbedtls-sys", version = "2.25.0", default-features = false, features = [
40+
"trusted_cert_callback",
41+
"threading",
42+
] }
3843

39-
[dependencies.mbedtls-sys-auto]
40-
version = "2.25.0"
41-
default-features = false
42-
features = ["trusted_cert_callback", "threading"]
43-
path = "../mbedtls-sys"
44+
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support" }
4445

45-
[dependencies.mbedtls-platform-support]
46-
version = "0.1"
47-
path = "../mbedtls-platform-support"
46+
[target.x86_64-fortanix-unknown-sgx.dependencies]
47+
rs-libc = "0.2.0"
4848

4949
[dev-dependencies]
5050
libc = "0.2.0"
@@ -62,10 +62,15 @@ pin-project-lite = "0.2"
6262
cc = "1.0"
6363

6464
# feature 'time` is necessary under windows
65-
[target.'cfg(target_os = "windows")'.mbedtls-platform-support]
66-
version = "0.1"
67-
path = "../mbedtls-platform-support"
68-
features = ["time"]
65+
[target.'cfg(target_env = "msvc")'.dependencies]
66+
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support", features = [
67+
"time",
68+
] }
69+
mbedtls-sys-auto = { path = "../mbedtls-sys", version = "2.25.0", default-features = false, features = [
70+
"trusted_cert_callback",
71+
"threading",
72+
"time",
73+
] }
6974

7075
[features]
7176
# Features are documented in the README
@@ -74,7 +79,13 @@ x509 = []
7479
ssl = ["x509"]
7580

7681
default = ["std", "aesni", "time", "padlock"]
77-
std = ["byteorder/std", "mbedtls-sys-auto/std", "serde/std", "yasna", "mbedtls-platform-support/std"]
82+
std = [
83+
"byteorder/std",
84+
"mbedtls-sys-auto/std",
85+
"serde/std",
86+
"yasna",
87+
"mbedtls-platform-support/std",
88+
]
7889
debug = ["mbedtls-sys-auto/debug"]
7990
no_std_deps = ["mbedtls-platform-support/spin", "serde/alloc"]
8091
force_aesni_support = ["mbedtls-platform-support/force_aesni_support", "aesni"]
@@ -88,7 +99,7 @@ dsa = ["std", "yasna", "num-bigint", "bit-vec"]
8899
pkcs12 = ["std", "yasna", "x509"]
89100
pkcs12_rc2 = ["pkcs12", "rc2", "cbc"]
90101
legacy_protocols = ["mbedtls-sys-auto/legacy_protocols", "ssl"]
91-
async = ["std", "tokio","tokio/net","tokio/io-util", "tokio/macros"]
102+
async = ["std", "tokio", "tokio/net", "tokio/io-util", "tokio/macros"]
92103
async-rt = ["async", "tokio/rt", "tokio/sync", "tokio/rt-multi-thread"]
93104

94105
[[example]]

0 commit comments

Comments
 (0)