Updated eclasses for EAPI=7.

This commit is contained in:
László Valkó 2024-09-11 00:33:25 +02:00
parent 10a7af08d1
commit 063e536f7f
2 changed files with 33 additions and 29 deletions

View file

@ -13,8 +13,6 @@ _EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses # implicitly inherited (now split) eclasses
case ${EAPI} in case ${EAPI} in
6) inherit desktop edos2unix epatch eqawarn estack ltprune multilib \
preserve-libs strip-linguas toolchain-funcs vcs-clean wrapper ;;
7) inherit edos2unix strip-linguas wrapper ;; 7) inherit edos2unix strip-linguas wrapper ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac esac

View file

@ -9,7 +9,7 @@ LICENSE="GPL-2 LGPL-2.1"
RESTRICT="strip" # cross-compilers need controlled stripping RESTRICT="strip" # cross-compilers need controlled stripping
#---->> eclass stuff <<---- #---->> eclass stuff <<----
inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails inherit eutils libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
DESCRIPTION="Based on the ${ECLASS} eclass" DESCRIPTION="Based on the ${ECLASS} eclass"
@ -57,22 +57,28 @@ is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]] [[ ${CHOST} != ${CTARGET} ]]
} }
tc_version_is_at_least() { version_is_at_least "$1" "${2:-${GCC_PV}}" ; } # @FUNCTION: tc_version_is_at_least
# @USAGE: ver1 [ver2]
# @DESCRIPTION:
# General purpose version check. Without a second argument, matches
# up to minor version (x.x.x).
tc_version_is_at_least() {
ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1"
}
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}} GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
GCC_PVR=${GCC_PV} GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} [[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV}) GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV}) GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
GCCMAJOR=$(get_version_component_range 1 ${GCC_PV}) GCCMAJOR=$(ver_cut 1 ${GCC_PV})
GCCMINOR=$(get_version_component_range 2 ${GCC_PV}) GCCMINOR=$(ver_cut 2 ${GCC_PV})
GCCMICRO=$(get_version_component_range 3 ${GCC_PV}) GCCMICRO=$(ver_cut 3 ${GCC_PV})
[[ ${BRANCH_UPDATE-notset} == "notset" ]] && BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV}) [[ ${BRANCH_UPDATE-notset} == "notset" ]] && BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex. # According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? # ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})} GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})}
# Pre-release support # Pre-release support
if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then
@ -1115,19 +1121,19 @@ gcc_src_unpack() {
if [[ -n ${PATCH_VER} ]] ; then if [[ -n ${PATCH_VER} ]] ; then
guess_patch_type_in_dir "${WORKDIR}"/patch guess_patch_type_in_dir "${WORKDIR}"/patch
EPATCH_MULTI_MSG="Applying Gentoo patches ..." \ EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
epatch "${WORKDIR}"/patch eapply "${WORKDIR}"/patch
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}" BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
fi fi
if [[ -n ${UCLIBC_VER} ]] ; then if [[ -n ${UCLIBC_VER} ]] ; then
guess_patch_type_in_dir "${WORKDIR}"/uclibc guess_patch_type_in_dir "${WORKDIR}"/uclibc
EPATCH_MULTI_MSG="Applying uClibc patches ..." \ EPATCH_MULTI_MSG="Applying uClibc patches ..." \
epatch "${WORKDIR}"/uclibc eapply "${WORKDIR}"/uclibc
fi fi
fi fi
do_gcc_HTB_patches do_gcc_HTB_patches
do_gcc_SSP_patches do_gcc_SSP_patches
do_gcc_PIE_patches do_gcc_PIE_patches
epatch_user eapply_user
do_gcc_ESPF_patches do_gcc_ESPF_patches
${ETYPE}_src_unpack || die "failed to ${ETYPE}_src_unpack" ${ETYPE}_src_unpack || die "failed to ${ETYPE}_src_unpack"
@ -1189,7 +1195,7 @@ gcc_src_unpack() {
# update configure files # update configure files
local f local f
einfo "Fixing misc issues in configure files" einfo "Fixing misc issues in configure files"
tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch tc_version_is_at_least 4.1 && eapply "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
ebegin " Updating ${f/${S}\/} [LANG]" ebegin " Updating ${f/${S}\/} [LANG]"
patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \ patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
@ -2066,7 +2072,7 @@ gcc_quick_unpack() {
# We want branch updates to be against a release tarball # We want branch updates to be against a release tarball
if [[ -n ${BRANCH_UPDATE} ]] ; then if [[ -n ${BRANCH_UPDATE} ]] ; then
pushd "${S}" > /dev/null pushd "${S}" > /dev/null
epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2 eapply "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
popd > /dev/null popd > /dev/null
fi fi
fi fi
@ -2158,7 +2164,7 @@ do_gcc_stub() {
stub_patch=${GCC_FILESDIR}/stubs/gcc-${v}-$1-stub.patch stub_patch=${GCC_FILESDIR}/stubs/gcc-${v}-$1-stub.patch
if [[ -e ${stub_patch} ]] && ! use vanilla ; then if [[ -e ${stub_patch} ]] && ! use vanilla ; then
EPATCH_SINGLE_MSG="Applying stub patch for $1 ..." \ EPATCH_SINGLE_MSG="Applying stub patch for $1 ..." \
epatch "${stub_patch}" eapply "${stub_patch}"
return 0 return 0
fi fi
done done
@ -2173,7 +2179,7 @@ do_gcc_HTB_patches() {
fi fi
# modify the bounds checking patch with a regression patch # modify the bounds checking patch with a regression patch
epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch" eapply "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}" BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
} }
@ -2217,10 +2223,10 @@ do_gcc_SSP_patches() {
fi fi
[[ -z ${ssppatch} ]] && die "Sorry, SSP is not supported in this version" [[ -z ${ssppatch} ]] && die "Sorry, SSP is not supported in this version"
epatch ${ssppatch} eapply ${ssppatch}
if [[ ${PN} == "gcc" && ${sspdocs} == "no" ]] ; then if [[ ${PN} == "gcc" && ${sspdocs} == "no" ]] ; then
epatch "${GCC_FILESDIR}"/pro-police-docs.patch eapply "${GCC_FILESDIR}"/pro-police-docs.patch
fi fi
# Don't build crtbegin/end with ssp # Don't build crtbegin/end with ssp
@ -2232,7 +2238,7 @@ do_gcc_SSP_patches() {
# cc1: stack smashing attack in function ix86_split_to_parts() # cc1: stack smashing attack in function ix86_split_to_parts()
if use build && tc_version_is_at_least 3.4.0 ; then if use build && tc_version_is_at_least 3.4.0 ; then
if gcc -dumpspecs | grep -q "fno-stack-protector:" ; then if gcc -dumpspecs | grep -q "fno-stack-protector:" ; then
epatch "${GCC_FILESDIR}"/3.4.0/gcc-3.4.0-cc1-no-stack-protector.patch eapply "${GCC_FILESDIR}"/3.4.0/gcc-3.4.0-cc1-no-stack-protector.patch
fi fi
fi fi
@ -2282,19 +2288,19 @@ do_gcc_PIE_patches() {
if tc_version_is_at_least 4.3.2; then if tc_version_is_at_least 4.3.2; then
guess_patch_type_in_dir "${WORKDIR}"/piepatch/ guess_patch_type_in_dir "${WORKDIR}"/piepatch/
EPATCH_MULTI_MSG="Applying pie patches ..." \ EPATCH_MULTI_MSG="Applying pie patches ..." \
epatch "${WORKDIR}"/piepatch/ eapply "${WORKDIR}"/piepatch/
else else
guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
# corrects startfile/endfile selection and shared/static/pie flag usage # corrects startfile/endfile selection and shared/static/pie flag usage
EPATCH_MULTI_MSG="Applying upstream pie patches ..." \ EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
epatch "${WORKDIR}"/piepatch/upstream eapply "${WORKDIR}"/piepatch/upstream
# adds non-default pie support (rs6000) # adds non-default pie support (rs6000)
EPATCH_MULTI_MSG="Applying non-default pie patches ..." \ EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
epatch "${WORKDIR}"/piepatch/nondef eapply "${WORKDIR}"/piepatch/nondef
# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
EPATCH_MULTI_MSG="Applying default pie patches ..." \ EPATCH_MULTI_MSG="Applying default pie patches ..." \
epatch "${WORKDIR}"/piepatch/def eapply "${WORKDIR}"/piepatch/def
# we want to be able to control the pie patch logic via something other # we want to be able to control the pie patch logic via something other
# than ALL_CFLAGS... # than ALL_CFLAGS...
@ -2311,7 +2317,7 @@ do_gcc_ESPF_patches() {
if [[ -n ${ESPF_VER} ]] && ! use vanilla; then if [[ -n ${ESPF_VER} ]] && ! use vanilla; then
guess_patch_type_in_dir "${WORKDIR}"/espf-gcc-"${GCC_RELEASE_VER}" guess_patch_type_in_dir "${WORKDIR}"/espf-gcc-"${GCC_RELEASE_VER}"
EPATCH_MULTI_MSG="Applying espf patches ..." \ EPATCH_MULTI_MSG="Applying espf patches ..." \
epatch "${WORKDIR}"/espf-gcc-"${GCC_RELEASE_VER}" eapply "${WORKDIR}"/espf-gcc-"${GCC_RELEASE_VER}"
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, espf-${ESPF_VER}" BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, espf-${ESPF_VER}"
fi fi
} }
@ -2332,7 +2338,7 @@ should_we_gcc_config() {
# for being in the same SLOT, make sure we run gcc-config. # for being in the same SLOT, make sure we run gcc-config.
local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}') local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
# If we're using multislot, just run gcc-config if we're installing # If we're using multislot, just run gcc-config if we're installing
# to the same profile as the current one. # to the same profile as the current one.
@ -2406,7 +2412,7 @@ should_we_eselect_compiler() {
# the version we are installing, then it will probably be uninstalled # the version we are installing, then it will probably be uninstalled
# for being in the same SLOT, make sure we run gcc-config. # for being in the same SLOT, make sure we run gcc-config.
local curr_config_ver=$(echo ${curr_config} | cut -f1 -d/ | awk -F - '{ print $5 }') local curr_config_ver=$(echo ${curr_config} | cut -f1 -d/ | awk -F - '{ print $5 }')
local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
# If we're using multislot, just run gcc-config if we're installing # If we're using multislot, just run gcc-config if we're installing
# to the same profile as the current one. # to the same profile as the current one.