Closes: https://bugs.gentoo.org/902461
Signed-off-by: Arsen Arsenović <ar...@gentoo.org>
---
 eclass/toolchain-autoconf.eclass | 46 +++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/eclass/toolchain-autoconf.eclass b/eclass/toolchain-autoconf.eclass
index 2ba27638468e..140ee4c9b5eb 100644
--- a/eclass/toolchain-autoconf.eclass
+++ b/eclass/toolchain-autoconf.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-autoconf.eclass
@@ -18,6 +18,20 @@ esac
 if [[ -z ${_TOOLCHAIN_AUTOCONF_ECLASS} ]]; then
 _TOOLCHAIN_AUTOCONF_ECLASS=1
 
+# @ECLASS_VARIABLE: TC_AUTOCONF_BREAK_INFOS
+# @DESCRIPTION:
+# Enables slotting logic on the installed info pages.  This includes
+# mangling the pages in order to include a version number.  Empty by
+# default, and only exists for existing ebuild revisions to use.  Set
+# to a non-empty value to enable.
+# @DEPRECATED: none
+: "${TC_AUTOCONF_BREAK_INFOS:=}"
+
+# @ECLASS_VARIABLE: TC_AUTOCONF_INFOPATH
+# @DESCRIPTION:
+# Where to install info files if not slotting.
+TC_AUTOCONF_INFOPATH="${EPREFIX}/usr/share/autoconf-${PV}/info"
+
 toolchain-autoconf_src_prepare() {
        find -name Makefile.in -exec sed -i '/^pkgdatadir/s:$:-@VERSION@:' {} + 
|| die
        default
@@ -26,7 +40,15 @@ toolchain-autoconf_src_prepare() {
 toolchain-autoconf_src_configure() {
        # Disable Emacs in the build system since it is in a separate package.
        export EMACS=no
-       econf --program-suffix="-${PV}" || die
+       local myconf=(
+               --program-suffix="-${PV}"
+       )
+       if [[ -z "${TC_AUTOCONF_BREAK_INFOS}" && "${SLOT}" != 0 ]]; then
+               myconf+=(
+                       --infodir="${TC_AUTOCONF_INFOPATH}"
+               )
+       fi
+       econf "${myconf[@]}" || die
        # econf updates config.{sub,guess} which forces the manpages
        # to be regenerated which we dont want to do #146621
        touch man/*.1
@@ -65,7 +87,25 @@ slot_info_pages() {
 
 toolchain-autoconf_src_install() {
        default
-       slot_info_pages
+       if [[ -n "${TC_AUTOCONF_BREAK_INFOS}" ]]; then
+               slot_info_pages
+       else
+               rm -f dir || die
+
+               local major="$(ver_cut 1)"
+               local minor="$(ver_cut 2)"
+               local idx="$((99999-(major*1000+minor)))"
+               newenvd - "06autoconf${idx}" <<-EOF
+               INFOPATH="${TC_AUTOCONF_INFOPATH}"
+               EOF
+
+               pushd "${D}/${TC_AUTOCONF_INFOPATH}" >/dev/null || die
+               for f in *.info*; do
+                       # Install convenience aliases for versioned Autoconf 
pages.
+                       ln -s "$f" "${f/./-${PV}.}" || die
+               done
+               popd >/dev/null || die
+       fi
 }
 
 fi
-- 
2.40.0


Reply via email to