Skip to content

Commit a867d7e

Browse files
committed
Pass CFLAGS to the JIT
1 parent fb5ce5d commit a867d7e

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ else
8383
patch -p1 -i ${ROOT}/patch-xopen-source-ios-legacy.patch
8484
fi
8585

86+
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]; then
87+
patch -p1 -i ${ROOT}/cpython-unix/patch-jit-clfags.patch
88+
fi
89+
8690
# LIBTOOL_CRUFT is unused and breaks cross-compiling on macOS. Nuke it.
8791
# Submitted upstream at https://github.com/python/cpython/pull/101048.
8892
if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_11}" ]; then

cpython-unix/patch-jit-clfags.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
diff --git a/Tools/jit/build.py b/Tools/jit/build.py
2+
index 9de6fd7dfda..49a1b11de47 100644
3+
--- a/Tools/jit/build.py
4+
+++ b/Tools/jit/build.py
5+
@@ -27,14 +27,14 @@
6+
"-v", "--verbose", action="store_true", help="echo commands as they are run"
7+
)
8+
parser.add_argument(
9+
- "--cflags", help="additional flags to pass to the compiler", default=""
10+
+ "--with-cflags", help="additional flags to pass to the compiler", default=""
11+
)
12+
args = parser.parse_args()
13+
for target in args.target:
14+
target.debug = args.debug
15+
target.force = args.force
16+
target.verbose = args.verbose
17+
- target.cflags = args.cflags
18+
+ target.cflags = args.with_cflags
19+
target.build(
20+
out,
21+
comment=comment,
22+
diff --git a/configure b/configure
23+
index c51192f12c8..0dcef7c2617 100755
24+
--- a/configure
25+
+++ b/configure
26+
@@ -10863,7 +10863,7 @@ then :
27+
28+
else case e in #(
29+
e) as_fn_append CFLAGS_NODIST " $jit_flags"
30+
- REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"
31+
+ REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""
32+
JIT_STENCILS_H="jit_stencils.h"
33+
if test "x$Py_DEBUG" = xtrue
34+
then :
35+
diff --git a/configure.ac b/configure.ac
36+
index 6fc7b466b64..5998f896a4e 100644
37+
--- a/configure.ac
38+
+++ b/configure.ac
39+
@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
40+
[],
41+
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
42+
AS_VAR_SET([REGEN_JIT_COMMAND],
43+
- ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --cflags \$(CLFAGS)"])
44+
+ ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
45+
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
46+
AS_VAR_IF([Py_DEBUG],
47+
[true],

0 commit comments

Comments
 (0)