Skip to content

Commit 6c2a3b2

Browse files
committed
Patch cpuid.h guard
1 parent e13624f commit 6c2a3b2

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

cpython-unix/build-cpython.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then
317317
patch -p1 -i ${ROOT}/patch-test-embed-prevent-segfault.patch
318318
fi
319319

320+
321+
# For Python 3.14+, the include for `cpuid.h` is improperly guarded
322+
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" && "${CC}" = "musl-clang" ]]; then
323+
patch -p1 -i ${ROOT}/patch-blake-musl-314.patch
324+
fi
325+
320326
# Most bits look at CFLAGS. But setup.py only looks at CPPFLAGS.
321327
# So we need to set both.
322328
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC -I${TOOLS_PATH}/deps/include -I${TOOLS_PATH}/deps/include/ncursesw"

cpython-unix/extension-modules.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ _blake2:
4949
# Disable `explicit_bzero`, it requires glib 2.25+
5050
- define: LINUX_NO_EXPLICIT_BZERO
5151
minimum-python-version: "3.14"
52-
# Disable cpuid.h requirement for musl builds
53-
- define: NO_CPUID
54-
targets:
55-
- .*-unknown-linux-musl
56-
minimum-python-version: "3.14"
5752

5853
_bz2:
5954
sources:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/Modules/blake2module.c b/Modules/blake2module.c
2+
--- a/Modules/blake2module.c
3+
+++ b/Modules/blake2module.c
4+
@@ -33,7 +33,7 @@
5+
// pulled into the build automatically, and then only the CPU autodetection will
6+
// need to be updated here.
7+
8+
-#if defined(__x86_64__) && defined(__GNUC__)
9+
+#if defined(__x86_64__) && defined(__GLIBC__)
10+
#include <cpuid.h>
11+
#elif defined(_M_X64)
12+
#include <intrin.h>

0 commit comments

Comments
 (0)