From 8ec582a6d08e588db9976e9c3b0451667b051638 Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Fri, 13 Feb 2026 11:21:55 +0530 Subject: [PATCH] GH-138800: fix variable substitution in python3.pc for Android $(BLDLIBRARY) substitution works in Makefiles where variables are expanded at the time of execution. This expansion does not happen in static files like .pc, so use value of BLDLIBRARY instead of trying to substitute the value. Patch stolen from downstream distribution of Python for Termux (Android): https://github.com/termux/termux-packages/pull/27739 Preferably needs to be backported to both Python 3.13 as well as Python 3.14, along with the main branch Fixes #138800 --- Makefile.pre.in | 2 +- .../next/Build/2026-02-13-23-26-40.gh-issue-138800.wRCFW-.rst | 1 + configure | 2 +- configure.ac | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-02-13-23-26-40.gh-issue-138800.wRCFW-.rst diff --git a/Makefile.pre.in b/Makefile.pre.in index a6beb96d12a3f2..912772d325b622 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -43,7 +43,6 @@ SOABI= @SOABI@ ABIFLAGS= @ABIFLAGS@ ABI_THREAD= @ABI_THREAD@ LDVERSION= @LDVERSION@ -LIBPYTHON=@LIBPYTHON@ GITVERSION= @GITVERSION@ GITTAG= @GITTAG@ GITBRANCH= @GITBRANCH@ @@ -285,6 +284,7 @@ INSTSONAME= @INSTSONAME@ LIBRARY_DEPS= @LIBRARY_DEPS@ LINK_PYTHON_DEPS=@LINK_PYTHON_DEPS@ PY_ENABLE_SHARED= @PY_ENABLE_SHARED@ +LIBPYTHON=@LIBPYTHON@ STATIC_LIBPYTHON= @STATIC_LIBPYTHON@ diff --git a/Misc/NEWS.d/next/Build/2026-02-13-23-26-40.gh-issue-138800.wRCFW-.rst b/Misc/NEWS.d/next/Build/2026-02-13-23-26-40.gh-issue-138800.wRCFW-.rst new file mode 100644 index 00000000000000..980c07fc8df123 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-02-13-23-26-40.gh-issue-138800.wRCFW-.rst @@ -0,0 +1 @@ +fix variable substitution in python3.pc for Android diff --git a/configure b/configure index b1faeaf806a9c6..36f4c58583dd10 100755 --- a/configure +++ b/configure @@ -26953,7 +26953,7 @@ LIBPYTHON='' # On Android and Cygwin the shared libraries must be linked with libpython. if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)" - LIBPYTHON="\$(BLDLIBRARY)" + LIBPYTHON="$(BLDLIBRARY)" fi # On iOS the shared libraries must be linked with the Python framework diff --git a/configure.ac b/configure.ac index 043ec957f40894..53bed63310e75a 100644 --- a/configure.ac +++ b/configure.ac @@ -6424,7 +6424,7 @@ LIBPYTHON='' # On Android and Cygwin the shared libraries must be linked with libpython. if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)" - LIBPYTHON="\$(BLDLIBRARY)" + LIBPYTHON="$(BLDLIBRARY)" fi # On iOS the shared libraries must be linked with the Python framework