/[gentoo-x86]/eclass/cmake-utils.eclass
Gentoo

Diff of /eclass/cmake-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.27 Revision 1.31
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.27 2009/05/27 14:34:33 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.31 2009/10/16 12:24:09 ssuominen Exp $
4 4
5# @ECLASS: cmake-utils.eclass 5# @ECLASS: cmake-utils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# 8#
128 # Specify the build directory where all cmake processed 128 # Specify the build directory where all cmake processed
129 # files should be located. 129 # files should be located.
130 # 130 #
131 # For installing binary doins "${CMAKE_BUILD_DIR}/${PN}" 131 # For installing binary doins "${CMAKE_BUILD_DIR}/${PN}"
132 if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then 132 if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then
133 # we build in source dir
133 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}" 134 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}"
134 else 135 elif [[ ${CMAKE_USE_DIR} = ${WORKDIR} ]]; then
136 # out of tree build, but with $S=$WORKDIR, see bug #273949 for reason.
135 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}_build" 137 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}/build"
138 else
139 # regular out of tree build
140 [[ ${1} = init || -d ${CMAKE_USE_DIR}_build ]] && SUF="_build" || SUF=""
141 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}${SUF}"
142
136 fi 143 fi
137 echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\"" 144 echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
138} 145}
139# @FUNCTION: cmake-utils_use_with 146# @FUNCTION: cmake-utils_use_with
140# @USAGE: <USE flag> [flag name] 147# @USAGE: <USE flag> [flag name]
235# @FUNCTION: cmake-utils_src_configure 242# @FUNCTION: cmake-utils_src_configure
236# @DESCRIPTION: 243# @DESCRIPTION:
237# General function for configuring with cmake. Default behaviour is to start an 244# General function for configuring with cmake. Default behaviour is to start an
238# out-of-source build. 245# out-of-source build.
239cmake-utils_src_configure() { 246cmake-utils_src_configure() {
240 debug-print-function ${FUNCNAME} "$@" 247 export XDG_CONFIG_HOME="${T}"
241 248
249 debug-print-function ${FUNCNAME} "$@"
250
242 _check_build_dir 251 _check_build_dir init
243 252
244 # check if CMakeLists.txt exist and if no then die 253 # check if CMakeLists.txt exist and if no then die
245 if [[ ! -e "${CMAKE_USE_DIR}"/CMakeLists.txt ]] ; then 254 if [[ ! -e "${CMAKE_USE_DIR}"/CMakeLists.txt ]] ; then
246 eerror "I was unable to locate CMakeLists.txt under:" 255 eerror "I was unable to locate CMakeLists.txt under:"
247 eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\"" 256 eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
289 cmakeargs="-C ${common_config} ${cmakeargs}" 298 cmakeargs="-C ${common_config} ${cmakeargs}"
290 299
291 mkdir -p "${CMAKE_BUILD_DIR}" 300 mkdir -p "${CMAKE_BUILD_DIR}"
292 pushd "${CMAKE_BUILD_DIR}" > /dev/null 301 pushd "${CMAKE_BUILD_DIR}" > /dev/null
293 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is $cmakeargs" 302 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is $cmakeargs"
303 echo cmake ${cmakeargs} "${CMAKE_USE_DIR}"
294 cmake ${cmakeargs} "${CMAKE_USE_DIR}" || die "cmake failed" 304 cmake ${cmakeargs} "${CMAKE_USE_DIR}" || die "cmake failed"
295 305
296 popd > /dev/null 306 popd > /dev/null
297} 307}
298 308
329# All arguments are passed to emake: 339# All arguments are passed to emake:
330cmake-utils_src_make() { 340cmake-utils_src_make() {
331 debug-print-function ${FUNCNAME} "$@" 341 debug-print-function ${FUNCNAME} "$@"
332 342
333 _check_build_dir 343 _check_build_dir
334 pushd "${CMAKE_BUILD_DIR}" > /dev/null 344 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
335 # first check if Makefile exist otherwise die 345 # first check if Makefile exist otherwise die
336 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." 346 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
337 if [[ -n ${CMAKE_VERBOSE} ]]; then 347 if [[ -n ${CMAKE_VERBOSE} ]]; then
338 emake VERBOSE=1 "$@" || die "Make failed!" 348 emake VERBOSE=1 "$@" || die "Make failed!"
339 else 349 else
340 emake "$@" || die "Make failed!" 350 emake "$@" || die "Make failed!"
341 fi 351 fi
342 popd > /dev/null 352 popd &> /dev/null
343} 353}
344 354
345# @FUNCTION: cmake-utils_src_install 355# @FUNCTION: cmake-utils_src_install
346# @DESCRIPTION: 356# @DESCRIPTION:
347# Function for installing the package. Automatically detects the build type. 357# Function for installing the package. Automatically detects the build type.
348cmake-utils_src_install() { 358cmake-utils_src_install() {
349 debug-print-function ${FUNCNAME} "$@" 359 debug-print-function ${FUNCNAME} "$@"
350 360
351 _check_build_dir 361 _check_build_dir
352 pushd "${CMAKE_BUILD_DIR}" > /dev/null 362 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
353 emake install DESTDIR="${D}" || die "Make install failed" 363 emake install DESTDIR="${D}" || die "Make install failed"
354 popd > /dev/null 364 popd &> /dev/null
355 365
356 # Manual document installation 366 # Manual document installation
357 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; } 367 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; }
358 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; } 368 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; }
359} 369}
363# Function for testing the package. Automatically detects the build type. 373# Function for testing the package. Automatically detects the build type.
364cmake-utils_src_test() { 374cmake-utils_src_test() {
365 debug-print-function ${FUNCNAME} "$@" 375 debug-print-function ${FUNCNAME} "$@"
366 376
367 _check_build_dir 377 _check_build_dir
368 pushd "${CMAKE_BUILD_DIR}" > /dev/null 378 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
369 # Standard implementation of src_test 379 # Standard implementation of src_test
370 if emake -j1 check -n &> /dev/null; then 380 if emake -j1 check -n &> /dev/null; then
371 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" 381 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
372 if ! emake -j1 check; then 382 if ! emake -j1 check; then
373 die "Make check failed. See above for details." 383 die "Make check failed. See above for details."
378 die "Make test failed. See above for details." 388 die "Make test failed. See above for details."
379 fi 389 fi
380 else 390 else
381 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}" 391 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}"
382 fi 392 fi
383 popd > /dev/null 393 popd &> /dev/null
384} 394}

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20