diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pydantic-core/0002-Dont-embed-RUSTFLAGS-in-final-binary.patch')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-pydantic-core/0002-Dont-embed-RUSTFLAGS-in-final-binary.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core/0002-Dont-embed-RUSTFLAGS-in-final-binary.patch b/meta-python/recipes-devtools/python/python3-pydantic-core/0002-Dont-embed-RUSTFLAGS-in-final-binary.patch new file mode 100644 index 0000000000..1c195e294b --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pydantic-core/0002-Dont-embed-RUSTFLAGS-in-final-binary.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From b3282b301096253a11b1f887f915d0a2a2183597 Mon Sep 17 00:00:00 2001 | ||
2 | From: Frank de Brabander <debrabander@gmail.com> | ||
3 | Date: Thu, 8 Aug 2024 08:04:48 +0200 | ||
4 | Subject: [PATCH] Dont embed RUSTFLAGS in final binary | ||
5 | |||
6 | Upstream-Status: Backport [https://github.com/pydantic/pydantic-core/commit/e07c41b3bad75948201a2201387225694c2fb501] | ||
7 | --- | ||
8 | build.rs | 9 +++++++++ | ||
9 | src/lib.rs | 5 ++++- | ||
10 | 2 files changed, 13 insertions(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/build.rs b/build.rs | ||
13 | index 7f59e1f..7fe6490 100644 | ||
14 | --- a/build.rs | ||
15 | +++ b/build.rs | ||
16 | @@ -35,6 +35,15 @@ fn main() { | ||
17 | if let Some(true) = version_check::supports_feature("coverage_attribute") { | ||
18 | println!("cargo:rustc-cfg=has_coverage_attribute"); | ||
19 | } | ||
20 | + | ||
21 | + if std::env::var("RUSTFLAGS") | ||
22 | + .unwrap_or_default() | ||
23 | + .contains("-Cprofile-use=") | ||
24 | + { | ||
25 | + println!("cargo:rustc-cfg=specified_profile_use"); | ||
26 | + } | ||
27 | + println!("cargo:rustc-check-cfg=cfg(specified_profile_use)"); | ||
28 | + | ||
29 | generate_self_schema(); | ||
30 | println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap()); | ||
31 | } | ||
32 | diff --git a/src/lib.rs b/src/lib.rs | ||
33 | index d55e836..206a7a1 100644 | ||
34 | --- a/src/lib.rs | ||
35 | +++ b/src/lib.rs | ||
36 | @@ -111,7 +111,10 @@ pub fn build_info() -> String { | ||
37 | format!( | ||
38 | "profile={} pgo={}", | ||
39 | env!("PROFILE"), | ||
40 | - option_env!("RUSTFLAGS").unwrap_or("").contains("-Cprofile-use="), | ||
41 | + // We use a `cfg!` here not `env!`/`option_env!` as those would | ||
42 | + // embed `RUSTFLAGS` into the generated binary which causes problems | ||
43 | + // with reproducable builds. | ||
44 | + cfg!(specified_profile_use), | ||
45 | ) | ||
46 | } | ||
47 | |||