summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-06-18 03:37:14 +0100
committerSam James <sam@gentoo.org>2022-08-14 23:00:57 +0100
commit86279cbf5dc98223b492cbf27a78de37e652b591 (patch)
treedfc49b5bb7d33081c855b2cbc28b08b7c6fb2dc4
parentnet-misc/rsync: keep IPv6 hack for musl (diff)
downloadgentoo-86279cbf.tar.gz
gentoo-86279cbf.tar.bz2
gentoo-86279cbf.zip
app-shells/bash: add pgo
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--app-shells/bash/bash-5.2_rc2-r1.ebuild45
-rw-r--r--app-shells/bash/bash-9999.ebuild45
-rw-r--r--app-shells/bash/metadata.xml3
3 files changed, 65 insertions, 28 deletions
diff --git a/app-shells/bash/bash-5.2_rc2-r1.ebuild b/app-shells/bash/bash-5.2_rc2-r1.ebuild
index 3fa9e5592430..38b23139ba9a 100644
--- a/app-shells/bash/bash-5.2_rc2-r1.ebuild
+++ b/app-shells/bash/bash-5.2_rc2-r1.ebuild
@@ -70,7 +70,7 @@ SLOT="0"
if is_release ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
DEPEND="
>=sys-libs/ncurses-5.2-r2:0=
@@ -84,7 +84,10 @@ RDEPEND="
"
# We only need yacc when the .y files get patched (bash42-005, bash51-011)
#BDEPEND="virtual/yacc"
-BDEPEND="verify-sig? ( sec-keys/openpgp-keys-chetramey )"
+BDEPEND="
+ pgo? ( dev-util/gperf )
+ verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
S="${WORKDIR}/${MY_P}"
@@ -186,16 +189,16 @@ src_configure() {
#use static && export LDFLAGS="${LDFLAGS} -static"
use nls || myconf+=( --disable-nls )
- # Historically, we always used the builtin readline, but since
- # our handling of SONAME upgrades has gotten much more stable
- # in the PM (and the readline ebuild itself preserves the old
- # libs during upgrades), linking against the system copy should
- # be safe.
- # Exact cached version here doesn't really matter as long as it
- # is at least what's in the DEPEND up above.
- export ac_cv_rl_version=${READLINE_VER%%_*}
-
if is_release ; then
+ # Historically, we always used the builtin readline, but since
+ # our handling of SONAME upgrades has gotten much more stable
+ # in the PM (and the readline ebuild itself preserves the old
+ # libs during upgrades), linking against the system copy should
+ # be safe.
+ # Exact cached version here doesn't really matter as long as it
+ # is at least what's in the DEPEND up above.
+ export ac_cv_rl_version=${READLINE_VER%%_*}
+
# Use system readline only with released versions.
myconf+=( --with-installed-readline=. )
fi
@@ -220,10 +223,24 @@ src_configure() {
}
src_compile() {
- emake
+ if use pgo ; then
+ # Build Bash and run its tests to generate profiles.
+ emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo"
- if use plugins ; then
- emake -C examples/loadables all others
+ # Used in test suite.
+ unset A
+
+ emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo" -k check
+
+ # Rebuild Bash using the profiling data we just generated.
+ emake clean
+ emake CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo"
+
+ use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo" all others
+ else
+ emake
+
+ use plugins && emake -C examples/loadables all others
fi
}
diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-9999.ebuild
index 065cb2bc6dee..3d2370ffe950 100644
--- a/app-shells/bash/bash-9999.ebuild
+++ b/app-shells/bash/bash-9999.ebuild
@@ -70,7 +70,7 @@ SLOT="0"
if is_release ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
DEPEND="
>=sys-libs/ncurses-5.2-r2:0=
@@ -84,7 +84,10 @@ RDEPEND="
"
# We only need yacc when the .y files get patched (bash42-005, bash51-011)
#BDEPEND="virtual/yacc"
-BDEPEND="verify-sig? ( sec-keys/openpgp-keys-chetramey )"
+BDEPEND="
+ pgo? ( dev-util/gperf )
+ verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
S="${WORKDIR}/${MY_P}"
@@ -186,16 +189,16 @@ src_configure() {
#use static && export LDFLAGS="${LDFLAGS} -static"
use nls || myconf+=( --disable-nls )
- # Historically, we always used the builtin readline, but since
- # our handling of SONAME upgrades has gotten much more stable
- # in the PM (and the readline ebuild itself preserves the old
- # libs during upgrades), linking against the system copy should
- # be safe.
- # Exact cached version here doesn't really matter as long as it
- # is at least what's in the DEPEND up above.
- export ac_cv_rl_version=${READLINE_VER%%_*}
-
if is_release ; then
+ # Historically, we always used the builtin readline, but since
+ # our handling of SONAME upgrades has gotten much more stable
+ # in the PM (and the readline ebuild itself preserves the old
+ # libs during upgrades), linking against the system copy should
+ # be safe.
+ # Exact cached version here doesn't really matter as long as it
+ # is at least what's in the DEPEND up above.
+ export ac_cv_rl_version=${READLINE_VER%%_*}
+
# Use system readline only with released versions.
myconf+=( --with-installed-readline=. )
fi
@@ -220,10 +223,24 @@ src_configure() {
}
src_compile() {
- emake
+ if use pgo ; then
+ # Build Bash and run its tests to generate profiles.
+ emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo"
- if use plugins ; then
- emake -C examples/loadables all others
+ # Used in test suite.
+ unset A
+
+ emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo" -k check
+
+ # Rebuild Bash using the profiling data we just generated.
+ emake clean
+ emake CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo"
+
+ use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo" all others
+ else
+ emake
+
+ use plugins && emake -C examples/loadables all others
fi
}
diff --git a/app-shells/bash/metadata.xml b/app-shells/bash/metadata.xml
index 67efcea3d7d5..6ec75e4bd86f 100644
--- a/app-shells/bash/metadata.xml
+++ b/app-shells/bash/metadata.xml
@@ -19,6 +19,9 @@
<flag name="plugins">
Add support for loading builtins at runtime via 'enable'
</flag>
+ <flag name="pgo">
+ Optimize the build using Profile Guided Optimization (PGO)
+ </flag>
</use>
<upstream>
<bugs-to>mailto:bug-bash@gnu.org</bugs-to>