diff --git a/build/lol-build b/build/lol-build index f8ce5d27..6804c471 100755 --- a/build/lol-build +++ b/build/lol-build @@ -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 }