/[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.30
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.30 2009/08/08 20:08:02 arfrever 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\""
289 cmakeargs="-C ${common_config} ${cmakeargs}" 296 cmakeargs="-C ${common_config} ${cmakeargs}"
290 297
291 mkdir -p "${CMAKE_BUILD_DIR}" 298 mkdir -p "${CMAKE_BUILD_DIR}"
292 pushd "${CMAKE_BUILD_DIR}" > /dev/null 299 pushd "${CMAKE_BUILD_DIR}" > /dev/null
293 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is $cmakeargs" 300 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is $cmakeargs"
301 echo cmake ${cmakeargs} "${CMAKE_USE_DIR}"
294 cmake ${cmakeargs} "${CMAKE_USE_DIR}" || die "cmake failed" 302 cmake ${cmakeargs} "${CMAKE_USE_DIR}" || die "cmake failed"
295 303
296 popd > /dev/null 304 popd > /dev/null
297} 305}
298 306
329# All arguments are passed to emake: 337# All arguments are passed to emake:
330cmake-utils_src_make() { 338cmake-utils_src_make() {
331 debug-print-function ${FUNCNAME} "$@" 339 debug-print-function ${FUNCNAME} "$@"
332 340
333 _check_build_dir 341 _check_build_dir
334 pushd "${CMAKE_BUILD_DIR}" > /dev/null 342 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
335 # first check if Makefile exist otherwise die 343 # first check if Makefile exist otherwise die
336 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." 344 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
337 if [[ -n ${CMAKE_VERBOSE} ]]; then 345 if [[ -n ${CMAKE_VERBOSE} ]]; then
338 emake VERBOSE=1 "$@" || die "Make failed!" 346 emake VERBOSE=1 "$@" || die "Make failed!"
339 else 347 else
340 emake "$@" || die "Make failed!" 348 emake "$@" || die "Make failed!"
341 fi 349 fi
342 popd > /dev/null 350 popd &> /dev/null
343} 351}
344 352
345# @FUNCTION: cmake-utils_src_install 353# @FUNCTION: cmake-utils_src_install
346# @DESCRIPTION: 354# @DESCRIPTION:
347# Function for installing the package. Automatically detects the build type. 355# Function for installing the package. Automatically detects the build type.
348cmake-utils_src_install() { 356cmake-utils_src_install() {
349 debug-print-function ${FUNCNAME} "$@" 357 debug-print-function ${FUNCNAME} "$@"
350 358
351 _check_build_dir 359 _check_build_dir
352 pushd "${CMAKE_BUILD_DIR}" > /dev/null 360 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
353 emake install DESTDIR="${D}" || die "Make install failed" 361 emake install DESTDIR="${D}" || die "Make install failed"
354 popd > /dev/null 362 popd &> /dev/null
355 363
356 # Manual document installation 364 # Manual document installation
357 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; } 365 [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; }
358 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; } 366 [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; }
359} 367}
363# Function for testing the package. Automatically detects the build type. 371# Function for testing the package. Automatically detects the build type.
364cmake-utils_src_test() { 372cmake-utils_src_test() {
365 debug-print-function ${FUNCNAME} "$@" 373 debug-print-function ${FUNCNAME} "$@"
366 374
367 _check_build_dir 375 _check_build_dir
368 pushd "${CMAKE_BUILD_DIR}" > /dev/null 376 pushd "${CMAKE_BUILD_DIR}" &> /dev/null
369 # Standard implementation of src_test 377 # Standard implementation of src_test
370 if emake -j1 check -n &> /dev/null; then 378 if emake -j1 check -n &> /dev/null; then
371 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" 379 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
372 if ! emake -j1 check; then 380 if ! emake -j1 check; then
373 die "Make check failed. See above for details." 381 die "Make check failed. See above for details."
378 die "Make test failed. See above for details." 386 die "Make test failed. See above for details."
379 fi 387 fi
380 else 388 else
381 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}" 389 einfo ">>> Test phase [none]: ${CATEGORY}/${PF}"
382 fi 390 fi
383 popd > /dev/null 391 popd &> /dev/null
384} 392}

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

  ViewVC Help
Powered by ViewVC 1.1.20