From 063e536f7f0cb25e3ee3c08bbe542e79592c6dd1 Mon Sep 17 00:00:00 2001 From: Laszlo Valko Date: Wed, 11 Sep 2024 00:33:25 +0200 Subject: [PATCH] Updated eclasses for EAPI=7. --- eclass/eutils.eclass | 2 -- eclass/toolchain.eclass | 60 ++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 3b6a90f..73e74ff 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -13,8 +13,6 @@ _EUTILS_ECLASS=1 # implicitly inherited (now split) eclasses 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 ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 7dc7cc9..d00318e 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -9,7 +9,7 @@ LICENSE="GPL-2 LGPL-2.1" RESTRICT="strip" # cross-compilers need controlled stripping #---->> 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 DESCRIPTION="Based on the ${ECLASS} eclass" @@ -57,22 +57,28 @@ is_crosscompile() { [[ ${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_PVR=${GCC_PV} [[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} -GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV}) -GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV}) -GCCMAJOR=$(get_version_component_range 1 ${GCC_PV}) -GCCMINOR=$(get_version_component_range 2 ${GCC_PV}) -GCCMICRO=$(get_version_component_range 3 ${GCC_PV}) -[[ ${BRANCH_UPDATE-notset} == "notset" ]] && BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV}) +GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV}) +GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV}) +GCCMAJOR=$(ver_cut 1 ${GCC_PV}) +GCCMINOR=$(ver_cut 2 ${GCC_PV}) +GCCMICRO=$(ver_cut 3 ${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. # ([^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 if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then @@ -1115,19 +1121,19 @@ gcc_src_unpack() { if [[ -n ${PATCH_VER} ]] ; then guess_patch_type_in_dir "${WORKDIR}"/patch EPATCH_MULTI_MSG="Applying Gentoo patches ..." \ - epatch "${WORKDIR}"/patch + eapply "${WORKDIR}"/patch BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}" fi if [[ -n ${UCLIBC_VER} ]] ; then guess_patch_type_in_dir "${WORKDIR}"/uclibc EPATCH_MULTI_MSG="Applying uClibc patches ..." \ - epatch "${WORKDIR}"/uclibc + eapply "${WORKDIR}"/uclibc fi fi do_gcc_HTB_patches do_gcc_SSP_patches do_gcc_PIE_patches - epatch_user + eapply_user do_gcc_ESPF_patches ${ETYPE}_src_unpack || die "failed to ${ETYPE}_src_unpack" @@ -1189,7 +1195,7 @@ gcc_src_unpack() { # update configure files local f 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 ebegin " Updating ${f/${S}\/} [LANG]" 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 if [[ -n ${BRANCH_UPDATE} ]] ; then 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 fi fi @@ -2158,7 +2164,7 @@ do_gcc_stub() { stub_patch=${GCC_FILESDIR}/stubs/gcc-${v}-$1-stub.patch if [[ -e ${stub_patch} ]] && ! use vanilla ; then EPATCH_SINGLE_MSG="Applying stub patch for $1 ..." \ - epatch "${stub_patch}" + eapply "${stub_patch}" return 0 fi done @@ -2173,7 +2179,7 @@ do_gcc_HTB_patches() { fi # 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}" } @@ -2217,10 +2223,10 @@ do_gcc_SSP_patches() { fi [[ -z ${ssppatch} ]] && die "Sorry, SSP is not supported in this version" - epatch ${ssppatch} + eapply ${ssppatch} if [[ ${PN} == "gcc" && ${sspdocs} == "no" ]] ; then - epatch "${GCC_FILESDIR}"/pro-police-docs.patch + eapply "${GCC_FILESDIR}"/pro-police-docs.patch fi # 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() if use build && tc_version_is_at_least 3.4.0 ; 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 @@ -2282,19 +2288,19 @@ do_gcc_PIE_patches() { if tc_version_is_at_least 4.3.2; then guess_patch_type_in_dir "${WORKDIR}"/piepatch/ EPATCH_MULTI_MSG="Applying pie patches ..." \ - epatch "${WORKDIR}"/piepatch/ + eapply "${WORKDIR}"/piepatch/ else guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream # corrects startfile/endfile selection and shared/static/pie flag usage EPATCH_MULTI_MSG="Applying upstream pie patches ..." \ - epatch "${WORKDIR}"/piepatch/upstream + eapply "${WORKDIR}"/piepatch/upstream # adds non-default pie support (rs6000) 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 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 # than ALL_CFLAGS... @@ -2311,7 +2317,7 @@ do_gcc_ESPF_patches() { if [[ -n ${ESPF_VER} ]] && ! use vanilla; then guess_patch_type_in_dir "${WORKDIR}"/espf-gcc-"${GCC_RELEASE_VER}" 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}" fi } @@ -2332,7 +2338,7 @@ should_we_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_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 # 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 # 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_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 # to the same profile as the current one.