packages/lang/python/python3/patches/131-configure_ac-switch-PLATFORM_TRIPLET-suffix-to-musl.patch
Jeffery To 4627ed7c43
python3: Update to 3.11.4, refresh patches
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
2023-06-12 14:10:01 +08:00

49 lines
2.1 KiB
Diff

From 15d512cc35106392ed7583d0e000d9a1b865f1e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0imon=20Bo=C5=99ek?= <simon.borek@nic.cz>
Date: Mon, 27 Jun 2022 13:53:37 +0200
Subject: [PATCH 2/2] configure.ac: switch PLATFORM_TRIPLET suffix to '-musl'
based on `host_os` instead of `build_os`
As `build_os` and `host_os` are results of autoconf's `AC_CANONICAL_BUILD`
and `AC_CANONICAL_HOST` macros[^1], the former refers to the system running the build
and the latter to the system that will run the compiled program.
`PLATFORM_TRIPLET` should refer to the target platform when cross-compiling.
Its libc related part should be therefore derived from the target platform as well
- which is currently not the case - `PLATFORM_TRIPLET` '-gnu' suffix is/isn't switched to '-musl'
based on `build-os` rather than `host-os` which leads to error message[^2]
and build failure when compiling Python on glibc system for musl target.
[^1]: https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Canonicalizing.html ,
https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html
[^2]: "internal configure error for the platform triplet, please file a bug report"
Co-authored-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Šimon Bořek <simon.borek@nic.cz>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/configure
+++ b/configure
@@ -6824,7 +6824,7 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
- case "$build_os" in
+ case "$host_os" in
linux-musl*)
PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'`
;;
--- a/configure.ac
+++ b/configure.ac
@@ -1081,7 +1081,7 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
- case "$build_os" in
+ case "$host_os" in
linux-musl*)
PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'`
;;