From 8214a03bbb8a7d721bc3678861d8674e500bf6a7 Mon Sep 17 00:00:00 2001
From: Arnav Singh <me@arnavion.dev>
Date: Sun, 20 Oct 2024 14:05:24 -0700
Subject: [PATCH] main/python3: give native threads 2MiB stack also

Since we give threads started by `threading` 2MiB stack, we might as well
give it to native threads too. In particular this helps with loading
libraries like librsvg that have large stack probes.

Ref: https://gitlab.gnome.org/GNOME/librsvg/-/issues/1132

Fixes #16520
---
 main/python3/APKBUILD | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD
index 573abcdbffc3..0730a5c456bd 100644
--- a/main/python3/APKBUILD
+++ b/main/python3/APKBUILD
@@ -4,7 +4,7 @@ pkgname=python3
 # the python3-tkinter's pkgver needs to be synchronized with this.
 pkgver=3.12.7
 _basever="${pkgver%.*}"
-pkgrel=0
+pkgrel=1
 pkgdesc="High-level scripting language"
 url="https://www.python.org/"
 arch="all"
@@ -108,7 +108,7 @@ build() {
 	# we want -O2 here for more speed for such a large interpreter.
 	export CFLAGS_NODIST="$CFLAGS -O2 -DTHREAD_STACK_SIZE=$stacksize"
 	export CXXFLAGS_NODIST="$CXXFLAGS -O2"
-	export LDFLAGS_NODIST="$LDFLAGS"
+	export LDFLAGS_NODIST="$LDFLAGS -Wl,-z,stack-size=$stacksize"
 
 	case "$CARCH" in
 	ppc64le)
@@ -120,6 +120,7 @@ build() {
 		;;
 	esac
 
+
 	# we set them via NODIST to not propagate them and duplicate them to modules
 	unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS
 
-- 
GitLab