diff options
author | Tomas Chvatal <scarabeus@gentoo.org> | 2009-10-27 14:16:49 +0000 |
---|---|---|
committer | Tomas Chvatal <scarabeus@gentoo.org> | 2009-10-27 14:16:49 +0000 |
commit | 5caf61881af3c1e3c96b46f055b5dbcff83639aa (patch) | |
tree | c33f68bc7bf313b1ee3e22ef415a9f51cc6da0c3 /eclass/cmake-utils.eclass | |
parent | If no -O flag is specified, append-flags -O2 (to gain -fomit-frame-pointer by... (diff) | |
download | historical-5caf61881af3c1e3c96b46f055b5dbcff83639aa.tar.gz historical-5caf61881af3c1e3c96b46f055b5dbcff83639aa.tar.bz2 historical-5caf61881af3c1e3c96b46f055b5dbcff83639aa.zip |
Sync cmake-utils and kde eclasses with kde-testing overlays.
Renamed WANT_CMAKE -> CMAKE_REQUIRED in kde eclasses
fixed koffice2.0 support in kde eclasses
Added WANT_CMAKE into cmake-utils eclass, where it brings possibility to depend on cmake only when some useflag is required.
Used with WANT_CMAKE="variable", where variable is the useflag (its autoadded to IUSE too.)
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r-- | eclass/cmake-utils.eclass | 122 |
1 files changed, 82 insertions, 40 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass index 718ef64375a1..cf017e1aa6af 100644 --- a/eclass/cmake-utils.eclass +++ b/eclass/cmake-utils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.31 2009/10/16 12:24:09 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.32 2009/10/27 14:16:49 scarabeus Exp $ # @ECLASS: cmake-utils.eclass # @MAINTAINER: @@ -20,25 +20,44 @@ # builds and an implementation of the well-known use_enable and use_with # functions for CMake. +# @ECLASS-VARIABLE: WANT_CMAKE +# @DESCRIPTION: +# Specify if cmake-utils eclass should depend on cmake optionaly or not. +# This is usefull when only part of aplication is using cmake build system. +# Valid values are: always [default], optional (where the value is the useflag +# used for optionality) +WANT_CMAKE="${WANT_CMAKE:-always}" +CMAKEDEPEND="" +case ${WANT_CMAKE} in + always) + ;; + *) + IUSE+=" ${WANT_CMAKE}" + CMAKEDEPEND+="${WANT_CMAKE}? ( " + ;; +esac inherit toolchain-funcs multilib flag-o-matic base -EXPF="src_compile src_test src_install" +CMAKE_EXPF="src_compile src_test src_install" case ${EAPI:-0} in - 2) EXPF="${EXPF} src_configure" ;; + 2) CMAKE_EXPF+=" src_configure" ;; 1|0) ;; *) die "Unknown EAPI, Bug eclass maintainers." ;; esac -EXPORT_FUNCTIONS ${EXPF} +EXPORT_FUNCTIONS ${CMAKE_EXPF} : ${DESCRIPTION:="Based on the ${ECLASS} eclass"} if [[ ${PN} != cmake ]]; then - CMAKEDEPEND=">=dev-util/cmake-2.6.2-r1" + CMAKEDEPEND+=">=dev-util/cmake-2.6.2-r1" fi -DEPEND="${CMAKEDEPEND} - userland_GNU? ( >=sys-apps/findutils-4.4.0 ) -" +CMAKEDEPEND+="userland_GNU? ( >=sys-apps/findutils-4.4.0 )" + +[[ ${WANT_CMAKE} = always ]] || CMAKEDEPEND+=" )" + +DEPEND="${CMAKEDEPEND}" +unset CMAKEDEPEND # Internal functions used by cmake-utils_use_* _use_me_now() { @@ -206,11 +225,6 @@ cmake-utils_use_build() { _use_me_now BUILD_ "$@" ; } # and -DHAVE_FOO=OFF if it is disabled. cmake-utils_use_has() { _use_me_now HAVE_ "$@" ; } -# @FUNCTION: cmake-utils_has -# @DESCRIPTION: -# Deprecated, use cmake-utils_use_has, kept now for backcompat. -cmake-utils_has() { ewarn "QA notice: using deprecated ${FUNCNAME} call, use cmake-utils_use_has instead." ; _use_me_now HAVE_ "$@" ; } - # @FUNCTION: cmake-utils_use # @USAGE: <USE flag> [flag name] # @DESCRIPTION: @@ -239,13 +253,11 @@ Build type: ${CMAKE_BUILD_TYPE} Install path: ${CMAKE_INSTALL_PREFIX}\n")' >> CMakeLists.txt } -# @FUNCTION: cmake-utils_src_configure +# @FUNCTION: enable_cmake-utils_src_configure # @DESCRIPTION: # General function for configuring with cmake. Default behaviour is to start an # out-of-source build. -cmake-utils_src_configure() { - export XDG_CONFIG_HOME="${T}" - +enable_cmake-utils_src_configure() { debug-print-function ${FUNCNAME} "$@" _check_build_dir init @@ -261,6 +273,9 @@ cmake-utils_src_configure() { # Remove dangerous things. _modify-cmakelists + # Fix xdg collision with sandbox + export XDG_CONFIG_HOME="${T}" + # @SEE CMAKE_BUILD_TYPE if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then # Handle release builds @@ -306,33 +321,17 @@ _EOF_ popd > /dev/null } -# @FUNCTION: cmake-utils_src_compile +# @FUNCTION: enable_cmake-utils_src_compile # @DESCRIPTION: # General function for compiling with cmake. Default behaviour is to check for # EAPI and respectively to configure as well or just compile. -cmake-utils_src_compile() { +enable_cmake-utils_src_compile() { debug-print-function ${FUNCNAME} "$@" - has src_configure ${EXPF} || cmake-utils_src_configure + has src_configure ${CMAKE_EXPF} || cmake-utils_src_configure cmake-utils_src_make "$@" } -# @FUNCTION: cmake-utils_src_configurein -# @DESCRIPTION: -# Deprecated -cmake-utils_src_configurein() { - ewarn "QA notice: using deprecated ${FUNCNAME} call, set CMAKE_IN_SOURCE_BUILD=1 instead." - cmake-utils_src_configure -} - -# @FUNCTION: cmake-utils_src_configureout -# @DESCRIPTION: -# Deprecated -cmake-utils_src_configureout() { - ewarn "QA notice: using deprecated ${FUNCNAME} call, out of source build is enabled by default." - cmake-utils_src_configure -} - # @FUNCTION: cmake-utils_src_make # @DESCRIPTION: # Function for building the package. Automatically detects the build type. @@ -352,10 +351,10 @@ cmake-utils_src_make() { popd &> /dev/null } -# @FUNCTION: cmake-utils_src_install +# @FUNCTION: enable_cmake-utils_src_install # @DESCRIPTION: # Function for installing the package. Automatically detects the build type. -cmake-utils_src_install() { +enable_cmake-utils_src_install() { debug-print-function ${FUNCNAME} "$@" _check_build_dir @@ -368,10 +367,10 @@ cmake-utils_src_install() { [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; } } -# @FUNCTION: cmake-utils_src_test +# @FUNCTION: enable_cmake-utils_src_test # @DESCRIPTION: # Function for testing the package. Automatically detects the build type. -cmake-utils_src_test() { +enable_cmake-utils_src_test() { debug-print-function ${FUNCNAME} "$@" _check_build_dir @@ -392,3 +391,46 @@ cmake-utils_src_test() { fi popd &> /dev/null } + +## Wrappers for calls bellow this line +# @FUNCTION: cmake-utils_src_configure +# @DESCRIPTION: +# Wrapper for detection if we want to run enable_ prefixed function with same name +# unconditionaly or only when some useflag is enabled. +cmake-utils_src_configure() { + _inherit_optionaly "src_configure" +} + +# @FUNCTION: cmake-utils_src_compile +# @DESCRIPTION: +# Wrapper for detection if we want to run enable_ prefixed function with same name +# unconditionaly or only when some useflag is enabled. +cmake-utils_src_compile() { + _inherit_optionaly "src_compile" +} + +# @FUNCTION: cmake-utils_src_install +# @DESCRIPTION: +# Wrapper for detection if we want to run enable_ prefixed function with same name +# unconditionaly or only when some useflag is enabled. +cmake-utils_src_install() { + _inherit_optionaly "src_install" +} + +# @FUNCTION: cmake-utils_src_test +# @DESCRIPTION: +# Wrapper for detection if we want to run enable_ prefixed function with same name +# unconditionaly or only when some useflag is enabled. +cmake-utils_src_test() { + _inherit_optionaly "src_test" +} + + +_execute_optionaly() { + local phase="$1" + if [[ ${WANT_CMAKE} = always ]]; then + enable_cmake-utils_${phase} + else + use ${WANT_CMAKE} && enable_cmake-utils_${phase} + fi +} |