Commit a6ab65bc authored by David Fuhrmann's avatar David Fuhrmann

macOS build.sh: Add option to limit number of cores to be used

The parameter passed by with -j will be forwarded to the -j
parameter of make calls. If the option is not set, a default value
is used. By passing 1, the caller can force one core only.
parent b7c54ca2
......@@ -15,6 +15,9 @@ OSX_VERSION=`xcrun --show-sdk-version`
OSX_KERNELVERSION=`uname -r | cut -d. -f1`
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
CORE_COUNT=`sysctl -n machdep.cpu.core_count`
let JOBS=$CORE_COUNT+1
usage()
{
cat << EOF
......@@ -25,6 +28,7 @@ Build vlc in the current directory
OPTIONS:
-h Show some help
-q Be quiet
-j Force number of cores to be used
-r Rebuild everything (tools, contribs, vlc)
-c Recompile contribs from sources
-k <sdk> Use the specified sdk (default: $SDKROOT)
......@@ -43,7 +47,7 @@ spopd()
popd > /dev/null
}
while getopts "hvrck:a:" OPTION
while getopts "hvrck:a:j:" OPTION
do
case $OPTION in
h)
......@@ -66,6 +70,9 @@ do
k)
SDKROOT=$OPTARG
;;
j)
JOBS=$OPTARG
;;
esac
done
shift $(($OPTIND - 1))
......@@ -142,9 +149,6 @@ fi
make > $out
spopd
core_count=`sysctl -n machdep.cpu.core_count`
let jobs=$core_count+1
#
# vlc/contribs
#
......@@ -169,8 +173,8 @@ if [ "$REBUILD" = "yes" ]; then
fi
if [ "$CONTRIBFROMSOURCE" = "yes" ]; then
make fetch
make -j$jobs .gettext
make -j$jobs
make -j$JOBS .gettext
make -j$JOBS
else
if [ ! -e "../$TRIPLET" ]; then
make prebuilt > $out
......@@ -219,8 +223,8 @@ if [ "$REBUILD" = "yes" ]; then
make clean
fi
info "Running make -j$jobs"
make -j$jobs
info "Running make -j$JOBS"
make -j$JOBS
info "Preparing VLC.app"
make VLC.app
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment