Export OPENSSL_NO_* defines in bssl-sys for consumption in rust-openssl
This is currently done by duplicating the list of constants. This was done for two reasons: 1) bindgen doesn't seem to do anything with bare-defines, 2) the list of defines appears to change incredibly rarely.
The `links` key is required in `Cargo.toml` to work around https://github.com/rust-lang/cargo/issues/3544
Change-Id: I11dca6e7eb62ab1b04053df654a4061cb5e25723
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63305
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/include/openssl/opensslconf.h b/include/openssl/opensslconf.h
index 5165703..feb9246 100644
--- a/include/openssl/opensslconf.h
+++ b/include/openssl/opensslconf.h
@@ -18,6 +18,7 @@
#ifndef OPENSSL_HEADER_OPENSSLCONF_H
#define OPENSSL_HEADER_OPENSSLCONF_H
+/* Keep in sync with the list in rust/bssl-sys/build.rs */
#define OPENSSL_NO_ASYNC
#define OPENSSL_NO_BF
diff --git a/rust/bssl-sys/Cargo.toml b/rust/bssl-sys/Cargo.toml
index 634ed3c..b01979a 100644
--- a/rust/bssl-sys/Cargo.toml
+++ b/rust/bssl-sys/Cargo.toml
@@ -5,3 +5,7 @@
edition = "2018"
publish = false
license = "MIT"
+
+# This exists to workaround a limitation in cargo:
+# https://github.com/rust-lang/cargo/issues/3544
+links = "bssl"
diff --git a/rust/bssl-sys/build.rs b/rust/bssl-sys/build.rs
index 2d7461a..91a9f8a 100644
--- a/rust/bssl-sys/build.rs
+++ b/rust/bssl-sys/build.rs
@@ -17,6 +17,57 @@
use std::path::Path;
use std::path::PathBuf;
+// Keep in sync with the list in include/openssl/opensslconf.h
+const OSSL_CONF_DEFINES: &[&str] = &[
+ "OPENSSL_NO_ASYNC",
+ "OPENSSL_NO_BF",
+ "OPENSSL_NO_BLAKE2",
+ "OPENSSL_NO_BUF_FREELISTS",
+ "OPENSSL_NO_CAMELLIA",
+ "OPENSSL_NO_CAPIENG",
+ "OPENSSL_NO_CAST",
+ "OPENSSL_NO_CMS",
+ "OPENSSL_NO_COMP",
+ "OPENSSL_NO_CT",
+ "OPENSSL_NO_DANE",
+ "OPENSSL_NO_DEPRECATED",
+ "OPENSSL_NO_DGRAM",
+ "OPENSSL_NO_DYNAMIC_ENGINE",
+ "OPENSSL_NO_EC_NISTP_64_GCC_128",
+ "OPENSSL_NO_EC2M",
+ "OPENSSL_NO_EGD",
+ "OPENSSL_NO_ENGINE",
+ "OPENSSL_NO_GMP",
+ "OPENSSL_NO_GOST",
+ "OPENSSL_NO_HEARTBEATS",
+ "OPENSSL_NO_HW",
+ "OPENSSL_NO_IDEA",
+ "OPENSSL_NO_JPAKE",
+ "OPENSSL_NO_KRB5",
+ "OPENSSL_NO_MD2",
+ "OPENSSL_NO_MDC2",
+ "OPENSSL_NO_OCB",
+ "OPENSSL_NO_OCSP",
+ "OPENSSL_NO_RC2",
+ "OPENSSL_NO_RC5",
+ "OPENSSL_NO_RFC3779",
+ "OPENSSL_NO_RIPEMD",
+ "OPENSSL_NO_RMD160",
+ "OPENSSL_NO_SCTP",
+ "OPENSSL_NO_SEED",
+ "OPENSSL_NO_SM2",
+ "OPENSSL_NO_SM3",
+ "OPENSSL_NO_SM4",
+ "OPENSSL_NO_SRP",
+ "OPENSSL_NO_SSL_TRACE",
+ "OPENSSL_NO_SSL2",
+ "OPENSSL_NO_SSL3",
+ "OPENSSL_NO_SSL3_METHOD",
+ "OPENSSL_NO_STATIC_ENGINE",
+ "OPENSSL_NO_STORE",
+ "OPENSSL_NO_WHIRLPOOL",
+];
+
fn get_bssl_build_dir() -> PathBuf {
println!("cargo:rerun-if-env-changed=BORINGSSL_BUILD_DIR");
if let Some(build_dir) = env::var_os("BORINGSSL_BUILD_DIR") {
@@ -54,4 +105,6 @@
bssl_sys_build_dir.display()
);
println!("cargo:rustc-link-lib=static=rust_wrapper");
+
+ println!("cargo:conf={}", OSSL_CONF_DEFINES.join(","));
}