diff --git a/include/openssl/opensslconf.h b/include/openssl/opensslconf.h index 5165703017..feb9246c0a 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 634ed3cf7f..b01979a3a8 100644 --- a/rust/bssl-sys/Cargo.toml +++ b/rust/bssl-sys/Cargo.toml @@ -5,3 +5,7 @@ authors = ["Benjamin Brittain "] 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 2d7461ab99..91a9f8a8e7 100644 --- a/rust/bssl-sys/build.rs +++ b/rust/bssl-sys/build.rs @@ -17,6 +17,57 @@ use std::env; 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 @@ fn main() { bssl_sys_build_dir.display() ); println!("cargo:rustc-link-lib=static=rust_wrapper"); + + println!("cargo:conf={}", OSSL_CONF_DEFINES.join(",")); }