[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 3/4] cmake-utils: support common BUILD_DIR variable.
From: Michał Górny <mgorny () gentoo ! org>
Date: 2012-11-29 13:40:57
Message-ID: 1354196458-17485-4-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]
---
gx86/eclass/cmake-utils.eclass | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/gx86/eclass/cmake-utils.eclass b/gx86/eclass/cmake-utils.eclass
index 2129ebf..26fc1c1 100644
--- a/gx86/eclass/cmake-utils.eclass
+++ b/gx86/eclass/cmake-utils.eclass
@@ -114,12 +114,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:
@@ -163,12 +166,14 @@ _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}
+ : ${BUILD_DIR:=${CMAKE_BUILD_DIR:-${WORKDIR}/${P}_build}}
fi
- mkdir -p "${CMAKE_BUILD_DIR}"
- echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
+ CMAKE_BUILD_DIR=${BUILD_DIR}
+
+ mkdir -p "${BUILD_DIR}"
+ echo ">>> Working in BUILD_DIR: \"$BUILD_DIR\""
}
# Determine which generator to use
@@ -328,7 +333,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_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE)
@@ -364,7 +369,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)
@@ -396,7 +401,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"
@@ -418,7 +423,7 @@ cmake-utils_src_make() {
debug-print-function ${FUNCNAME} "$@"
_check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
if [[ $(_generator_to_use) = Ninja ]]; then
# first check if Makefile exist otherwise die
[[ -e build.ninja ]] || die "Makefile not found. Error during configure stage."
@@ -444,7 +449,7 @@ enable_cmake-utils_src_install() {
debug-print-function ${FUNCNAME} "$@"
_check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
+ pushd "${BUILD_DIR}" > /dev/null
if [[ $(_generator_to_use) = Ninja ]]; then
DESTDIR=${D} ninja install "$@" || die "died running ninja install"
base_src_install_docs
@@ -467,7 +472,7 @@ enable_cmake-utils_src_test() {
local ctestargs
_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} ]] && ctestargs="--extra-verbose --output-on-failure"
@@ -479,13 +484,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
--
1.8.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic