eclass/gnuconfig: Sync with gentoo

It's from gentoo commit d3f4cba0102a542650af7f49537a7fcddcd1bd89.
This commit is contained in:
Krzesimir Nowak 2021-12-21 10:37:30 +01:00
parent a8c0b3a950
commit 239110c99a

View File

@ -1,37 +1,47 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
#
# THIS ECLASS IS DEAD: It has been integrated into portage # @ECLASS: gnuconfig.eclass
# # @MAINTAINER:
# Author: Will Woods <wwoods@gentoo.org> # Sam James <sam@gentoo.org>
# # @AUTHOR:
# Will Woods <wwoods@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Refresh bundled gnuconfig files (config.guess, config.sub)
# @DESCRIPTION:
# This eclass is used to automatically update files that typically come with # This eclass is used to automatically update files that typically come with
# automake to the newest version available on the system. The most common use # automake to the newest version available on the system. The most common use
# of this is to update config.guess and config.sub when configure dies from # of this is to update config.guess and config.sub when configure dies from
# misguessing your canonical system name (CHOST). It can also be used to update # misguessing your canonical system name (CHOST). It can also be used to update
# other files that come with automake, e.g. depcomp, mkinstalldirs, etc. # other files that come with automake, e.g. depcomp, mkinstalldirs, etc.
# #
# usage: gnuconfig_update [file1 file2 ...]
case ${EAPI:-0} in
5|6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_GNUCONFIG_ECLASS} ]] ; then
_GNUCONFIG_CLASS=1
BDEPEND="sys-devel/gnuconfig"
[[ ${EAPI} == [56] ]] && DEPEND="${BDEPEND}"
# @FUNCTION: gnuconfig_update
# @USAGE: [file1 file2 ...]
# @DESCRIPTION:
# if called without arguments, config.guess and config.sub will be updated. # if called without arguments, config.guess and config.sub will be updated.
# All files in the source tree ($S) with the given name(s) will be replaced # All files in the source tree ($S) with the given name(s) will be replaced
# with the newest available versions chosen from the list of locations in # with the newest available versions chosen from the list of locations in
# gnuconfig_findnewest(), below. # gnuconfig_findnewest(), below.
# #
# gnuconfig_update should generally be called from src_unpack() # gnuconfig_update should generally be called from src_unpack()
#
DEPEND="sys-devel/gnuconfig"
# Wrapper function for gnuconfig_do_update. If no arguments are given, update # Wrapper function for gnuconfig_do_update. If no arguments are given, update
# config.sub and config.guess (old default behavior), otherwise update the # config.sub and config.guess (old default behavior), otherwise update the
# named files. # named files.
gnuconfig_update() { gnuconfig_update() {
# hmm some packages (like binutils gcc glibc) still use this ...
# echo
# ewarn "QA Notice: Please stop using me, portage updates files for you."
# echo
local startdir # declared here ... used in gnuconfig_do_update local startdir # declared here ... used in gnuconfig_do_update
if [[ $1 == /* ]] ; then if [[ $1 == /* ]] ; then
@ -50,6 +60,9 @@ gnuconfig_update() {
return $? return $?
} }
# @FUNCTION: gnuconfig_do_update
# @INTERNAL
# @DESCRIPTION:
# Copy the newest available version of specified files over any old ones in the # Copy the newest available version of specified files over any old ones in the
# source dir. This function shouldn't be called directly - use gnuconfig_update # source dir. This function shouldn't be called directly - use gnuconfig_update
# #
@ -83,16 +96,34 @@ gnuconfig_do_update() {
return 0 return 0
} }
# this searches the standard locations for the newest config.{sub|guess}, and # @FUNCTION: gnuconfig_findnewest
# @INTERNAL
# @DESCRIPTION:
# This searches the standard locations for the newest config.{sub|guess}, and
# returns the directory where they can be found. # returns the directory where they can be found.
gnuconfig_findnewest() { gnuconfig_findnewest() {
local locations=( local locations=()
"${EPREFIX}"/usr/share/misc/config.sub local prefix
"${EPREFIX}"/usr/share/gnuconfig/config.sub
"${EPREFIX}"/usr/share/automake*/config.sub case ${EAPI} in
"${EPREFIX}"/usr/share/libtool/config.sub 5|6)
prefix="${EPREFIX}"
;;
*)
prefix="${BROOT}"
;;
esac
locations+=(
"${prefix}"/usr/share/misc/config.sub
"${prefix}"/usr/share/gnuconfig/config.sub
"${prefix}"/usr/share/automake*/config.sub
"${prefix}"/usr/share/libtool/config.sub
) )
grep -s '^timestamp' "${locations[@]}" | \ grep -s '^timestamp' "${locations[@]}" | \
sort -r -n -t\' -k2 | \ sort -r -n -t\' -k2 | \
sed -n '1{s,/config.sub:.*$,,;p;q}' sed -n '1{s,/config.sub:.*$,,;p;q}'
} }
fi