commit: ed44f6fc1b8869d0c78cf1237f6c82b0ecb94e58 Author: Michael Palimaka <kensington <AT> gentoo <DOT> org> AuthorDate: Thu Oct 9 11:02:48 2014 +0000 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org> CommitDate: Thu Oct 9 11:02:48 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=ed44f6fc
[eclass] Refactor GCC version check and run at both pkg_pretend and pkg_setup. In KDE 4, the check was run in pkg_pretend only for kdelibs to save time during dependency resolution (think merging 300+ KDE pack ages all at once). Since there's no equivalent package in which to do this trick and we require a very recent version of GCC, it's quite likely to hit this check. To avoid dying halfway through a merge let's just do it properly and bail out as early as possible In order to reduce the speed impact, the version check has been reworked to use only one of the traditional three version calls. --- eclass/kde5-functions.eclass | 18 +++++++++++++++++- eclass/kde5.eclass | 23 +++++++++++------------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/eclass/kde5-functions.eclass b/eclass/kde5-functions.eclass index 242517f..e52e9ea 100644 --- a/eclass/kde5-functions.eclass +++ b/eclass/kde5-functions.eclass @@ -13,7 +13,7 @@ if [[ -z ${_KDE5_FUNCTIONS_ECLASS} ]]; then _KDE5_FUNCTIONS_ECLASS=1 -inherit versionator +inherit toolchain-funcs versionator # @ECLASS-VARIABLE: EAPI # @DESCRIPTION: @@ -60,6 +60,22 @@ else fi export KDE_BUILD_TYPE +# @FUNCTION: _check_gcc_version +# @INTERNAL +# @DESCRIPTION: +# Determine if the current GCC version is acceptable, otherwise die. +_check_gcc_version() { + if [[ ${MERGE_TYPE} != binary ]]; then + local version=$(gcc-version) + local major=${version%.*} + local minor=${version#*.} + + [[ ${major} -lt 4 ]] || \ + ( [[ ${major} -eq 4 && ${minor} -lt 8 ]] ) \ + && die "Sorry, but gcc-4.8 or later is required for KDE 5." + fi +} + # @FUNCTION: _add_kdecategory_dep # @INTERNAL # @DESCRIPTION: diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index 3474966..9f94486 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -21,7 +21,7 @@ CMAKE_MIN_VERSION="2.8.12" # for tests you should proceed with setting VIRTUALX_REQUIRED=test. : ${VIRTUALX_REQUIRED:=manual} -inherit kde5-functions toolchain-funcs fdo-mime flag-o-matic gnome2-utils versionator virtualx eutils cmake-utils +inherit kde5-functions fdo-mime flag-o-matic gnome2-utils versionator virtualx eutils cmake-utils if [[ ${KDE_BUILD_TYPE} = live ]]; then case ${KDE_SCM} in @@ -30,7 +30,7 @@ if [[ ${KDE_BUILD_TYPE} = live ]]; then esac fi -EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm +EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm # @ECLASS-VARIABLE: QT_MINIMAL # @DESCRIPTION: @@ -281,21 +281,20 @@ esac debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}" +# @FUNCTION: kde5_pkg_pretend +# @DESCRIPTION: +# Do some basic settings +kde5_pkg_pretend() { + debug-print-function ${FUNCNAME} "$@" + _check_gcc_version +} + # @FUNCTION: kde5_pkg_setup # @DESCRIPTION: # Do some basic settings kde5_pkg_setup() { debug-print-function ${FUNCNAME} "$@" - - # Check if gcc compiler is fresh enough. - # In theory should be in pkg_pretend but we check it only for kdelibs there - # and for others we do just quick scan in pkg_setup because pkg_pretend - # executions consume quite some time. - if [[ ${MERGE_TYPE} != binary ]]; then - [[ $(gcc-major-version) -lt 4 ]] || \ - ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 8 ]] ) \ - && die "Sorry, but gcc-4.8 or later is required for KDE 5." - fi + _check_gcc_version } # @FUNCTION: kde5_src_unpack