/[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.78 Revision 1.80
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.78 2012/04/16 10:28:47 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.80 2012/09/15 16:16:53 zmedico 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# @AUTHOR: 8# @AUTHOR:
59 1|0) ;; 59 1|0) ;;
60 *) die "Unknown EAPI, Bug eclass maintainers." ;; 60 *) die "Unknown EAPI, Bug eclass maintainers." ;;
61esac 61esac
62EXPORT_FUNCTIONS ${CMAKE_EXPF} 62EXPORT_FUNCTIONS ${CMAKE_EXPF}
63 63
64: ${DESCRIPTION:="Based on the ${ECLASS} eclass"}
65
66if [[ ${PN} != cmake ]]; then 64if [[ ${PN} != cmake ]]; then
67 CMAKEDEPEND+=" >=dev-util/cmake-${CMAKE_MIN_VERSION}" 65 CMAKEDEPEND+=" >=dev-util/cmake-${CMAKE_MIN_VERSION}"
68fi 66fi
69 67
70CMAKEDEPEND+=" userland_GNU? ( >=sys-apps/findutils-4.4.0 )" 68CMAKEDEPEND+=" userland_GNU? ( >=sys-apps/findutils-4.4.0 )"
137# plugin needs to be done by cmake. 135# plugin needs to be done by cmake.
138# By default it uses ${S}. 136# By default it uses ${S}.
139 137
140# @ECLASS-VARIABLE: CMAKE_VERBOSE 138# @ECLASS-VARIABLE: CMAKE_VERBOSE
141# @DESCRIPTION: 139# @DESCRIPTION:
142# Set to enable verbose messages during compilation. 140# Set to OFF to disable verbose messages during compilation
141: ${CMAKE_VERBOSE:=ON}
143 142
144# @ECLASS-VARIABLE: PREFIX 143# @ECLASS-VARIABLE: PREFIX
145# @DESCRIPTION: 144# @DESCRIPTION:
146# Eclass respects PREFIX variable, though it's not recommended way to set 145# Eclass respects PREFIX variable, though it's not recommended way to set
147# install/lib/bin prefixes. 146# install/lib/bin prefixes.
148# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead. 147# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead.
148: ${PREFIX:=/usr}
149 149
150# @ECLASS-VARIABLE: CMAKE_BINARY 150# @ECLASS-VARIABLE: CMAKE_BINARY
151# @DESCRIPTION: 151# @DESCRIPTION:
152# Eclass can use different cmake binary than the one provided in by system. 152# Eclass can use different cmake binary than the one provided in by system.
153: ${CMAKE_BINARY:=cmake} 153: ${CMAKE_BINARY:=cmake}
332 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" 332 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
333 CACHE STRING "" FORCE) 333 CACHE STRING "" FORCE)
334 334
335 ELSE () 335 ELSE ()
336 336
337 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX:-/usr}" CACHE STRING ""FORCE) 337 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING ""FORCE)
338 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) 338 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
339 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) 339 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
340 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") 340 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
341 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) 341 SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
342 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) 342 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
343 SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX:-/usr}/lib" CACHE STRING "" FORCE) 343 SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
344 344
345 ENDIF (NOT APPLE) 345 ENDIF (NOT APPLE)
346 _EOF_ 346 _EOF_
347 fi 347 fi
348 348
349 # Common configure parameters (invariants) 349 # Common configure parameters (invariants)
350 local common_config=${CMAKE_BUILD_DIR}/gentoo_common_config.cmake 350 local common_config=${CMAKE_BUILD_DIR}/gentoo_common_config.cmake
351 local libdir=$(get_libdir) 351 local libdir=$(get_libdir)
352 cat > "${common_config}" <<- _EOF_ 352 cat > "${common_config}" <<- _EOF_
353 SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) 353 SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
354 SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries") 354 SET (CMAKE_INSTALL_LIBDIR ${PREFIX}/${libdir} CACHE PATH "Output directory for libraries")
355 _EOF_ 355 _EOF_
356 [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" 356 [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
357 357
358 # Convert mycmakeargs to an array, for backwards compatibility 358 # Convert mycmakeargs to an array, for backwards compatibility
359 # Make the array a local variable since <=portage-2.1.6.x does not 359 # Make the array a local variable since <=portage-2.1.6.x does not
368 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable 368 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
369 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. 369 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
370 local cmakeargs=( 370 local cmakeargs=(
371 --no-warn-unused-cli 371 --no-warn-unused-cli
372 -C "${common_config}" 372 -C "${common_config}"
373 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}" 373 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
374 "${mycmakeargs_local[@]}" 374 "${mycmakeargs_local[@]}"
375 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" 375 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
376 -DCMAKE_INSTALL_DO_STRIP=OFF 376 -DCMAKE_INSTALL_DO_STRIP=OFF
377 -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" 377 -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
378 "${MYCMAKEARGS}" 378 "${MYCMAKEARGS}"
401 401
402 _check_build_dir 402 _check_build_dir
403 pushd "${CMAKE_BUILD_DIR}" > /dev/null 403 pushd "${CMAKE_BUILD_DIR}" > /dev/null
404 # first check if Makefile exist otherwise die 404 # first check if Makefile exist otherwise die
405 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." 405 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
406 if [[ -n ${CMAKE_VERBOSE} ]]; then 406 if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
407 emake VERBOSE=1 "$@" || die "Make failed!" 407 emake VERBOSE=1 "$@" || die "Make failed!"
408 else 408 else
409 emake "$@" || die "Make failed!" 409 emake "$@" || die "Make failed!"
410 fi 410 fi
411 popd > /dev/null 411 popd > /dev/null

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.80

  ViewVC Help
Powered by ViewVC 1.1.20