commit: 8a5fe775294ede43387a38ef04a707cd1e2f9801 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Thu Oct 14 08:38:36 2021 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Oct 14 08:39:18 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a5fe775
sys-libs/readline: avoid underlinking libreadline in prefix bootstrap There's no guarantee we have pkg-config around super early on in the process and we need readline for bash. Closes: https://bugs.gentoo.org/818103 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-libs/readline/readline-8.1_p1-r1.ebuild | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sys-libs/readline/readline-8.1_p1-r1.ebuild b/sys-libs/readline/readline-8.1_p1-r1.ebuild index 89f31e17eb1..d6352244675 100644 --- a/sys-libs/readline/readline-8.1_p1-r1.ebuild +++ b/sys-libs/readline/readline-8.1_p1-r1.ebuild @@ -70,9 +70,24 @@ src_prepare() { [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s) default - # Force ncurses linking. #71420 - # Use pkg-config to get the right values. #457558 - local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses$(usex unicode w '') --libs) + if use prefix && [[ ! -e "${BROOT}"/usr/bin/pkg-config ]] ; then + # If we're bootstrapping, make a guess. We don't have pkg-config + # around yet. bug #818103. + # Incorrectly populating this leads to underlinked libreadline. + local ncurses_libs + local ncurses_libs_suffix=$(usex unicode w '') + + ncurses_libs="-lncurses${ncurses_libs_suffix}" + + if has_version "sys-libs/ncurses[tinfo(+)]" ; then + ncurses_libs+=" -ltinfo${ncurses_libs_suffix}" + fi + else + # Force ncurses linking. #71420 + # Use pkg-config to get the right values. #457558 + local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses$(usex unicode w '') --libs) + fi + sed -i \ -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \ support/shobj-conf || die
