Skip to content

Commit b0b6c68

Browse files
authored
Add vendored field to Version information. (#409)
1 parent ccc6e5a commit b0b6c68

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

curl-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ fn main() {
6464
println!("cargo:root={}", dst.display());
6565
println!("cargo:include={}", include.display());
6666
println!("cargo:static=1");
67+
println!("cargo:rustc-cfg=libcurl_vendored");
6768
fs::create_dir_all(include.join("curl")).unwrap();
6869

6970
for header in [

curl-sys/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,3 +1111,8 @@ extern "C" {
11111111
pub fn rust_crate_version() -> &'static str {
11121112
env!("CARGO_PKG_VERSION")
11131113
}
1114+
1115+
#[doc(hidden)]
1116+
pub fn vendored() -> bool {
1117+
cfg!(libcurl_vendored)
1118+
}

src/version.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ impl Version {
5151
unsafe { (*self.inner).version_num as u32 }
5252
}
5353

54+
/// Returns true if this was built with the vendored version of libcurl.
55+
pub fn vendored(&self) -> bool {
56+
curl_sys::vendored()
57+
}
58+
5459
/// Returns a human readable string of the host libcurl is built for.
5560
///
5661
/// This is discovered as part of the build environment.
@@ -389,6 +394,7 @@ impl fmt::Debug for Version {
389394
f.field("version", &self.version())
390395
.field("rust_crate_version", &env!("CARGO_PKG_VERSION"))
391396
.field("rust_sys_crate_version", &curl_sys::rust_crate_version())
397+
.field("vendored", &self.vendored())
392398
.field("host", &self.host())
393399
.field("feature_ipv6", &self.feature_ipv6())
394400
.field("feature_ssl", &self.feature_ssl())

0 commit comments

Comments
 (0)