[vlc-commits] Simplify and improve the detection of the number of CPU cores.
Konstantin Pavlov
git at videolan.org
Thu Dec 7 19:39:25 CET 2017
vlc | branch: master | Konstantin Pavlov <thresh at videolan.org> | Thu Dec 7 15:30:13 2017 +0300| [e3dc51fba81c1c34e6eaf4293335135060eccb21] | committer: Konstantin Pavlov
Simplify and improve the detection of the number of CPU cores.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3dc51fba81c1c34e6eaf4293335135060eccb21
---
extras/package/macosx/build.sh | 2 +-
extras/package/win32/build.sh | 2 +-
extras/tools/bootstrap | 11 +++++++----
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/extras/package/macosx/build.sh b/extras/package/macosx/build.sh
index 79c087b965..65c3fba54f 100755
--- a/extras/package/macosx/build.sh
+++ b/extras/package/macosx/build.sh
@@ -16,7 +16,7 @@ OSX_KERNELVERSION=`uname -r | cut -d. -f1`
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
VLCBUILDDIR=""
-CORE_COUNT=`sysctl -n machdep.cpu.core_count`
+CORE_COUNT=`getconf NPROCESSORS_ONLN 2>&1`
let JOBS=$CORE_COUNT+1
usage()
diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 3c76c19b5a..2d943220bd 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -78,7 +78,7 @@ esac
#####
-JOBS=`nproc --all`
+JOBS=`getconf _NPROCESSORS_ONLN 2>&1`
TRIPLET=$ARCH-w64-mingw32
info "Building extra tools"
diff --git a/extras/tools/bootstrap b/extras/tools/bootstrap
index 2dcdd2fc53..93205dea99 100755
--- a/extras/tools/bootstrap
+++ b/extras/tools/bootstrap
@@ -91,13 +91,16 @@ check flex
CPUS=
case `uname` in
Linux|MINGW32*|MINGW64*)
- CPUS=`grep -c ^processor /proc/cpuinfo`
+ CPUS=`getconf _NPROCESSORS_ONLN 2>&1`
;;
- Darwin)
- CPUS=`sysctl hw.ncpu|cut -d" " -f2`
+ Darwin|FreeBSD|NetBSD)
+ CPUS=`getconf NPROCESSORS_ONLN 2>&1`
+ ;;
+ OpenBSD)
+ CPUS=`sysctl -n hw.ncpu 2>&1`
;;
SunOS)
- CPUS=`/usr/bin/kstat -p :::state | grep 'on-line$' | wc -l | sed 's/ //g'`
+ CPUS=`psrinfo | wc -l 2>&1`
;;
*)
CPUS=1 # default
More information about the vlc-commits
mailing list