From 8766df6c1b1fab6128781e6029a3703ed5ea5850 Mon Sep 17 00:00:00 2001 From: Michael Palimaka Date: Sun, 26 Jan 2014 00:43:53 +1100 Subject: [eclass] Sync with portage. This improves support for ninja, wrt bug #490280. --- eclass/cmake-utils.eclass | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'eclass/cmake-utils.eclass') 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 -- cgit v1.2.3