MCPcopy Index your code
hub / github.com/RustPython/RustPython / main

Function main

crates/stdlib/build.rs:3–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1// spell-checker:ignore ossl osslconf
2
3fn main() {
4 println!(r#"cargo::rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_COMP"))"#);
5 println!(r#"cargo::rustc-check-cfg=cfg(openssl_vendored)"#);
6
7 #[allow(
8 clippy::unusual_byte_groupings,
9 reason = "hex groups follow OpenSSL version field boundaries"
10 )]
11 let ossl_vers = [
12 (0x1_00_01_00_0, "ossl101"),
13 (0x1_00_02_00_0, "ossl102"),
14 (0x1_01_00_00_0, "ossl110"),
15 (0x1_01_00_07_0, "ossl110g"),
16 (0x1_01_00_08_0, "ossl110h"),
17 (0x1_01_01_00_0, "ossl111"),
18 (0x1_01_01_04_0, "ossl111d"),
19 (0x3_00_00_00_0, "ossl300"),
20 (0x3_01_00_00_0, "ossl310"),
21 (0x3_02_00_00_0, "ossl320"),
22 (0x3_03_00_00_0, "ossl330"),
23 ];
24
25 for (_, cfg) in ossl_vers {
26 println!("cargo::rustc-check-cfg=cfg({cfg})");
27 }
28
29 #[cfg(feature = "ssl-openssl")]
30 {
31 #[allow(
32 clippy::unusual_byte_groupings,
33 reason = "OpenSSL version number is parsed with grouped hex fields"
34 )]
35 if let Ok(v) = std::env::var("DEP_OPENSSL_VERSION_NUMBER") {
36 println!("cargo:rustc-env=OPENSSL_API_VERSION={v}");
37 // cfg setup from openssl crate's build script
38 let version = u64::from_str_radix(&v, 16).unwrap();
39 for (ver, cfg) in ossl_vers {
40 if version >= ver {
41 println!("cargo:rustc-cfg={cfg}");
42 }
43 }
44 }
45 if let Ok(v) = std::env::var("DEP_OPENSSL_CONF") {
46 for conf in v.split(',') {
47 println!("cargo:rustc-cfg=osslconf=\"{conf}\"");
48 }
49 }
50 // it's possible for openssl-sys to link against the system openssl under certain conditions,
51 // so let the ssl module know to only perform a probe if we're actually vendored
52 if std::env::var("DEP_OPENSSL_VENDORED").is_ok_and(|s| s == "1") {
53 println!("cargo::rustc-cfg=openssl_vendored")
54 }
55 }
56}

Callers

nothing calls this directly

Calls 2

unwrapMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected