diff options
author | Sam James <sam@gentoo.org> | 2021-11-17 10:05:45 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-11-17 10:46:27 +0000 |
commit | 2c862d1f086bb8a9ce70631dfce1f2d7b5676b4c (patch) | |
tree | 18ce386a1ccb0f97397b7021316b4b766037463a /dev-lang | |
parent | dev-lang/python: use 'addpredict' (diff) | |
download | gentoo-2c862d1f086bb8a9ce70631dfce1f2d7b5676b4c.tar.gz gentoo-2c862d1f086bb8a9ce70631dfce1f2d7b5676b4c.tar.bz2 gentoo-2c862d1f086bb8a9ce70631dfce1f2d7b5676b4c.zip |
dev-lang/python: add PGO
Closes: https://bugs.gentoo.org/615412
Closes: https://github.com/gentoo/gentoo/pull/20077
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/python/metadata.xml | 1 | ||||
-rw-r--r-- | dev-lang/python/python-3.11.0_alpha2.ebuild | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml index 3427feb17c7d..996b563e4b05 100644 --- a/dev-lang/python/metadata.xml +++ b/dev-lang/python/metadata.xml @@ -7,6 +7,7 @@ </maintainer> <use> <flag name="bluetooth">Build Bluetooth protocol support in socket module</flag> + <flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag> <flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag> </use> </pkgmetadata> diff --git a/dev-lang/python/python-3.11.0_alpha2.ebuild b/dev-lang/python/python-3.11.0_alpha2.ebuild index e97de8d4ccec..30e34160ff57 100644 --- a/dev-lang/python/python-3.11.0_alpha2.ebuild +++ b/dev-lang/python/python-3.11.0_alpha2.ebuild @@ -25,7 +25,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 +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" RESTRICT="!test? ( test )" # Do not add a dependency on dev-lang/python to this ebuild. @@ -161,6 +161,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 @@ -179,6 +184,8 @@ src_configure() { --without-ensurepip --with-system-expat --with-system-ffi + + $(use_enable pgo optimizations) ) OPT="" econf "${myeconfargs[@]}" @@ -198,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.11/site-packages + fi + emake CPPFLAGS= CFLAGS= LDFLAGS= # Work around bug 329499. See also bug 413751 and 457194. |