Skip to content

Commit 7d835d0

Browse files
committed
Add documentation around the links metadata handling from the aws-lc(-fips)-sys crate.
1 parent 75e4fd2 commit 7d835d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

openssl-sys/build/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ fn check_ssl_kind() {
7979
println!("cargo:rustc-cfg=awslc");
8080
println!("cargo:awslc=true");
8181

82+
// The aws-lc-sys and aws-lc-fips-sys crate use a link name that embeds
83+
// the version number of crate. Examples (crate-name => links name):
84+
// * aws-lc-sys => aws_lc_0_26_0
85+
// * aws-lc-fips-sys => aws_lc_fips_0_13_3
86+
// This is done to avoid issues if the cargo dependency graph for an application
87+
// were to resolve to multiple versions for the same crate.
88+
//
89+
// Due to this we need to determine what version of the AWS-LC has been selected (fips or non-fips)
90+
// and then need to parse out the pieces we are interested in ignoring the version componenet of the name.
8291
let env_var_prefix = match (is_aws_lc, is_aws_lc_fips) {
8392
(true, false) => "DEP_AWS_LC_",
8493
(false, true) => "DEP_AWS_LC_FIPS_",
@@ -98,13 +107,16 @@ fn check_ssl_kind() {
98107
}
99108
let version = version.expect("aws-lc version detected");
100109

110+
// Read the OpenSSL configuration statements and emit rust-cfg for each.
101111
if let Ok(vars) = std::env::var(format!("{env_var_prefix}{version}_CONF")) {
102112
for var in vars.split(',') {
103113
println!("cargo:rustc-cfg=osslconf=\"{var}\"");
104114
}
105115
println!("cargo:conf={vars}");
106116
}
107117

118+
// Emit the include header directory from the aws-lc(-fips)-sys crate so that it can be used if needed
119+
// by crates consuming openssl-sys.
108120
if let Ok(val) = std::env::var(format!("{env_var_prefix}{version}_INCLUDE")) {
109121
println!("cargo:include={val}");
110122
}

0 commit comments

Comments
 (0)