Skip to content
Myr

fix CPU_THREADS/CPU_THREAD_VALID/MAKE_JOBS prefix

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Peter Dave Hello · committed by Peter Dave Hello · parent 6320719 · Browse files · 1 file+21 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+21 added−21 removed

  • other:+21 added−21 removed

1 file+21 added−21 removed

modified:nvm.sh+21 added-21 removed
1230 unmodified lines
1231 make='gmake'1232 MAKE_CXX="CXX=c++"1233 fi12341235 if [ -z "$MAKE_JOBS" ]; then1235 if [ -z "$NVM_MAKE_JOBS" ]; then1236 if [ "_$NVM_OS" = "_linux" ]; then1237 CPU_THREADS="$(grep -c 'core id' /proc/cpuinfo)"1237 NVM_CPU_THREADS="$(grep -c 'core id' /proc/cpuinfo)"1238 elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then1239 CPU_THREADS="$(sysctl -n hw.ncpu)"1239 NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"1240 elif [ "_$NVM_OS" = "_sunos" ]; then1241 CPU_THREADS="$(psrinfo | wc -l)"1241 NVM_CPU_THREADS="$(psrinfo | wc -l)"1242 fi1243 local CPU_THREAD_VALID1244 CPU_THREAD_VALID=$(nvm_is_natural_num $CPU_THREADS)1245 if [ -z "$CPU_THREADS" ] || [ "$CPU_THREAD_VALID" != "true" ] ; then1243 local NVM_CPU_THREAD_VALID1244 NVM_CPU_THREAD_VALID=$(nvm_is_natural_num $NVM_CPU_THREADS)1245 if [ -z "$NVM_CPU_THREADS" ] || [ "$NVM_CPU_THREAD_VALID" != "true" ] ; then1246 echo "Can not determine how many thread(s) we can use, set to only 1 now." 1>&21247 echo "Please report an issue on GitHub to help us make it better and run it faster on your computer!" 1>&21248 MAKE_JOBS="1"1248 NVM_MAKE_JOBS="1"1249 else1250 echo "Detected that you have $CPU_THREADS CPU thread(s)"1251 if [ $CPU_THREADS -gt 2 ]; then1252 MAKE_JOBS=$(($CPU_THREADS - 1))1253 echo "Set the number of jobs to $CPU_THREADS - 1 = $MAKE_JOBS jobs to speed up the build"1250 echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)"1251 if [ $NVM_CPU_THREADS -gt 2 ]; then1252 NVM_MAKE_JOBS=$(($NVM_CPU_THREADS - 1))1253 echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"1254 else1255 MAKE_JOBS=11255 NVM_MAKE_JOBS=11256 echo "Number of CPU thread(s) less or equal to 2 will have only one job a time for 'make'"1257 fi1258 fi1259 fi
17 unmodified lines
1277 nvm_checksum "$tmptarball" "$sum" && \1278 command tar -xzf "$tmptarball" -C "$tmpdir" && \1279 cd "$tmpdir/node-$VERSION" && \1280 ./configure --prefix="$VERSION_PATH" $ADDITIONAL_PARAMETERS && \1281 $make -j $MAKE_JOBS $MAKE_CXX && \1281 $make -j $NVM_MAKE_JOBS $MAKE_CXX && \1282 command rm -f "$VERSION_PATH" 2>/dev/null && \1283 $make -j $MAKE_JOBS $MAKE_CXX install1283 $make -j $NVM_MAKE_JOBS $MAKE_CXX install1284 )1285 then1286 if ! nvm_has "npm" ; then1287 echo "Installing npm..."
294 unmodified lines
1582 nobinary=11583 shift1584 if [ "_$1" = "_-j" ]; then1585 shift1586 local CPU_THREAD_VALID1587 CPU_THREAD_VALID=$(nvm_is_natural_num $1)1588 if [ "$CPU_THREAD_VALID" = "true" ]; then1589 MAKE_JOBS=$11586 local NVM_CPU_THREAD_VALID1587 NVM_CPU_THREAD_VALID=$(nvm_is_natural_num $1)1588 if [ "$NVM_CPU_THREAD_VALID" = "true" ]; then1589 NVM_MAKE_JOBS=$11590 echo "Set number of jobs to $MAKE_JOBS for 'make' utility"1591 else1592 unset MAKE_JOBS1592 unset NVM_MAKE_JOBS1593 echo >&2 "$1 is invalid for CPU threads, should be a natural number"1594 fi1595 shift1596 else1597 unset MAKE_JOBS1597 unset NVM_MAKE_JOBS1598 fi1599 fi16001601 provided_version="$1"
732 unmodified lines