python3Packages.tpm2-pytss: fix broken cross-compilation patch

Signed-off-by: Alexander Nikolaev <alexander.nikolaev@tii.ae>
This commit is contained in:
Alexander Nikolaev
2026-03-02 18:58:53 +02:00
parent 91e2af124b
commit edbb785bf0
2 changed files with 12 additions and 13 deletions
@@ -2,21 +2,19 @@ diff --git a/setup.py b/setup.py
index 1b5f513..d660b9a 100644
--- a/setup.py
+++ b/setup.py
@@ -184,7 +184,8 @@ class type_generator(build_ext):
f"unable to find tss2_tpm2_types.h in {pk['include_dirs']}"
@@ -199,6 +199,7 @@
pdata = preprocess_file(
header_path,
cpp_args=["-std=c99", "-D__extension__=", "-D__attribute__(x)="],
+ cpp_path="@crossPrefix@-cpp",
)
pdata = preprocess_file(
- header_path, cpp_args=["-D__extension__=", "-D__attribute__(x)="]
+ header_path, cpp_args=["-D__extension__=", "-D__attribute__(x)="],
+ cpp_path="@crossPrefix@-cpp",
)
parser = c_parser.CParser()
ast = parser.parse(pdata, "tss2_tpm2_types.h")
@@ -210,6 +211,7 @@ class type_generator(build_ext):
"-D__float128=long double",
"-D_FORTIFY_SOURCE=0",
],
+ cpp_path="@crossPrefix@-cpp",
)
@@ -238,6 +239,7 @@
"-D__float128=long double",
"-D_FORTIFY_SOURCE=0",
],
+ cpp_path="@crossPrefix@-cpp",
)
parser = c_parser.CParser()
past = parser.parse(pdata, "tss2_policy.h")
@@ -70,6 +70,7 @@ buildPythonPackage rec {
# when cross-compiling is turned on.
# This patch changes the call to pycparser.preprocess_file to provide the name
# of the cross-compiling cpp
# NOTE: This patch could be dropped after next release. 3.0.0-rc0 already have proper `$CC -E` invocation
(replaceVars ./cross.patch {
crossPrefix = stdenv.hostPlatform.config;
})