Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: kde@g.o, tommy@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l'
Date: Sun, 28 Feb 2016 19:03:30
Message-Id: 1456686118-28043-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion by "Michał Górny"
1 Fix the _ninjaopts_from_makeopts to handle no-parameter '-j' and '-l'
2 options correctly and convert them to appropriate parametrized ninja
3 options.
4 ---
5 eclass/cmake-utils.eclass | 15 +++++++++++++--
6 1 file changed, 13 insertions(+), 2 deletions(-)
7
8 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
9 index f5ed1eb..36f9821 100644
10 --- a/eclass/cmake-utils.eclass
11 +++ b/eclass/cmake-utils.eclass
12 @@ -660,8 +660,19 @@ _ninjaopts_from_makeopts() {
13 while (( $# )); do
14 case $1 in
15 -j|-l)
16 - ninjaopts+=( $1 $2 )
17 - shift 2
18 + if [[ $# -eq 1 || $2 == -* ]]; then
19 + if [[ $1 == -j ]]; then
20 + # absurdly high job limit
21 + ninjaopts+=( $1 9999 )
22 + else # -l
23 + # remove load limit (like make does for -l)
24 + ninjaopts+=( $1 0 )
25 + fi
26 + shift 1
27 + else
28 + ninjaopts+=( $1 $2 )
29 + shift 2
30 + fi
31 ;;
32 -j*|-l*)
33 ninjaopts+=( $1 )
34 --
35 2.7.2