mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #303009 from baloo/baloo/tpm2-pytss/fixup-cross-compilation
python311Packages.tpm2-pytss: fix cross-compilation
This commit is contained in:
commit
e214dd2661
2 changed files with 39 additions and 0 deletions
22
pkgs/development/python-modules/tpm2-pytss/cross.patch
Normal file
22
pkgs/development/python-modules/tpm2-pytss/cross.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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']}"
|
||||||
|
)
|
||||||
|
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",
|
||||||
|
)
|
||||||
|
parser = c_parser.CParser()
|
||||||
|
past = parser.parse(pdata, "tss2_policy.h")
|
|
@ -1,4 +1,6 @@
|
||||||
{ lib
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, substituteAll
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
, pythonOlder
|
, pythonOlder
|
||||||
|
@ -17,6 +19,9 @@
|
||||||
, swtpm
|
, swtpm
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
isCross = (stdenv.buildPlatform != stdenv.hostPlatform);
|
||||||
|
in
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "tpm2-pytss";
|
pname = "tpm2-pytss";
|
||||||
version = "2.2.1";
|
version = "2.2.1";
|
||||||
|
@ -32,6 +37,18 @@ buildPythonPackage rec {
|
||||||
patches = [
|
patches = [
|
||||||
# Fix hardcoded `fapi-config.json` configuration path
|
# Fix hardcoded `fapi-config.json` configuration path
|
||||||
./fapi-config.patch
|
./fapi-config.patch
|
||||||
|
] ++ lib.optionals isCross [
|
||||||
|
# pytss will regenerate files from headers of tpm2-tss.
|
||||||
|
# Those headers are fed through a compiler via pycparser. pycparser expects `cpp`
|
||||||
|
# to be in the path.
|
||||||
|
# This is put in the path via stdenv when not cross-compiling, but this is absent
|
||||||
|
# when cross-compiling is turned on.
|
||||||
|
# This patch changes the call to pycparser.preprocess_file to provide the name
|
||||||
|
# of the cross-compiling cpp
|
||||||
|
(substituteAll {
|
||||||
|
src = ./cross.patch;
|
||||||
|
crossPrefix = stdenv.hostPlatform.config;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue