cookutils diff cook @ rev 860

cook: changed the algorithm for determining the free memory: Busybox-1.26.1 has different output of the `free` command.
I believe with /proc/meminfo it will be more consistent result.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Jan 08 01:50:38 2017 +0200 (2017-01-08)
parents 0ade59078977
children 1b9bb2671837
line diff
     1.1 --- a/cook	Mon Jan 02 06:14:09 2017 +0200
     1.2 +++ b/cook	Sun Jan 08 01:50:38 2017 +0200
     1.3 @@ -1030,10 +1030,10 @@
     1.4  	[ -z "$continue" ] && rm -rf source 2>/dev/null
     1.5  	rm -rf install taz 2>/dev/null
     1.6  
     1.7 -	# Disable -pipe if less than 512Mb free RAM.
     1.8 -	free=$(free | awk '/buffers:/{print $4}')
     1.9 -	if [ "$free" -lt 524288 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then
    1.10 -		_ 'Disabling -pipe compile flag: %d RAM free' "$free"
    1.11 +	# Disable -pipe if less than 512 MB free RAM.
    1.12 +	free=$(awk '/^MemFree|^Buffers|^Cached/{s+=$2}END{print int(s/1024)}' /proc/meminfo)
    1.13 +	if [ "$free" -lt 512 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then
    1.14 +		_ 'Disabling -pipe compile flag: %d MB RAM free' "$free"
    1.15  		CFLAGS="${CFLAGS/-pipe}"; CFLAGS=$(echo "$CFLAGS" | tr -s ' ')
    1.16  		CXXFLAGS="${CXXFLAGS/-pipe}"; CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ')
    1.17  	fi