aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <tchvatal@suse.cz>2012-10-31 14:40:43 +0100
committerTomas Chvatal <tchvatal@suse.cz>2012-10-31 14:40:43 +0100
commitf472e8d3a2178094c650f673b79441089491d7b6 (patch)
tree4d0dbe7c43573b81b69fa38f6508afb3820adad8
parent[app-text/kbibtex] Version bump 0.5_beta1 wrt bug #440122. Add 0.5 branch liv... (diff)
downloadkde-f472e8d3a2178094c650f673b79441089491d7b6.tar.gz
kde-f472e8d3a2178094c650f673b79441089491d7b6.tar.bz2
kde-f472e8d3a2178094c650f673b79441089491d7b6.zip
[eclass] Try to make cmake-utils work nice with ninja. Wrt bug#439608.
-rw-r--r--eclass/cmake-utils.eclass102
1 files changed, 72 insertions, 30 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 1adb29d56e..a624196e3c 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.85 2012/10/25 12:48:58 scarabeus Exp $
# @ECLASS: cmake-utils.eclass
# @MAINTAINER:
@@ -44,9 +44,9 @@ CMAKE_REMOVE_MODULES="${CMAKE_REMOVE_MODULES:-yes}"
# @ECLASS-VARIABLE: CMAKE_MAKEFILE_GENERATOR
# @DESCRIPTION:
-# Specify a makefile generator to be used by cmake. At this point only "make"
-# and "ninja" is supported.
-CMAKE_MAKEFILE_GENERATOR="${CMAKE_MAKEFILE_GENERATOR:-make}"
+# Specify a makefile generator to be used by cmake.
+# At this point only "emake" and "ninja" is supported.
+CMAKE_MAKEFILE_GENERATOR="${CMAKE_MAKEFILE_GENERATOR:-emake}"
CMAKEDEPEND=""
case ${WANT_CMAKE} in
@@ -67,6 +67,19 @@ case ${EAPI:-0} in
esac
EXPORT_FUNCTIONS ${CMAKE_EXPF}
+case ${CMAKE_MAKEFILE_GENERATOR} in
+ emake)
+ CMAKEDEPEND+=" sys-devel/make"
+ ;;
+ ninja)
+ CMAKEDEPEND+=" dev-util/ninja"
+ ;;
+ *)
+ eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}"
+ die "Value ${CMAKE_MAKEFILE_GENERATOR} is not supported"
+ ;;
+esac
+
if [[ ${PN} != cmake ]]; then
CMAKEDEPEND+=" >=dev-util/cmake-${CMAKE_MIN_VERSION}"
fi
@@ -173,10 +186,22 @@ _check_build_dir() {
# Determine which generator to use
_generator_to_use() {
- if [[ ${CMAKE_MAKEFILE_GENERATOR} = "ninja" ]]; then
- has_version dev-util/ninja && echo "Ninja" && return
- fi
- echo "Unix Makefiles"
+ local generator_name
+
+ case ${CMAKE_MAKEFILE_GENERATOR} in
+ ninja)
+ generator_name="Ninja"
+ ;;
+ emake)
+ generator_name="Unix Makefiles"
+ ;;
+ *)
+ eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}"
+ die "Value ${CMAKE_MAKEFILE_GENERATOR} is not supported"
+ ;;
+ esac
+
+ echo ${generator_name}
}
# @FUNCTION: cmake-utils_use_with
@@ -410,33 +435,52 @@ enable_cmake-utils_src_compile() {
cmake-utils_src_make "$@"
}
-# @FUNCTION: cmake-utils_src_make
+# @FUNCTION: ninja_src_make
+# @INTERNAL
# @DESCRIPTION:
-# Function for building the package. Automatically detects the build type.
-# All arguments are passed to emake.
-cmake-utils_src_make() {
+# Build the package using ninja generator
+ninja_src_make() {
debug-print-function ${FUNCNAME} "$@"
- _check_build_dir
- pushd "${CMAKE_BUILD_DIR}" > /dev/null
- if [[ $(_generator_to_use) = Ninja ]]; then
- # first check if Makefile exist otherwise die
[[ -e build.ninja ]] || die "Makefile not found. Error during configure stage."
+
if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
- #TODO get load average from portage (-l option)
- ninja ${MAKEOPTS} -v "$@"
- else
- ninja "$@"
- fi || die "ninja failed!"
+ # TODO: get load average from portage (-l option)
+ ninja ${MAKEOPTS} -v "$@" || die
else
- # first check if Makefile exist otherwise die
+ ninja "$@" || die
+ fi
+}
+
+# @FUNCTION: make_src_make
+# @INTERNAL
+# @DESCRIPTION:
+# Build the package using make generator
+emake_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
[[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
+
if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
- emake VERBOSE=1 "$@" || die "Make failed!"
+ emake VERBOSE=1 "$@" || die
else
- emake "$@" || die "Make failed!"
- fi
+ emake "$@" || die
fi
+
+}
+
+# @FUNCTION: cmake-utils_src_make
+# @DESCRIPTION:
+# Function for building the package. Automatically detects the build type.
+# All arguments are passed to emake.
+cmake-utils_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${CMAKE_BUILD_DIR}" > /dev/null
+
+ ${CMAKE_MAKEFILE_GENERATOR}_src_make $@
+
popd > /dev/null
}
@@ -445,12 +489,10 @@ enable_cmake-utils_src_install() {
_check_build_dir
pushd "${CMAKE_BUILD_DIR}" > /dev/null
- if [[ $(_generator_to_use) = Ninja ]]; then
- DESTDIR=${D} ninja install "$@" || die "died running ninja install"
+
+ DESTDIR=${D} ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ninja install"
base_src_install_docs
- else
- base_src_install "$@"
- fi
+
popd > /dev/null
# Backward compatibility, for non-array variables