/[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.58 Revision 1.63
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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.58 2010/08/13 05:02:49 reavertm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.63 2011/01/13 19:17:00 grobian 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#
28# used for optionality) 28# used for optionality)
29WANT_CMAKE="${WANT_CMAKE:-always}" 29WANT_CMAKE="${WANT_CMAKE:-always}"
30 30
31# @ECLASS-VARIABLE: CMAKE_MIN_VERSION 31# @ECLASS-VARIABLE: CMAKE_MIN_VERSION
32# @DESCRIPTION: 32# @DESCRIPTION:
33# Specify the minimum allowable version of cmake. Defaults to 2.6.2-r1 33# Specify the minimum required CMake version. Default is 2.6.2-r1
34CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.6.2-r1}" 34CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.6.2-r1}"
35 35
36CMAKEDEPEND="" 36CMAKEDEPEND=""
37case ${WANT_CMAKE} in 37case ${WANT_CMAKE} in
38 always) 38 always)
136# @DESCRIPTION: 136# @DESCRIPTION:
137# Eclass respects PREFIX variable, though it's not recommended way to set 137# Eclass respects PREFIX variable, though it's not recommended way to set
138# install/lib/bin prefixes. 138# install/lib/bin prefixes.
139# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead. 139# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead.
140 140
141# @ECLASS-VARIABLE: CMAKE_BINARY
142# @DESCRIPTION:
143# Eclass can use different cmake binary than the one provided in by system.
144: ${CMAKE_BINARY:=cmake}
145
141# Determine using IN or OUT source build 146# Determine using IN or OUT source build
142_check_build_dir() { 147_check_build_dir() {
143 : ${CMAKE_USE_DIR:=${S}} 148 : ${CMAKE_USE_DIR:=${S}}
144 if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then 149 if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
145 # we build in source dir 150 # we build in source dir
146 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}" 151 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}"
147 elif [[ ${CMAKE_USE_DIR} = ${WORKDIR} ]]; then
148 # out of tree build, but with $S=$WORKDIR, see bug #273949 for reason.
149 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}/build"
150 else 152 else
151 # regular out of tree build 153 : ${CMAKE_BUILD_DIR:=${WORKDIR}/${P}_build}
152 [[ ${1} = init || -d ${CMAKE_USE_DIR}_build ]] && SUF="_build" || SUF=""
153 CMAKE_BUILD_DIR="${CMAKE_USE_DIR}${SUF}"
154 fi 154 fi
155 echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\"" 155 echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
156} 156}
157# @FUNCTION: cmake-utils_use_with 157# @FUNCTION: cmake-utils_use_with
158# @USAGE: <USE flag> [flag name] 158# @USAGE: <USE flag> [flag name]
307 # right ... except for Darwin hosts 307 # right ... except for Darwin hosts
308 IF (NOT APPLE) 308 IF (NOT APPLE)
309 SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) 309 SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
310 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" 310 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
311 CACHE STRING "" FORCE) 311 CACHE STRING "" FORCE)
312
313 ELSE ()
314
315 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX:-/usr}" CACHE STRING ""FORCE)
316 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
317 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
318 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "" FORCE)
319 SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX:-/usr}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
320 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
321 SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX:-/usr}/lib" CACHE STRING "" FORCE)
322
312 ENDIF (NOT APPLE) 323 ENDIF (NOT APPLE)
313 _EOF_ 324 _EOF_
314 fi 325 fi
315 326
316 # Common configure parameters (invariants) 327 # Common configure parameters (invariants)
347 ) 358 )
348 359
349 mkdir -p "${CMAKE_BUILD_DIR}" 360 mkdir -p "${CMAKE_BUILD_DIR}"
350 pushd "${CMAKE_BUILD_DIR}" > /dev/null 361 pushd "${CMAKE_BUILD_DIR}" > /dev/null
351 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}" 362 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}"
352 echo cmake "${cmakeargs[@]}" "${CMAKE_USE_DIR}" 363 echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}"
353 cmake "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed" 364 "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed"
354 popd > /dev/null 365 popd > /dev/null
355} 366}
356 367
357enable_cmake-utils_src_compile() { 368enable_cmake-utils_src_compile() {
358 debug-print-function ${FUNCNAME} "$@" 369 debug-print-function ${FUNCNAME} "$@"
383enable_cmake-utils_src_install() { 394enable_cmake-utils_src_install() {
384 debug-print-function ${FUNCNAME} "$@" 395 debug-print-function ${FUNCNAME} "$@"
385 396
386 _check_build_dir 397 _check_build_dir
387 pushd "${CMAKE_BUILD_DIR}" > /dev/null 398 pushd "${CMAKE_BUILD_DIR}" > /dev/null
388 base_src_install 399 base_src_install "$@"
389 popd > /dev/null 400 popd > /dev/null
390 401
391 # Backward compatibility, for non-array variables 402 # Backward compatibility, for non-array variables
392 if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then 403 if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
393 dodoc ${DOCS} || die "dodoc failed" 404 dodoc ${DOCS} || die "dodoc failed"

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.20