Browse Source

build: try to autodetect the number of CPU threads available and tweak the

parallel builds accordingly.
legacy
Sam Hocevar sam 12 years ago
parent
commit
ff34685ab7
1 changed files with 28 additions and 1 deletions
  1. +28
    -1
      build/lol-build

+ 28
- 1
build/lol-build View File

@@ -31,12 +31,39 @@ set -e
action="$1"
platform="$2"

###############################################################################
# Initialisation code
#
# - sets the top_srcdir variable
# - sets the LOL_PARALLEL variable
# - fix PATH and MKPATH if necessary
#
__init__()
{
top_srcdir="$(dirname "$0")/.."
cd "$top_srcdir"
top_srcdir="`pwd`"

case "$cpu_count" in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
*) if [ -r "/proc/cpuinfo" ]; then
cpu_count="$(grep -c '^processor\>' /proc/cpuinfo)"
fi ;;
esac
case "$cpu_count" in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
*) cpu_count="$(sysctl -n hw.ncpu 2>/dev/null)" ;;
esac
case "$cpu_count" in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
*) cpu_count=1 ;;
esac
case "$cpu_count" in
1) LOL_PARALLEL=1 ;;
2) LOL_PARALLEL=3 ;;
*) LOL_PARALLEL="$(expr $cpu_count '*' 3 / 2)" ;;
esac

case "${MSYSTEM}" in
MINGW32|MINGW64)
PATH="$PATH:./contrib/gtk-2.22.1/bin"
@@ -188,7 +215,7 @@ build()
ant compile
;;
*)
make -j6
make -j$LOL_PARALLEL
;;
esac
}


Loading…
Cancel
Save