From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C6CA8139694 for ; Fri, 17 Mar 2017 16:58:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EC3F621C209; Fri, 17 Mar 2017 16:58:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9AC6D21C1FF for ; Fri, 17 Mar 2017 16:58:00 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 2AFEE34112A; Fri, 17 Mar 2017 16:57:58 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH] epunt-cxx.eclass: Split C++ check punting code out of eutils Date: Fri, 17 Mar 2017 17:57:51 +0100 Message-Id: <20170317165751.1149-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.12.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 9df57022-3998-4083-99e5-15ebf3da6132 X-Archives-Hash: 71df729774d96ef1119fde87ecff05e8 Split the epunt_cxx (plus internal code) to a dedicated eclass. This is rarely needed, usually indicates a dead upstream and requires the ELT-patches framework. The patches are going to be split to a separate package, and the new eclass will therefore need to DEPEND on it. We do not want the dependency to apply to all eutils users though. --- eclass/epunt-cxx.eclass | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ eclass/eutils.eclass | 44 ++------------------------------- 2 files changed, 67 insertions(+), 42 deletions(-) create mode 100644 eclass/epunt-cxx.eclass diff --git a/eclass/epunt-cxx.eclass b/eclass/epunt-cxx.eclass new file mode 100644 index 000000000000..660b1d138fac --- /dev/null +++ b/eclass/epunt-cxx.eclass @@ -0,0 +1,65 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: epunt-cxx.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @BLURB: A function to punt C++ compiler checks from autoconf +# @DESCRIPTION: +# Support for punting C++ compiler checks from autoconf (based +# on ELT-patches). + +if [[ -z ${_EPUNT_CXX_ECLASS} ]]; then + +# TODO: replace this with 'inherit eutils' once eutils stops inheriting +# us +if ! declare -F eqawarn >/dev/null ; then + eqawarn() { + has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@" + : + } +fi + +# If an overlay has eclass overrides, but doesn't actually override the +# libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's +# eclass/ dir, but libtool.eclass is still in the main Gentoo tree. So +# add a check to locate the ELT-patches/ regardless of what's going on. +# Note: Duplicated in libtool.eclass. +_EUTILS_ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*} +eutils_elt_patch_dir() { + local d="${ECLASSDIR}/ELT-patches" + if [[ ! -d ${d} ]] ; then + d="${_EUTILS_ECLASSDIR_LOCAL}/ELT-patches" + fi + echo "${d}" +} + +# @FUNCTION: epunt_cxx +# @USAGE: [dir to scan] +# @DESCRIPTION: +# Many configure scripts wrongly bail when a C++ compiler could not be +# detected. If dir is not specified, then it defaults to ${S}. +# +# https://bugs.gentoo.org/73450 +epunt_cxx() { + local dir=$1 + [[ -z ${dir} ]] && dir=${S} + ebegin "Removing useless C++ checks" + local f p any_found + while IFS= read -r -d '' f; do + for p in "$(eutils_elt_patch_dir)"/nocxx/*.patch ; do + if patch --no-backup-if-mismatch -p1 "${f}" "${p}" >/dev/null ; then + any_found=1 + break + fi + done + done < <(find "${dir}" -name configure -print0) + + if [[ -z ${any_found} ]]; then + eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt)." + fi + eend 0 +} + +_EPUNT_CXX_ECLASS=1 +fi #_EPUNT_CXX_ECLASS diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index c932d685c0e9..ea2a76200f09 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -20,7 +20,8 @@ _EUTILS_ECLASS=1 # implicitly inherited (now split) eclasses case ${EAPI:-0} in 0|1|2|3|4|5|6) - inherit epatch estack ltprune multilib toolchain-funcs + # note: we want to remove epunt-cxx retroactively for #566424 + inherit epatch epunt-cxx estack ltprune multilib toolchain-funcs ;; esac @@ -740,47 +741,6 @@ built_with_use() { [[ ${opt} = "-a" ]] } -# If an overlay has eclass overrides, but doesn't actually override the -# libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's -# eclass/ dir, but libtool.eclass is still in the main Gentoo tree. So -# add a check to locate the ELT-patches/ regardless of what's going on. -# Note: Duplicated in libtool.eclass. -_EUTILS_ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*} -eutils_elt_patch_dir() { - local d="${ECLASSDIR}/ELT-patches" - if [[ ! -d ${d} ]] ; then - d="${_EUTILS_ECLASSDIR_LOCAL}/ELT-patches" - fi - echo "${d}" -} - -# @FUNCTION: epunt_cxx -# @USAGE: [dir to scan] -# @DESCRIPTION: -# Many configure scripts wrongly bail when a C++ compiler could not be -# detected. If dir is not specified, then it defaults to ${S}. -# -# https://bugs.gentoo.org/73450 -epunt_cxx() { - local dir=$1 - [[ -z ${dir} ]] && dir=${S} - ebegin "Removing useless C++ checks" - local f p any_found - while IFS= read -r -d '' f; do - for p in "$(eutils_elt_patch_dir)"/nocxx/*.patch ; do - if patch --no-backup-if-mismatch -p1 "${f}" "${p}" >/dev/null ; then - any_found=1 - break - fi - done - done < <(find "${dir}" -name configure -print0) - - if [[ -z ${any_found} ]]; then - eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt)." - fi - eend 0 -} - # @FUNCTION: make_wrapper # @USAGE: [chdir] [libpaths] [installpath] # @DESCRIPTION: -- 2.12.0