eclass/toolchain-autoconf: Sync with Gentoo

It's from Gentoo commit 8839833a322cc2776225c20de422b38540a5d27f.
This commit is contained in:
Krzesimir Nowak 2023-07-28 12:57:48 +02:00
parent 7f90d55ce0
commit 9d56315aee

View File

@ -1,29 +1,36 @@
# Copyright 1999-2019 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-autoconf.eclass
# @MAINTAINER:
# <base-system@gentoo.org>
# @SUPPORTED_EAPIS: 6 7
# @SUPPORTED_EAPIS: 7 8
# @BLURB: Common code for sys-devel/autoconf ebuilds
# @DESCRIPTION:
# This eclass contains the common phase functions migrated from
# sys-devel/autoconf eblits.
case ${EAPI:-0} in
[0-5])
die "${ECLASS} is banned in EAPI ${EAPI:-0}"
;;
[6-7])
;;
*)
die "Unknown EAPI ${EAPI:-0}"
;;
case ${EAPI} in
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_TOOLCHAIN_AUTOCONF_ECLASS} ]]; then
_TOOLCHAIN_AUTOCONF_ECLASS=1
EXPORT_FUNCTIONS src_prepare src_configure src_install
# @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 old ebuild revisions to use. Do not set
# in new ebuilds. 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
@ -33,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
@ -72,8 +87,27 @@ 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
}
_TOOLCHAIN_AUTOCONF_ECLASS=1
fi
EXPORT_FUNCTIONS src_prepare src_configure src_install