mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-03 13:27:28 -08:00
Closes: https://bugs.gentoo.org/902001 Signed-off-by: Christopher Byrne <salah.coronya@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/40902 Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
diff --git a/setup.py b/setup.py
|
|
index 0e6208f..eec85ad 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -20,6 +20,14 @@ from textwrap import dedent
|
|
site.ENABLE_USER_SITE = "--user" in sys.argv[1:]
|
|
|
|
|
|
+def cpp_path():
|
|
+ return os.environ.get("CC", "cc")
|
|
+
|
|
+
|
|
+def cpp_args(args=[]):
|
|
+ return ["-E"] + args
|
|
+
|
|
+
|
|
class type_generator(build_ext):
|
|
cares = set(
|
|
(
|
|
@@ -184,7 +192,9 @@ class type_generator(build_ext):
|
|
f"unable to find tss2_tpm2_types.h in {pk['include_dirs']}"
|
|
)
|
|
pdata = preprocess_file(
|
|
- header_path, cpp_args=["-std=c99", "-D__extension__=", "-D__attribute__(x)="]
|
|
+ header_path,
|
|
+ cpp_path=cpp_path(),
|
|
+ cpp_args=cpp_args(["-std=c99", "-D__extension__=", "-D__attribute__(x)="]),
|
|
)
|
|
parser = c_parser.CParser()
|
|
ast = parser.parse(pdata, "tss2_tpm2_types.h")
|
|
@@ -204,13 +214,16 @@ class type_generator(build_ext):
|
|
if policy_header_path:
|
|
pdata = preprocess_file(
|
|
policy_header_path,
|
|
- cpp_args=[
|
|
- "-std=c99",
|
|
- "-D__extension__=",
|
|
- "-D__attribute__(x)=",
|
|
- "-D__float128=long double",
|
|
- "-D_FORTIFY_SOURCE=0",
|
|
- ],
|
|
+ cpp_path=cpp_path(),
|
|
+ cpp_args=cpp_args(
|
|
+ [
|
|
+ "-std=c99",
|
|
+ "-D__extension__=",
|
|
+ "-D__attribute__(x)=",
|
|
+ "-D__float128=long double",
|
|
+ "-D_FORTIFY_SOURCE=0",
|
|
+ ]
|
|
+ ),
|
|
)
|
|
parser = c_parser.CParser()
|
|
past = parser.parse(pdata, "tss2_policy.h")
|