diff options
| author | Tomáš Chvátal <scarabeus@gentoo.org> | 2009-10-27 14:57:47 +0100 |
|---|---|---|
| committer | Tomáš Chvátal <scarabeus@gentoo.org> | 2009-10-27 14:57:47 +0100 |
| commit | 8c67bfb4341659e8a6766b02494f76e609aa8e83 (patch) | |
| tree | d00f9e7d6cb2264e9193110b3f77b357ae9b6d26 | |
| parent | 39658efc9fbe6ad1d409bbc12a146a725911449b (diff) | |
| download | kde-8c67bfb4341659e8a6766b02494f76e609aa8e83.tar.gz kde-8c67bfb4341659e8a6766b02494f76e609aa8e83.tar.bz2 kde-8c67bfb4341659e8a6766b02494f76e609aa8e83.zip | |
[eclasses] Finalize the WANT_CMAKE cleanup.
| -rw-r--r-- | eclass/cmake-utils.eclass | 86 | ||||
| -rw-r--r-- | eclass/kde4-base.eclass | 44 |
2 files changed, 94 insertions, 36 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass index cd0090fedb3..7639cb1e5a8 100644 --- a/eclass/cmake-utils.eclass +++ b/eclass/cmake-utils.eclass @@ -20,6 +20,22 @@ # 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 CMAKE_EXPF="src_compile src_test src_install" @@ -33,12 +49,15 @@ 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() { @@ -234,11 +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() { +enable_cmake-utils_src_configure() { debug-print-function ${FUNCNAME} "$@" _check_build_dir init @@ -302,11 +321,11 @@ _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 ${CMAKE_EXPF} || cmake-utils_src_configure @@ -332,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 @@ -348,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 @@ -372,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 +} diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass index c88130f4863..c746424118b 100644 --- a/eclass/kde4-base.eclass +++ b/eclass/kde4-base.eclass @@ -13,37 +13,33 @@ # NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but # eclass will fail with version older than 2. -# @ECLASS-VARIABLE: WANT_CMAKE +# @ECLASS-VARIABLE: CMAKE_REQUIRED # @DESCRIPTION: -# Specify if cmake-utils eclass is required. Defaults to allways. Please note that -# if the variable is set otherwise src_configure/compile/install calls in ebuild -# must be overrided (can't use the eclass ones). -# Valid values are: always, optional and never -WANT_CMAKE="${WANT_CMAKE:-always}" -case ${WANT_CMAKE} in - always) - exports="src_configure src_compile src_test src_install" - cmake_eclass="cmake-utils" - ;; - optional) - exports="src_configure src_compile src_test src_install" - cmake_eclass="cmake-utils" - ;; - *) - exports="" - cmake_eclass="" - ;; -esac - -inherit base ${cmake_eclass} eutils kde4-functions +# Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'. +# Please note that if it's set to 'never' you need to explicitly override following phases: +# src_configure, src_compile, src_test and src_install. +# Defaults to 'always'. +CMAKE_REQUIRED="${CMAKE_REQUIRED:-always}" +if [[ ${WANT_CMAKE} = false || ${WANT_CMAKE} = never ]]; then + buildsystem_eclass="" + export_fns="" +else + buildsystem_eclass="cmake-utils" + export_fns="src_configure src_compile src_test src_install" +fi get_build_type if [[ ${BUILD_TYPE} = live ]]; then - inherit subversion + subversion_eclass="subversion" fi +inherit base ${cmake_utils} eutils kde4-functions ${subversion_eclass} + +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_postinst pkg_postrm -EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${exports} pkg_postinst pkg_postrm +unset buildsystem_eclass +unset export_fns +unset subversion_eclass case ${KDEBASE} in kde-base) |
