From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C10AB158094 for ; Sun, 14 Aug 2022 22:01:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EF466E0E1A; Sun, 14 Aug 2022 22:01:36 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CDE4AE0E1A for ; Sun, 14 Aug 2022 22:01:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 00824341618 for ; Sun, 14 Aug 2022 22:01:36 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 65996500 for ; Sun, 14 Aug 2022 22:01:34 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1660514457.86279cbf5dc98223b492cbf27a78de37e652b591.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/bash/bash-5.2_rc2-r1.ebuild app-shells/bash/bash-9999.ebuild app-shells/bash/metadata.xml X-VCS-Directories: app-shells/bash/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 86279cbf5dc98223b492cbf27a78de37e652b591 X-VCS-Branch: master Date: Sun, 14 Aug 2022 22:01:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c1acbf31-9cda-4c42-9add-15b276d18b8b X-Archives-Hash: be2bf01c9774fcb7c59aee8befe9af2d commit: 86279cbf5dc98223b492cbf27a78de37e652b591 Author: Sam James gentoo org> AuthorDate: Sat Jun 18 02:37:14 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sun Aug 14 22:00:57 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86279cbf app-shells/bash: add pgo Signed-off-by: Sam James gentoo.org> app-shells/bash/bash-5.2_rc2-r1.ebuild | 45 +++++++++++++++++++++++----------- app-shells/bash/bash-9999.ebuild | 45 +++++++++++++++++++++++----------- app-shells/bash/metadata.xml | 3 +++ 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 @@ Add support for loading builtins at runtime via 'enable' + + Optimize the build using Profile Guided Optimization (PGO) + mailto:bug-bash@gnu.org