summaryrefslogtreecommitdiff
path: root/eclass/cmake-utils.eclass
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2014-01-26 00:43:53 +1100
committerMichael Palimaka <kensington@gentoo.org>2014-01-26 00:44:02 +1100
commit8766df6c1b1fab6128781e6029a3703ed5ea5850 (patch)
treed1bc375875555043b7bf714c94d175651ff1fd7e /eclass/cmake-utils.eclass
parent01788026cf405e794292cc81a4f8e22f2a898864 (diff)
downloadkde-8766df6c1b1fab6128781e6029a3703ed5ea5850.tar.gz
kde-8766df6c1b1fab6128781e6029a3703ed5ea5850.tar.bz2
kde-8766df6c1b1fab6128781e6029a3703ed5ea5850.zip
[eclass] Sync with portage.
This improves support for ninja, wrt bug #490280.
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r--eclass/cmake-utils.eclass42
1 files changed, 34 insertions, 8 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index a36bb7aa15a..0a62e9b39d2 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -523,6 +523,28 @@ enable_cmake-utils_src_compile() {
cmake-utils_src_make "$@"
}
+_ninjaopts_from_makeopts() {
+ if [[ ${NINJAOPTS+set} == set ]]; then
+ return 0
+ fi
+ local ninjaopts=()
+ set -- ${MAKEOPTS}
+ while (( $# )); do
+ case $1 in
+ -j|-l|-k)
+ ninjaopts+=( $1 $2 )
+ shift 2
+ ;;
+ -j*|-l*|-k*)
+ ninjaopts+=( $1 )
+ shift 1
+ ;;
+ *) shift ;;
+ esac
+ done
+ export NINJAOPTS="${ninjaopts[*]}"
+}
+
# @FUNCTION: ninja_src_make
# @INTERNAL
# @DESCRIPTION:
@@ -530,14 +552,18 @@ enable_cmake-utils_src_compile() {
ninja_src_make() {
debug-print-function ${FUNCNAME} "$@"
- [[ -e build.ninja ]] || die "Makefile not found. Error during configure stage."
+ [[ -e build.ninja ]] || die "build.ninja not found. Error during configure stage."
- if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
- # TODO: get load average from portage (-l option)
- ninja ${MAKEOPTS} -v "$@" || die
+ _ninjaopts_from_makeopts
+
+ if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
+ set -- ninja ${NINJAOPTS} -v "$@"
else
- ninja "$@" || die
+ set -- ninja ${NINJAOPTS} "$@"
fi
+
+ echo "$@"
+ "$@" || die
}
# @FUNCTION: emake_src_make
@@ -547,11 +573,11 @@ ninja_src_make() {
emake_src_make() {
debug-print-function ${FUNCNAME} "$@"
- [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
+ [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
- if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
+ if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
emake VERBOSE=1 "$@" || die
- else
+ else
emake "$@" || die
fi