Gentoo Archives: gentoo-dev

From: Michael Palimaka <kensington@g.o>
To: gentoo-dev@l.g.o
Cc: Michael Palimaka <kensington@g.o>
Subject: [gentoo-dev] [PATCH 09/15] cmake-utils.eclass: move $S modifications to src_prepare in EAPI 6 and later
Date: Wed, 20 Jan 2016 10:49:49
Message-Id: 1453286593-26823-10-git-send-email-kensington@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/15] EAPI 6 support for cmake-utils.eclas by Michael Palimaka
1 This is the correct phase for source modifications, and additionally avoids a
2 multilib race condition.
3
4 Gentoo-bug: 513170
5 ---
6 eclass/cmake-utils.eclass | 44 +++++++++++++++++++++++++++-----------------
7 1 file changed, 27 insertions(+), 17 deletions(-)
8
9 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
10 index df33fd9..22c8718 100644
11 --- a/eclass/cmake-utils.eclass
12 +++ b/eclass/cmake-utils.eclass
13 @@ -409,11 +409,37 @@ _cmake_modify-cmakelists() {
14 _EOF_
15 }
16
17 +# temporary function for moving cmake cleanups from from src_configure -> src_prepare.
18 +# bug #378850
19 +_cmake_cleanup_cmake() {
20 + : ${CMAKE_USE_DIR:=${S}}
21 +
22 + if [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] ; then
23 + local name
24 + for name in ${CMAKE_REMOVE_MODULES_LIST} ; do
25 + find "${S}" -name ${name}.cmake -exec rm -v {} + || die
26 + done
27 + fi
28 +
29 + # check if CMakeLists.txt exist and if no then die
30 + if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
31 + eerror "Unable to locate CMakeLists.txt under:"
32 + eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
33 + eerror "Consider not inheriting the cmake eclass."
34 + die "FATAL: Unable to find CMakeLists.txt"
35 + fi
36 +
37 + # Remove dangerous things.
38 + _cmake_modify-cmakelists
39 +}
40 +
41 enable_cmake-utils_src_prepare() {
42 debug-print-function ${FUNCNAME} "$@"
43
44 pushd "${S}" > /dev/null || die
45
46 + has "${EAPI:-0}" 6 && _cmake_cleanup_cmake
47 +
48 debug-print "$FUNCNAME: PATCHES=$PATCHES"
49 [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
50
51 @@ -441,26 +467,10 @@ enable_cmake-utils_src_prepare() {
52 enable_cmake-utils_src_configure() {
53 debug-print-function ${FUNCNAME} "$@"
54
55 - if [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] ; then
56 - local name
57 - for name in ${CMAKE_REMOVE_MODULES_LIST} ; do
58 - find "${S}" -name ${name}.cmake -exec rm -v {} + || die
59 - done
60 - fi
61 + has "${EAPI:-0}" 2 3 4 5 && _cmake_cleanup_cmake
62
63 _cmake_check_build_dir
64
65 - # check if CMakeLists.txt exist and if no then die
66 - if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
67 - eerror "Unable to locate CMakeLists.txt under:"
68 - eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
69 - eerror "Consider not inheriting the cmake eclass."
70 - die "FATAL: Unable to find CMakeLists.txt"
71 - fi
72 -
73 - # Remove dangerous things.
74 - _cmake_modify-cmakelists
75 -
76 # Fix xdg collision with sandbox
77 local -x XDG_CONFIG_HOME="${T}"
78
79 --
80 2.4.10