/[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.103 Revision 1.109
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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.103 2014/02/08 01:42:44 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.109 2014/08/05 22:59:44 johu 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:
15# The cmake-utils eclass makes creating ebuilds for cmake-based packages much easier. 15# The cmake-utils eclass makes creating ebuilds for cmake-based packages much easier.
16# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source 16# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source
17# builds (default), in-source builds and an implementation of the well-known use_enable 17# builds (default), in-source builds and an implementation of the well-known use_enable
18# and use_with functions for CMake. 18# and use_with functions for CMake.
19 19
20if [[ ${___ECLASS_ONCE_CMAKE_UTILS} != "recur -_+^+_- spank" ]] ; then 20if [[ -z ${_CMAKE_UTILS_ECLASS} ]]; then
21___ECLASS_ONCE_CMAKE_UTILS="recur -_+^+_- spank" 21_CMAKE_UTILS_ECLASS=1
22 22
23# @ECLASS-VARIABLE: WANT_CMAKE 23# @ECLASS-VARIABLE: WANT_CMAKE
24# @DESCRIPTION: 24# @DESCRIPTION:
25# Specify if cmake-utils eclass should depend on cmake optionaly or not. 25# Specify if cmake-utils eclass should depend on cmake optionally or not.
26# This is usefull when only part of aplication is using cmake build system. 26# This is usefull when only part of aplication is using cmake build system.
27# Valid values are: always [default], optional (where the value is the useflag 27# Valid values are: always [default], optional (where the value is the useflag
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 required CMake version. 33# Specify the minimum required CMake version.
34CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.8.9}" 34CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.8.12}"
35 35
36# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST 36# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
37# @DESCRIPTION: 37# @DESCRIPTION:
38# Space-separated list of CMake modules that will be removed in $S during src_prepare, 38# Space-separated list of CMake modules that will be removed in $S during src_prepare,
39# in order to force packages to use the system version. 39# in order to force packages to use the system version.
455 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" 455 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
456 CACHE STRING "" FORCE) 456 CACHE STRING "" FORCE)
457 457
458 ELSE () 458 ELSE ()
459 459
460 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING ""FORCE) 460 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
461 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) 461 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
462 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) 462 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
463 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") 463 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
464 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) 464 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)
465 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) 465 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
590 debug-print-function ${FUNCNAME} "$@" 590 debug-print-function ${FUNCNAME} "$@"
591 591
592 _check_build_dir 592 _check_build_dir
593 pushd "${BUILD_DIR}" >/dev/null 593 pushd "${BUILD_DIR}" >/dev/null
594 594
595 ${CMAKE_MAKEFILE_GENERATOR}_src_make $@ 595 ${CMAKE_MAKEFILE_GENERATOR}_src_make "$@"
596 596
597 popd >/dev/null 597 popd >/dev/null
598} 598}
599 599
600enable_cmake-utils_src_install() { 600enable_cmake-utils_src_install() {
666 666
667# @FUNCTION: cmake-utils_src_prepare 667# @FUNCTION: cmake-utils_src_prepare
668# @DESCRIPTION: 668# @DESCRIPTION:
669# Apply ebuild and user patches. 669# Apply ebuild and user patches.
670cmake-utils_src_prepare() { 670cmake-utils_src_prepare() {
671 _execute_optionaly "src_prepare" "$@" 671 _execute_optionally "src_prepare" "$@"
672} 672}
673 673
674# @FUNCTION: cmake-utils_src_configure 674# @FUNCTION: cmake-utils_src_configure
675# @DESCRIPTION: 675# @DESCRIPTION:
676# General function for configuring with cmake. Default behaviour is to start an 676# General function for configuring with cmake. Default behaviour is to start an
677# out-of-source build. 677# out-of-source build.
678cmake-utils_src_configure() { 678cmake-utils_src_configure() {
679 _execute_optionaly "src_configure" "$@" 679 _execute_optionally "src_configure" "$@"
680} 680}
681 681
682# @FUNCTION: cmake-utils_src_compile 682# @FUNCTION: cmake-utils_src_compile
683# @DESCRIPTION: 683# @DESCRIPTION:
684# General function for compiling with cmake. Default behaviour is to check for 684# General function for compiling with cmake. Default behaviour is to check for
685# EAPI and respectively to configure as well or just compile. 685# EAPI and respectively to configure as well or just compile.
686# Automatically detects the build type. All arguments are passed to emake. 686# Automatically detects the build type. All arguments are passed to emake.
687cmake-utils_src_compile() { 687cmake-utils_src_compile() {
688 _execute_optionaly "src_compile" "$@" 688 _execute_optionally "src_compile" "$@"
689} 689}
690 690
691# @FUNCTION: cmake-utils_src_install 691# @FUNCTION: cmake-utils_src_install
692# @DESCRIPTION: 692# @DESCRIPTION:
693# Function for installing the package. Automatically detects the build type. 693# Function for installing the package. Automatically detects the build type.
694cmake-utils_src_install() { 694cmake-utils_src_install() {
695 _execute_optionaly "src_install" "$@" 695 _execute_optionally "src_install" "$@"
696} 696}
697 697
698# @FUNCTION: cmake-utils_src_test 698# @FUNCTION: cmake-utils_src_test
699# @DESCRIPTION: 699# @DESCRIPTION:
700# Function for testing the package. Automatically detects the build type. 700# Function for testing the package. Automatically detects the build type.
701cmake-utils_src_test() { 701cmake-utils_src_test() {
702 _execute_optionaly "src_test" "$@" 702 _execute_optionally "src_test" "$@"
703} 703}
704 704
705# Optionally executes phases based on WANT_CMAKE variable/USE flag. 705# Optionally executes phases based on WANT_CMAKE variable/USE flag.
706_execute_optionaly() { 706_execute_optionally() {
707 local phase="$1" ; shift 707 local phase="$1" ; shift
708 if [[ ${WANT_CMAKE} = always ]]; then 708 if [[ ${WANT_CMAKE} = always ]]; then
709 enable_cmake-utils_${phase} "$@" 709 enable_cmake-utils_${phase} "$@"
710 else 710 else
711 use ${WANT_CMAKE} && enable_cmake-utils_${phase} "$@" 711 use ${WANT_CMAKE} && enable_cmake-utils_${phase} "$@"

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.109

  ViewVC Help
Powered by ViewVC 1.1.20