summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-11-17 10:49:17 +0000
committerSam James <sam@gentoo.org>2021-11-17 10:49:17 +0000
commit074a78fe03e77fe3337dae773c3d46d0af47eb95 (patch)
tree328b54a4326e72d8c368123e1e19200504335c98 /dev-lang
parentdev-lang/python: add LTO (diff)
downloadgentoo-074a78fe03e77fe3337dae773c3d46d0af47eb95.tar.gz
gentoo-074a78fe03e77fe3337dae773c3d46d0af47eb95.tar.bz2
gentoo-074a78fe03e77fe3337dae773c3d46d0af47eb95.zip
dev-lang/python: backport PGO, LTO to 3.9.x and 3.10.x
Bug: https://bugs.gentoo.org/615412 Bug: https://bugs.gentoo.org/700012 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/python/python-3.10.0_p1.ebuild18
-rw-r--r--dev-lang/python/python-3.9.9.ebuild18
2 files changed, 34 insertions, 2 deletions
diff --git a/dev-lang/python/python-3.10.0_p1.ebuild b/dev-lang/python/python-3.10.0_p1.ebuild
index ba5bca461986..b1491cac95e8 100644
--- a/dev-lang/python/python-3.10.0_p1.ebuild
+++ b/dev-lang/python/python-3.10.0_p1.ebuild
@@ -24,7 +24,7 @@ S="${WORKDIR}/${MY_P}"
LICENSE="PSF-2"
SLOT="${PYVER}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-IUSE="bluetooth build examples gdbm hardened +ncurses +readline +sqlite +ssl test tk wininst +xml"
+IUSE="bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml"
RESTRICT="!test? ( test )"
# Do not add a dependency on dev-lang/python to this ebuild.
@@ -160,6 +160,11 @@ src_configure() {
dbmliborder+="${dbmliborder:+:}gdbm"
fi
+ if use pgo; then
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb"
+ fi
+
local myeconfargs=(
# glibc-2.30 removes it; since we can't cleanly force-rebuild
# Python on glibc upgrade, remove it proactively to give
@@ -178,6 +183,9 @@ src_configure() {
--without-ensurepip
--with-system-expat
--with-system-ffi
+
+ $(use_with lto)
+ $(use_enable pgo optimizations)
)
OPT="" econf "${myeconfargs[@]}"
@@ -197,6 +205,14 @@ src_compile() {
# https://bugs.gentoo.org/823728
export SETUPTOOLS_USE_DISTUTILS=stdlib
+ if use pgo ; then
+ # bug 660358
+ local -x COLUMNS=80
+ local -x PYTHONDONTWRITEBYTECODE=
+
+ addpredict /usr/lib/python3.10/site-packages
+ fi
+
emake CPPFLAGS= CFLAGS= LDFLAGS=
# Work around bug 329499. See also bug 413751 and 457194.
diff --git a/dev-lang/python/python-3.9.9.ebuild b/dev-lang/python/python-3.9.9.ebuild
index 8429cdeafe53..492a5a2fcbb2 100644
--- a/dev-lang/python/python-3.9.9.ebuild
+++ b/dev-lang/python/python-3.9.9.ebuild
@@ -24,7 +24,7 @@ S="${WORKDIR}/${MY_P}"
LICENSE="PSF-2"
SLOT="${PYVER}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-IUSE="bluetooth build examples gdbm hardened +ncurses +readline +sqlite +ssl test tk wininst +xml"
+IUSE="bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml"
RESTRICT="!test? ( test )"
# Do not add a dependency on dev-lang/python to this ebuild.
@@ -158,6 +158,11 @@ src_configure() {
dbmliborder+="${dbmliborder:+:}gdbm"
fi
+ if use pgo; then
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb"
+ fi
+
local myeconfargs=(
# glibc-2.30 removes it; since we can't cleanly force-rebuild
# Python on glibc upgrade, remove it proactively to give
@@ -175,6 +180,9 @@ src_configure() {
--without-ensurepip
--with-system-expat
--with-system-ffi
+
+ $(use_with lto)
+ $(use_enable pgo optimizations)
)
OPT="" econf "${myeconfargs[@]}"
@@ -194,6 +202,14 @@ src_compile() {
# https://bugs.gentoo.org/823728
export SETUPTOOLS_USE_DISTUTILS=stdlib
+ if use pgo ; then
+ # bug 660358
+ local -x COLUMNS=80
+ local -x PYTHONDONTWRITEBYTECODE=
+
+ addpredict /usr/lib/python3.9/site-packages
+ fi
+
emake CPPFLAGS= CFLAGS= LDFLAGS=
# Work around bug 329499. See also bug 413751 and 457194.