From: Steve MacLean Date: Thu, 6 Aug 2020 01:54:00 +0000 (-0400) Subject: Fix -numproc script handling (#40437) X-Git-Tag: submit/tizen/20210909.063632~6192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4da9d986fc863ba051441d8d9d1dab7b6a099325;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix -numproc script handling (#40437) --- diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index e5bec2b..29c29a1 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -229,6 +229,20 @@ __BuildOS=$os __msbuildonunsupportedplatform=0 +# Get the number of processors available to the scheduler +# Other techniques such as `nproc` only get the number of +# processors available to a single process. +platform="$(uname)" +if [[ "$platform" == "FreeBSD" ]]; then + __NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }') +elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then + __NumProc=$(($(getconf NPROCESSORS_ONLN)+1)) +elif [[ "$platform" == "Darwin" ]]; then + __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1)) +else + __NumProc=$(nproc --all) +fi + while :; do if [[ "$#" -le 0 ]]; then break @@ -395,20 +409,6 @@ while :; do shift done -# Get the number of processors available to the scheduler -# Other techniques such as `nproc` only get the number of -# processors available to a single process. -platform="$(uname)" -if [[ "$platform" == "FreeBSD" ]]; then - __NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }') -elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then - __NumProc=$(($(getconf NPROCESSORS_ONLN)+1)) -elif [[ "$platform" == "Darwin" ]]; then - __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1)) -else - __NumProc=$(nproc --all) -fi - __CommonMSBuildArgs="/p:TargetArchitecture=$__BuildArch /p:Configuration=$__BuildType /p:TargetOS=$__TargetOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg" # Configure environment if we are doing a verbose build