summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2012-12-09 02:29:00 +1100
committerMichael Palimaka <kensington@gentoo.org>2012-12-09 02:29:00 +1100
commit2e367a1594db9c90cd176e667dad44a35f075376 (patch)
tree944b574671b1a8e885481d8d6a3434aedd5c2d4b /eclass
parentced6b8aa78f00110ca1abc91a767cc9268d2f78e (diff)
downloadkde-2e367a1594db9c90cd176e667dad44a35f075376.tar.gz
kde-2e367a1594db9c90cd176e667dad44a35f075376.tar.bz2
kde-2e367a1594db9c90cd176e667dad44a35f075376.zip
[eclass] Sync with portage.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cmake-utils.eclass52
1 files changed, 37 insertions, 15 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index a8247977cab..9cf8d9e76b6 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.85 2012/10/25 12:48:58 scarabeus Exp $
+# $Header: $
# @ECLASS: cmake-utils.eclass
# @MAINTAINER:
@@ -127,12 +127,15 @@ _use_me_now_inverted() {
fi
}
-# @ECLASS-VARIABLE: CMAKE_BUILD_DIR
+# @ECLASS-VARIABLE: BUILD_DIR
# @DESCRIPTION:
# Build directory where all cmake processed files should be generated.
# For in-source build it's fixed to ${CMAKE_USE_DIR}.
# For out-of-source build it can be overriden, by default it uses
# ${WORKDIR}/${P}_build.
+#
+# This variable has been called CMAKE_BUILD_DIR formerly.
+# It is set under that name for compatibility.
# @ECLASS-VARIABLE: CMAKE_BUILD_TYPE
# @DESCRIPTION:
@@ -176,12 +179,31 @@ _check_build_dir() {
: ${CMAKE_USE_DIR:=${S}}
if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
# we build in source dir
- CMAKE_BUILD_DIR="${CMAKE_USE_DIR}"
+ BUILD_DIR="${CMAKE_USE_DIR}"
else
- : ${CMAKE_BUILD_DIR:=${WORKDIR}/${P}_build}
+ # Respect both the old variable and the new one, depending
+ # on which one was set by the ebuild.
+ if [[ ! ${BUILD_DIR} && ${CMAKE_BUILD_DIR} ]]; then
+ eqawarn "The CMAKE_BUILD_DIR variable has been renamed to BUILD_DIR."
+ eqawarn "Please migrate the ebuild to use the new one."
+
+ # In the next call, both variables will be set already
+ # and we'd have to know which one takes precedence.
+ _RESPECT_CMAKE_BUILD_DIR=1
+ fi
+
+ if [[ ${_RESPECT_CMAKE_BUILD_DIR} ]]; then
+ BUILD_DIR=${CMAKE_BUILD_DIR:-${WORKDIR}/${P}_build}
+ else
+ : ${BUILD_DIR:=${WORKDIR}/${P}_build}
+ fi
fi
- mkdir -p "${CMAKE_BUILD_DIR}"
- echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
+
+ # Backwards compatibility for getting the value.
+ CMAKE_BUILD_DIR=${BUILD_DIR}
+
+ mkdir -p "${BUILD_DIR}"
+ echo ">>> Working in BUILD_DIR: \"$BUILD_DIR\""
}
# Determine which generator to use
@@ -353,7 +375,7 @@ enable_cmake-utils_src_configure() {
fi
# Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.)
- local build_rules=${CMAKE_BUILD_DIR}/gentoo_rules.cmake
+ local build_rules=${BUILD_DIR}/gentoo_rules.cmake
cat > "${build_rules}" <<- _EOF_
SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
@@ -390,7 +412,7 @@ enable_cmake-utils_src_configure() {
fi
# Common configure parameters (invariants)
- local common_config=${CMAKE_BUILD_DIR}/gentoo_common_config.cmake
+ local common_config=${BUILD_DIR}/gentoo_common_config.cmake
local libdir=$(get_libdir)
cat > "${common_config}" <<- _EOF_
SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
@@ -422,7 +444,7 @@ enable_cmake-utils_src_configure() {
"${MYCMAKEARGS}"
)
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}"
echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}"
"${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed"
@@ -478,7 +500,7 @@ cmake-utils_src_make() {
debug-print-function ${FUNCNAME} "$@"
_check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
${CMAKE_MAKEFILE_GENERATOR}_src_make $@
@@ -489,7 +511,7 @@ enable_cmake-utils_src_install() {
debug-print-function ${FUNCNAME} "$@"
_check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
DESTDIR=${D} ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
base_src_install_docs
@@ -509,7 +531,7 @@ enable_cmake-utils_src_test() {
debug-print-function ${FUNCNAME} "$@"
_check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
[[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; }
[[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure )
@@ -521,13 +543,13 @@ enable_cmake-utils_src_test() {
else
if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then
# on request from Diego
- eerror "Tests failed. Test log ${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log follows:"
+ eerror "Tests failed. Test log ${BUILD_DIR}/Testing/Temporary/LastTest.log follows:"
eerror "--START TEST LOG--------------------------------------------------------------"
- cat "${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log"
+ cat "${BUILD_DIR}/Testing/Temporary/LastTest.log"
eerror "--END TEST LOG----------------------------------------------------------------"
die "Tests failed."
else
- die "Tests failed. When you file a bug, please attach the following file: \n\t${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log"
+ die "Tests failed. When you file a bug, please attach the following file: \n\t${BUILD_DIR}/Testing/Temporary/LastTest.log"
fi
# die might not die due to nonfatal