-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sys): improve linking behavior, separate features for vendoring …
…DTLS - using mbedtls or tinydtls will no longer force usage of the vendored library version of mbedtls-sys-auto/tinydtls-sys by default - remove dependency on gnutls-sys crate as it is unmaintained, we now handle linking to gnutls ourselves - mbedtls-sys-auto is only used if mbedtls should be vendored, as the crate doesn't allow for disabling vendoring independently and doesn't support mbedtls >= 3.0.0 (see fortanix/rust-mbedtls#320) - in order to use the vendored versions of DTLS crate, you now have to enable the `dtls_backend_[BACKEND]_vendored` feature of libcoap-sys (or the `dtls_[BACKEND]_vendored` feature of libcoap-rs)
- Loading branch information
1 parent
287c26c
commit 1f16209
Showing
5 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ members = [ | |
"libcoap", | ||
"libcoap-sys", | ||
] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ authors = ["Hugo Hakim Damer <[email protected]>"] | |
categories = ["external-ffi-bindings", "network-programming", "embedded"] | ||
keywords = ["coap", "libcoap"] | ||
exclude = ["src/libcoap/ext/"] | ||
resolver = "2" | ||
|
||
[features] | ||
# The default features match those of libcoaps configure script, except for dtls, which is disabled here because it | ||
|
@@ -34,10 +35,13 @@ default = ["server", "client", "tcp", "async", "epoll", "vendored", "static"] | |
# different backends), we select one based on the auto-detection order specified in | ||
# https://github.com/obgm/libcoap/blob/develop/configure.ac#L494 (gnutls > openssl > mbedtls > tinydtls). | ||
dtls = [] | ||
dtls_backend_openssl = ["dtls", "openssl-sys"] | ||
dtls_backend_gnutls = ["dtls", "gnutls-sys"] | ||
dtls_backend_mbedtls = ["dtls", "mbedtls-sys-auto"] | ||
dtls_backend_tinydtls = ["dtls", "tinydtls-sys"] | ||
dtls_backend_openssl = ["dtls", "dep:openssl-sys"] | ||
dtls_backend_openssl_vendored = ["dtls_backend_openssl", "openssl-sys/vendored"] | ||
dtls_backend_gnutls = ["dtls"] | ||
dtls_backend_mbedtls = ["dtls"] # can't use mbedtls-sys-auto to generate linker flags here, as the crate doesn't support mbedtls >= 3.0.0 | ||
dtls_backend_mbedtls_vendored = ["dep:mbedtls-sys-auto", "dtls_backend_mbedtls"] | ||
dtls_backend_tinydtls = ["dtls", "dep:tinydtls-sys"] | ||
dtls_backend_tinydtls_vendored = ["dtls_backend_tinydtls", "tinydtls-sys/vendored"] | ||
# Enabling this feature will force libcoap-sys to be built with and statically linked to a vendored version of libcoap, | ||
# which will be built by the build-script before building libcoap-sys. | ||
# This way, it is no longer required to have libcoap installed to use this crate. | ||
|
@@ -61,11 +65,10 @@ client = [] | |
epoll = [] | ||
|
||
[dependencies] | ||
gnutls-sys = {version = "^0.1.2", optional = true} | ||
openssl-sys = {version = "^0.9.74", optional = true} | ||
mbedtls-sys-auto = {version = "^2.26", optional = true} | ||
libc = "^0.2.126" | ||
tinydtls-sys = {version = "^0.1.2", optional = true} | ||
tinydtls-sys = {version = "^0.1.2", default-features = false, optional = true} | ||
|
||
[build-dependencies] | ||
bindgen = "^0.65.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,18 @@ repository = "https://github.com/namib-project/libcoap-rs" | |
authors = ["Hugo Hakim Damer <[email protected]>"] | ||
categories = ["api-bindings", "network-programming", "embedded"] | ||
keywords = ["coap", "libcoap"] | ||
resolver = "2" | ||
|
||
[features] | ||
default = ["dtls", "tcp", "dtls_openssl"] | ||
dtls = ["libcoap-sys/dtls"] | ||
dtls_tinydtls = ["libcoap-sys/dtls_backend_tinydtls"] | ||
dtls_tinydtls_vendored = ["dtls_tinydtls", "libcoap-sys/dtls_backend_tinydtls_vendored"] | ||
dtls_openssl = ["libcoap-sys/dtls_backend_openssl"] | ||
dtls_openssl_vendored = ["dtls_openssl", "libcoap-sys/dtls_backend_openssl_vendored"] | ||
dtls_gnutls = ["libcoap-sys/dtls_backend_gnutls"] | ||
dtls_mbedtls = ["libcoap-sys/dtls_backend_mbedtls"] | ||
dtls_mbedtls_vendored = ["dtls_mbedtls", "libcoap-sys/dtls_backend_mbedtls_vendored"] | ||
tcp = [] | ||
nightly = [] | ||
vendored = ["libcoap-sys/vendored"] | ||
|