cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l'
authorMichał Górny <mgorny@gentoo.org>
Sun, 28 Feb 2016 18:42:18 +0000 (19:42 +0100)
committerMichał Górny <mgorny@gentoo.org>
Thu, 26 May 2016 08:09:57 +0000 (10:09 +0200)
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

index d035e0459f23bc40eddecb789a94b8cc03571c96..02b06bb3df892b0c0a32605f778cedd5ea4f1a28 100644 (file)
@@ -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 )