/[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.6 Revision 1.10
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.6 2008/02/20 14:33:20 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.10 2008/09/28 18:52:16 jmbsvicetto 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# @BLURB: common ebuild functions for cmake-based packages 8# @BLURB: common ebuild functions for cmake-based packages
17 17
18inherit toolchain-funcs multilib 18inherit toolchain-funcs multilib
19 19
20DESCRIPTION="Based on the ${ECLASS} eclass" 20DESCRIPTION="Based on the ${ECLASS} eclass"
21 21
22DEPEND="dev-util/cmake" 22DEPEND=">=dev-util/cmake-2.4.6"
23 23
24case ${EAPI} in
25 2)
26 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
27 ;;
28 *)
24EXPORT_FUNCTIONS src_compile src_test src_install 29 EXPORT_FUNCTIONS src_compile src_test src_install
30 ;;
31esac
32
25 33
26# Internal function use by cmake-utils_use_with and cmake-utils_use_enable 34# Internal function use by cmake-utils_use_with and cmake-utils_use_enable
27_use_me_now() { 35_use_me_now() {
28 debug-print-function $FUNCNAME $* 36 debug-print-function $FUNCNAME $*
29 [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]" 37 [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
68# 76#
69# `cmake-utils_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled 77# `cmake-utils_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled
70# and -DHAVE_FOO=OFF if it is disabled. 78# and -DHAVE_FOO=OFF if it is disabled.
71cmake-utils_has() { _use_me_now HAVE "$@" ; } 79cmake-utils_has() { _use_me_now HAVE "$@" ; }
72 80
73# @FUNCTION: cmake-utils_src_compile 81# @FUNCTION: cmake-utils_src_configure
74# @DESCRIPTION: 82# @DESCRIPTION:
75# General function for compiling with cmake. Default behaviour is to start an 83# General function for configuring with cmake. Default behaviour is to start an
76# out-of-source build. All arguments are passed to cmake-utils_src_make. 84# out-of-source build.
77cmake-utils_src_compile() { 85cmake-utils_src_configure() {
78 debug-print-function $FUNCNAME $* 86 debug-print-function $FUNCNAME $*
79 87
80 if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then 88 if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then
81 cmake-utils_src_configurein 89 cmake-utils_src_configurein
82 else 90 else
83 cmake-utils_src_configureout 91 cmake-utils_src_configureout
84 fi 92 fi
93}
94
95# @FUNCTION: cmake-utils_src_compile
96# @DESCRIPTION:
97# General function for compiling with cmake. Default behaviour is to check for
98# eapi and based on it configure or only compile
99cmake-utils_src_compile() {
100 case ${EAPI} in
101 2)
102 ;;
103 *)
104 cmake-utils_src_configure
105 ;;
106 esac
107
85 cmake-utils_src_make "$@" 108 cmake-utils_src_make "$@"
86} 109}
87 110
88# @FUNCTION: cmake-utils_src_configurein 111# @FUNCTION: cmake-utils_src_configurein
89# @DESCRIPTION: 112# @DESCRIPTION:
90# Function for software that requires configure and building in the source 113# Function for software that requires configure and building in the source
91# directory. 114# directory.
92cmake-utils_src_configurein() { 115cmake-utils_src_configurein() {
93 debug-print-function $FUNCNAME $* 116 debug-print-function $FUNCNAME $*
94 117
95 local cmakeargs="$(_common_configure_code) ${mycmakeargs}" 118 local cmakeargs="$(_common_configure_code) ${mycmakeargs} ${EXTRA_ECONF}"
96 119
97 debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs" 120 debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs"
98 cmake ${cmakeargs} . || die "Cmake failed" 121 cmake ${cmakeargs} . || die "Cmake failed"
99} 122}
100 123
103# Function for software that requires configure and building outside the source 126# Function for software that requires configure and building outside the source
104# tree - default. 127# tree - default.
105cmake-utils_src_configureout() { 128cmake-utils_src_configureout() {
106 debug-print-function $FUNCNAME $* 129 debug-print-function $FUNCNAME $*
107 130
108 local cmakeargs="$(_common_configure_code) ${mycmakeargs}" 131 local cmakeargs="$(_common_configure_code) ${mycmakeargs} ${EXTRA_ECONF}"
109 mkdir -p "${WORKDIR}"/${PN}_build 132 mkdir -p "${WORKDIR}"/${PN}_build
110 pushd "${WORKDIR}"/${PN}_build > /dev/null 133 pushd "${WORKDIR}"/${PN}_build > /dev/null
111 134
112 debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs" 135 debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs"
113 cmake ${cmakeargs} "${S}" || die "Cmake failed" 136 cmake ${cmakeargs} "${S}" || die "Cmake failed"

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20