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>
This commit is contained in:
Sam James
2021-11-17 10:46:27 +00:00
parent e9119fb915
commit 2c862d1f08
2 changed files with 17 additions and 1 deletions
+1
View File
@@ -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>
+16 -1
View File
@@ -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.