python3Packages.orjson: fix cross compilation patch
This commit is contained in:
@@ -12,33 +12,37 @@ riscv64, leading to compilation errors.
|
||||
Now uses CARGO_CFG_TARGET_ARCH environment variable to correctly
|
||||
detect the target architecture during cross-compilation.
|
||||
---
|
||||
build.rs | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
build.rs | 7 ++++++--
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/build.rs b/build.rs
|
||||
index 42788623..28e006a9 100644
|
||||
index 49a9a9a4..0a99698d 100644
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -38,8 +38,11 @@ fn main() {
|
||||
@@ -11,6 +11,9 @@ fn main() {
|
||||
#[allow(unused_variables)]
|
||||
let is_64_bit_python = matches!(python_config.pointer_width, Some(64));
|
||||
|
||||
- #[cfg(all(target_arch = "x86_64", not(target_os = "macos")))]
|
||||
- if version_check::is_min_version("1.89.0").unwrap_or(false) && is_64_bit_python {
|
||||
+ let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
|
||||
+ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||
+ let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
|
||||
+ let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||
+
|
||||
+ if target_arch == "x86_64" && target_os != "macos"
|
||||
+ && version_check::is_min_version("1.89.0").unwrap_or(false) && is_64_bit_python {
|
||||
match python_config.implementation {
|
||||
pyo3_build_config::PythonImplementation::CPython => {
|
||||
println!("cargo:rustc-cfg=CPython");
|
||||
@@ -18,7 +21,7 @@ fn main() {
|
||||
println!("cargo:rustc-cfg=CPython");
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
||||
- if is_64_bit_python {
|
||||
+ if (target_arch == "x86_64" || target_arch == "aarch64") && is_64_bit_python {
|
||||
println!("cargo:rustc-cfg=feature=\"inline_int\"");
|
||||
#[cfg(target_endian = "little")]
|
||||
println!("cargo:rustc-cfg=feature=\"inline_str\"");
|
||||
}
|
||||
@@ -50,7 +53,7 @@ fn main() {
|
||||
println!("cargo:rustc-check-cfg=cfg(PyPy)");
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", not(target_os = "macos")))]
|
||||
- if is_64_bit_python {
|
||||
+ if target_arch == "x86_64" && target_os != "macos" && is_64_bit_python {
|
||||
println!("cargo:rustc-cfg=feature=\"avx512\"");
|
||||
}
|
||||
|
||||
@@ -51,8 +54,7 @@ fn main() {
|
||||
println!("cargo:rustc-cfg=feature=\"optimize\"");
|
||||
}
|
||||
|
||||
- #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
||||
- if is_64_bit_python {
|
||||
+ if (target_arch == "x86_64" || target_arch == "aarch64") && is_64_bit_python {
|
||||
println!("cargo:rustc-cfg=feature=\"inline_int\"");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user