commit:     ddbae51c4cfc2f579deb0294f82f20e0609c4353
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 11:05:34 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 11:05:53 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddbae51c

dev-lang/python: fix CFLAGS for cross-compilation

My CFLAGS for sparc etc were the same (generic) as for CBUILD, so didn't
notice before.

Closes: https://bugs.gentoo.org/878211
Fixes: 29d2314810bd8e1de73df5c3ebe30c826281c253
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/python/python-3.10.8.ebuild | 17 ++++++++++++-----
 dev-lang/python/python-3.11.0.ebuild | 17 ++++++++++++-----
 dev-lang/python/python-3.8.15.ebuild | 17 ++++++++++++-----
 dev-lang/python/python-3.9.15.ebuild | 12 ++++++++++++
 4 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/dev-lang/python/python-3.10.8.ebuild 
b/dev-lang/python/python-3.10.8.ebuild
index 625f41d24ffb..0b7ad7f2c527 100644
--- a/dev-lang/python/python-3.10.8.ebuild
+++ b/dev-lang/python/python-3.10.8.ebuild
@@ -231,13 +231,14 @@ src_configure() {
 
        # disable implicit optimization/debugging flags
        local -x OPT=
-       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
-       # propagated to sysconfig for built extensions
-       local -x CFLAGS_NODIST=${CFLAGS}
-       local -x LDFLAGS_NODIST=${LDFLAGS}
-       local -x CFLAGS= LDFLAGS=
 
        if tc-is-cross-compiler ; then
+               # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+               # propagated to sysconfig for built extensions
+               local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD}
+               local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD}
+               local -x CFLAGS= LDFLAGS=
+
                # We need to build our own Python on CBUILD first, and feed it 
in.
                # bug #847910 and bug #864911.
                local myeconfargs_cbuild=(
@@ -282,6 +283,12 @@ src_configure() {
                popd &> /dev/null || die
        fi
 
+       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+       # propagated to sysconfig for built extensions
+       local -x CFLAGS_NODIST=${CFLAGS}
+       local -x LDFLAGS_NODIST=${LDFLAGS}
+       local -x CFLAGS= LDFLAGS=
+
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.11.0.ebuild 
b/dev-lang/python/python-3.11.0.ebuild
index 9ec51be261e6..ab0050062031 100644
--- a/dev-lang/python/python-3.11.0.ebuild
+++ b/dev-lang/python/python-3.11.0.ebuild
@@ -220,13 +220,14 @@ src_configure() {
 
        # disable implicit optimization/debugging flags
        local -x OPT=
-       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
-       # propagated to sysconfig for built extensions
-       local -x CFLAGS_NODIST=${CFLAGS}
-       local -x LDFLAGS_NODIST=${LDFLAGS}
-       local -x CFLAGS= LDFLAGS=
 
        if tc-is-cross-compiler ; then
+               # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+               # propagated to sysconfig for built extensions
+               local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD}
+               local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD}
+               local -x CFLAGS= LDFLAGS=
+
                # We need to build our own Python on CBUILD first, and feed it 
in.
                # bug #847910
                local myeconfargs_cbuild=(
@@ -274,6 +275,12 @@ src_configure() {
                popd &> /dev/null || die
        fi
 
+       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+       # propagated to sysconfig for built extensions
+       local -x CFLAGS_NODIST=${CFLAGS}
+       local -x LDFLAGS_NODIST=${LDFLAGS}
+       local -x CFLAGS= LDFLAGS=
+
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.8.15.ebuild 
b/dev-lang/python/python-3.8.15.ebuild
index 521277294b91..c45c62c2e163 100644
--- a/dev-lang/python/python-3.8.15.ebuild
+++ b/dev-lang/python/python-3.8.15.ebuild
@@ -184,13 +184,14 @@ src_configure() {
 
        # disable implicit optimization/debugging flags
        local -x OPT=
-       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
-       # propagated to sysconfig for built extensions
-       local -x CFLAGS_NODIST=${CFLAGS}
-       local -x LDFLAGS_NODIST=${LDFLAGS}
-       local -x CFLAGS= LDFLAGS=
 
        if tc-is-cross-compiler ; then
+               # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+               # propagated to sysconfig for built extensions
+               local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD}
+               local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD}
+               local -x CFLAGS= LDFLAGS=
+
                # We need to build our own Python on CBUILD first, and feed it 
in.
                # bug #847910 and bug #864911.
                local myeconfargs_cbuild=(
@@ -235,6 +236,12 @@ src_configure() {
                popd &> /dev/null || die
        fi
 
+       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+       # propagated to sysconfig for built extensions
+       local -x CFLAGS_NODIST=${CFLAGS}
+       local -x LDFLAGS_NODIST=${LDFLAGS}
+       local -x CFLAGS= LDFLAGS=
+
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.9.15.ebuild 
b/dev-lang/python/python-3.9.15.ebuild
index 05ce9ad53913..71160d6e637f 100644
--- a/dev-lang/python/python-3.9.15.ebuild
+++ b/dev-lang/python/python-3.9.15.ebuild
@@ -232,6 +232,12 @@ src_configure() {
        local -x CFLAGS= LDFLAGS=
 
        if tc-is-cross-compiler ; then
+               # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+               # propagated to sysconfig for built extensions
+               local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD}
+               local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD}
+               local -x CFLAGS= LDFLAGS=
+
                # We need to build our own Python on CBUILD first, and feed it 
in.
                # bug #847910 and bug #864911.
                local myeconfargs_cbuild=(
@@ -276,6 +282,12 @@ src_configure() {
                popd &> /dev/null || die
        fi
 
+       # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+       # propagated to sysconfig for built extensions
+       local -x CFLAGS_NODIST=${CFLAGS}
+       local -x LDFLAGS_NODIST=${LDFLAGS}
+       local -x CFLAGS= LDFLAGS=
+
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

Reply via email to