/[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.29
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.29 2009/06/17 22:39:01 scarabeus 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]
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 debug-print-function ${FUNCNAME} "$@"
241 248
242 _check_build_dir 249 _check_build_dir init
243 250
244 # check if CMakeLists.txt exist and if no then die 251 # check if CMakeLists.txt exist and if no then die
245 if [[ ! -e "${CMAKE_USE_DIR}"/CMakeLists.txt ]] ; then 252 if [[ ! -e "${CMAKE_USE_DIR}"/CMakeLists.txt ]] ; then
246 eerror "I was unable to locate CMakeLists.txt under:" 253 eerror "I was unable to locate CMakeLists.txt under:"
247 eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\"" 254 eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
329# All arguments are passed to emake: 336# All arguments are passed to emake:
330cmake-utils_src_make() { 337cmake-utils_src_make() {
331 debug-print-function ${FUNCNAME} "$@" 338 debug-print-function ${FUNCNAME} "$@"
332 339
333 _check_build_dir 340 _check_build_dir
334 pushd "${CMAKE_BUILD_DIR}" > /dev/null 341 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
335 # first check if Makefile exist otherwise die 342 # first check if Makefile exist otherwise die
336 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." 343 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
337 if [[ -n ${CMAKE_VERBOSE} ]]; then 344 if [[ -n ${CMAKE_VERBOSE} ]]; then
338 emake VERBOSE=1 "$@" || die "Make failed!" 345 emake VERBOSE=1 "$@" || die "Make failed!"
339 else 346 else
340 emake "$@" || die "Make failed!" 347 emake "$@" || die "Make failed!"
341 fi 348 fi
342 popd > /dev/null 349 popd &> /dev/null
343} 350}
344 351
345# @FUNCTION: cmake-utils_src_install 352# @FUNCTION: cmake-utils_src_install
346# @DESCRIPTION: 353# @DESCRIPTION:
347# Function for installing the package. Automatically detects the build type. 354# Function for installing the package. Automatically detects the build type.
348cmake-utils_src_install() { 355cmake-utils_src_install() {
349 debug-print-function ${FUNCNAME} "$@" 356 debug-print-function ${FUNCNAME} "$@"
350 357
351 _check_build_dir 358 _check_build_dir
352 pushd "${CMAKE_BUILD_DIR}" > /dev/null 359 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
353 emake install DESTDIR="${D}" || die "Make install failed" 360 emake install DESTDIR="${D}" || die "Make install failed"
354 popd > /dev/null 361 popd &> /dev/null
355 362
356 # Manual document installation 363 # Manual document installation
357 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; } 364 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; }
358 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; } 365 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; }
359} 366}
363# Function for testing the package. Automatically detects the build type. 370# Function for testing the package. Automatically detects the build type.
364cmake-utils_src_test() { 371cmake-utils_src_test() {
365 debug-print-function ${FUNCNAME} "$@" 372 debug-print-function ${FUNCNAME} "$@"
366 373
367 _check_build_dir 374 _check_build_dir
368 pushd "${CMAKE_BUILD_DIR}" > /dev/null 375 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
369 # Standard implementation of src_test 376 # Standard implementation of src_test
370 if emake -j1 check -n &> /dev/null; then 377 if emake -j1 check -n &> /dev/null; then
371 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" 378 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
372 if ! emake -j1 check; then 379 if ! emake -j1 check; then
373 die "Make check failed. See above for details." 380 die "Make check failed. See above for details."
378 die "Make test failed. See above for details." 385 die "Make test failed. See above for details."
379 fi 386 fi
380 else 387 else
381 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}" 388 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}"
382 fi 389 fi
383 popd > /dev/null 390 popd &> /dev/null
384} 391}

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

  ViewVC Help
Powered by ViewVC 1.1.20