Skip to content

Commit

Permalink
Apply readelf patch for cross-compiling on older Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Dec 20, 2024
1 parent 01cfc3b commit f52316e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
7 changes: 7 additions & 0 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
fi
fi

# disable readelf check when cross-compiling on older Python versions
if [ -n "${CROSS_COMPILING}" ]; then
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_11}" ]; then
patch -p1 -i ${ROOT}/patch-cross-readelf.patch
fi
fi

# This patch is slightly different on Python 3.10+.
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then
patch -p1 -i ${ROOT}/patch-xopen-source-ios.patch
Expand Down
16 changes: 0 additions & 16 deletions cpython-unix/patch-apple-cross.patch
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,6 @@ index c62a565eb6..7e5d34632c 100644
LDLIBRARY='libpython$(LDVERSION).dylib'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
@@ -1626,15 +1665,6 @@ then
fi

AC_CHECK_TOOLS([READELF], [readelf], [:])
-if test "$cross_compiling" = yes; then
- case "$READELF" in
- readelf|:)
- AC_MSG_ERROR([readelf for the host is required for cross builds])
- ;;
- esac
-fi
-AC_SUBST(READELF)
-

case $MACHDEP in
hp*|HP*)
@@ -3173,6 +3203,11 @@ then
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
LDSHARED='$(CC) -shared'
Expand Down
20 changes: 20 additions & 0 deletions cpython-unix/patch-cross-readelf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/configure.ac b/configure.ac
index c62a565eb6..7e5d34632c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1626,15 +1665,6 @@ then
fi

AC_CHECK_TOOLS([READELF], [readelf], [:])
-if test "$cross_compiling" = yes; then
- case "$READELF" in
- readelf|:)
- AC_MSG_ERROR([readelf for the host is required for cross builds])
- ;;
- esac
-fi
-AC_SUBST(READELF)
-

case $MACHDEP in
hp*|HP*)

0 comments on commit f52316e

Please sign in to comment.