commit:     28ab4b2c0a74db3800bb8d2796644bed7b5b89fd
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 18 09:26:52 2015 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Wed Nov 18 09:26:59 2015 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=28ab4b2c

cmake-utils.eclass: move $S modifications to src_prepare in EAPI 6 and later

This is the correct phase for source modifications, and additionally avoids a
multilib race condition.

Gentoo-bug: 513170

 eclass/cmake-utils.eclass | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index c3184bd..b726589 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -397,11 +397,37 @@ _modify-cmakelists() {
        _EOF_
 }
 
+# temporary function for moving cmake cleanups from from src_configure -> 
src_prepare.
+# bug #378850
+_cleanup_cmake() {
+       : ${CMAKE_USE_DIR:=${S}}
+
+       [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] && {
+               local name
+               for name in ${CMAKE_REMOVE_MODULES_LIST} ; do
+                       find "${S}" -name ${name}.cmake -exec rm -v {} +
+               done
+       }
+
+       # check if CMakeLists.txt exist and if no then die
+       if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
+               eerror "Unable to locate CMakeLists.txt under:"
+               eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
+               eerror "Consider not inheriting the cmake eclass."
+               die "FATAL: Unable to find CMakeLists.txt"
+       fi
+
+       # Remove dangerous things.
+       _modify-cmakelists
+}
+
 enable_cmake-utils_src_prepare() {
        debug-print-function ${FUNCNAME} "$@"
 
        pushd "${S}" > /dev/null || die
 
+       has "${EAPI:-0}" 6 && _cleanup_cmake
+
        debug-print "$FUNCNAME: PATCHES=$PATCHES"
        [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
 
@@ -429,26 +455,10 @@ enable_cmake-utils_src_prepare() {
 enable_cmake-utils_src_configure() {
        debug-print-function ${FUNCNAME} "$@"
 
-       [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] && {
-               local name
-               for name in ${CMAKE_REMOVE_MODULES_LIST} ; do
-                       find "${S}" -name ${name}.cmake -exec rm -v {} +
-               done
-       }
+       has "${EAPI:-0}" 2 3 4 5 && _cleanup_cmake
 
        _check_build_dir
 
-       # check if CMakeLists.txt exist and if no then die
-       if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
-               eerror "Unable to locate CMakeLists.txt under:"
-               eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
-               eerror "Consider not inheriting the cmake eclass."
-               die "FATAL: Unable to find CMakeLists.txt"
-       fi
-
-       # Remove dangerous things.
-       _modify-cmakelists
-
        # Fix xdg collision with sandbox
        export XDG_CONFIG_HOME="${T}"
 

Reply via email to