diff options
author | Michael Palimaka <kensington@gentoo.org> | 2016-01-26 01:04:13 +1100 |
---|---|---|
committer | Michael Palimaka <kensington@gentoo.org> | 2016-01-26 01:07:06 +1100 |
commit | 66f8e27bf31241fa503764fe52fd79c04c852e03 (patch) | |
tree | ce1f2847a21c0ba4fea902a779fdc0e605aef91a /eclass/cmake-utils.eclass | |
parent | cmake-utils.eclass: namespace some private functions (diff) | |
download | gentoo-66f8e27bf31241fa503764fe52fd79c04c852e03.tar.gz gentoo-66f8e27bf31241fa503764fe52fd79c04c852e03.tar.bz2 gentoo-66f8e27bf31241fa503764fe52fd79c04c852e03.zip |
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
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r-- | eclass/cmake-utils.eclass | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass index 6224cbd05bb9..9f79584fe2e3 100644 --- a/eclass/cmake-utils.eclass +++ b/eclass/cmake-utils.eclass @@ -409,11 +409,37 @@ _cmake_modify-cmakelists() { _EOF_ } +# temporary function for moving cmake cleanups from from src_configure -> src_prepare. +# bug #378850 +_cmake_cleanup_cmake() { + : ${CMAKE_USE_DIR:=${S}} + + if [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] ; then + local name + for name in ${CMAKE_REMOVE_MODULES_LIST} ; do + find "${S}" -name ${name}.cmake -exec rm -v {} + || die + done + fi + + # 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. + _cmake_modify-cmakelists +} + enable_cmake-utils_src_prepare() { debug-print-function ${FUNCNAME} "$@" pushd "${S}" > /dev/null || die + has "${EAPI:-0}" 6 && _cmake_cleanup_cmake + debug-print "$FUNCNAME: PATCHES=$PATCHES" [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" @@ -441,26 +467,10 @@ enable_cmake-utils_src_prepare() { enable_cmake-utils_src_configure() { debug-print-function ${FUNCNAME} "$@" - if [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] ; then - local name - for name in ${CMAKE_REMOVE_MODULES_LIST} ; do - find "${S}" -name ${name}.cmake -exec rm -v {} + || die - done - fi + has "${EAPI:-0}" 2 3 4 5 && _cmake_cleanup_cmake _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. - _cmake_modify-cmakelists - # Fix xdg collision with sandbox local -x XDG_CONFIG_HOME="${T}" |