[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l'
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2016-02-28 19:01:58
Message-ID: 1456686118-28043-3-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]

Fix the _ninjaopts_from_makeopts to handle no-parameter '-j' and '-l'
options correctly and convert them to appropriate parametrized ninja
options.
---
 eclass/cmake-utils.eclass | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index f5ed1eb..36f9821 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -660,8 +660,19 @@ _ninjaopts_from_makeopts() {
 	while (( $# )); do
 		case $1 in
 			-j|-l)
-				ninjaopts+=( $1 $2 )
-				shift 2
+				if [[ $# -eq 1 || $2 == -* ]]; then
+					if [[ $1 == -j ]]; then
+						# absurdly high job limit
+						ninjaopts+=( $1 9999 )
+					else # -l
+						# remove load limit (like make does for -l)
+						ninjaopts+=( $1 0 )
+					fi
+					shift 1
+				else
+					ninjaopts+=( $1 $2 )
+					shift 2
+				fi
 				;;
 			-j*|-l*)
 				ninjaopts+=( $1 )
-- 
2.7.2


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic