public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Remove -Werror... hack (now in cython)
@ 2024-03-02 16:16 Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michał Górny @ 2024-03-02 16:16 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index c0d1992ccce0..fb0c2dfaa693 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1813,11 +1813,6 @@ distutils-r1_run_phase() {
 	tc-export AR CC CPP CXX
 
 	if [[ ${DISTUTILS_EXT} ]]; then
-		if [[ ${BDEPEND} == *dev-python/cython* ]] ; then
-			# Workaround for https://github.com/cython/cython/issues/2747 (bug #918983)
-			local -x CFLAGS="${CFLAGS} $(test-flags-CC -Wno-error=incompatible-pointer-types)"
-		fi
-
 		local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG' '-DNDEBUG')"
 		# always generate .c files from .pyx files to ensure we get latest
 		# bug fixes from Cython (this works only when setup.py is using
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test
  2024-03-02 16:16 [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
@ 2024-03-02 16:16 ` Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Make vars local before calling filter-lto Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2024-03-02 16:16 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Perform the environment modifications specific to DISTUTILS_EXT
to python_compile and python_test phases.  These are the only phases
where we expect extension builds to be called.  This allows us to
limit the scope of localized CPPFLAGS, as we both want to avoid leaking
changes to non-Python parts of the build and let ebuilds to manipulate
flags at their leisure, particularly prior to python_compile.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index fb0c2dfaa693..60554944a5a0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1812,7 +1812,13 @@ distutils-r1_run_phase() {
 	local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
 	tc-export AR CC CPP CXX
 
-	if [[ ${DISTUTILS_EXT} ]]; then
+	# Perform additional environment modifications only for python_compile
+	# phase.  This is the only phase where we expect to be calling the Python
+	# build system.  We want to localize the altered variables to avoid them
+	# leaking to other parts of multi-language ebuilds.  However, we want
+	# to avoid localizing them in other phases, particularly
+	# python_configure_all, where the ebuild may wish to alter them globally.
+	if [[ ${DISTUTILS_EXT} && ( ${1} == *compile* || ${1} == *test* ) ]]; then
 		local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG' '-DNDEBUG')"
 		# always generate .c files from .pyx files to ensure we get latest
 		# bug fixes from Cython (this works only when setup.py is using
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block
  2024-03-02 16:16 [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
@ 2024-03-02 16:16 ` Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Make vars local before calling filter-lto Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2024-03-02 16:16 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 60554944a5a0..ee1dcef24ff6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1824,17 +1824,17 @@ distutils-r1_run_phase() {
 		# bug fixes from Cython (this works only when setup.py is using
 		# cythonize() but it's better than nothing)
 		local -x CYTHON_FORCE_REGEN=1
+
+		# Rust extensions are incompatible with C/C++ LTO compiler
+		# see e.g. https://bugs.gentoo.org/910220
+		if has cargo ${INHERITED}; then
+			filter-lto
+		fi
 	fi
 
 	# silence warnings when pydevd is loaded on Python 3.11+
 	local -x PYDEVD_DISABLE_FILE_VALIDATION=1
 
-	# Rust extensions are incompatible with C/C++ LTO compiler
-	# see e.g. https://bugs.gentoo.org/910220
-	if has cargo ${INHERITED}; then
-		filter-lto
-	fi
-
 	# How to build Python modules in different worlds...
 	local ldopts
 	case "${CHOST}" in
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Make vars local before calling filter-lto
  2024-03-02 16:16 [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
  2024-03-02 16:16 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
@ 2024-03-02 16:16 ` Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2024-03-02 16:16 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Make LTO filtering local to the compilation code.  This avoids disabling
LTO for non-Python parts of an ebuild.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index ee1dcef24ff6..8193d6d8ecd0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1828,6 +1828,14 @@ distutils-r1_run_phase() {
 		# Rust extensions are incompatible with C/C++ LTO compiler
 		# see e.g. https://bugs.gentoo.org/910220
 		if has cargo ${INHERITED}; then
+			# see all-flag-vars in flag-o-matic.eclass
+			local -x ADAFLAGS="${ADAFLAGS}"
+			local -x CFLAGS="${CFLAGS}"
+			local -x CXXFLAGS="${CXXFLAGS}"
+			local -x CCASFLAGS="${CCASFLAGS}"
+			local -x FFLAGS="${FFLAGS}"
+			local -x FCFLAGS="${FCFLAGS}"
+			local -x LDFLAGS="${LDFLAGS}"
 			filter-lto
 		fi
 	fi
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-02 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02 16:16 [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
2024-03-02 16:16 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
2024-03-02 16:16 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
2024-03-02 16:16 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Make vars local before calling filter-lto Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox