Denys Vlasenko | 483405a | 2017-07-18 20:17:51 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # The list of all applet config symbols |
| 3 | test -f include/applets.h || { echo "No include/applets.h file"; exit 1; } |
| 4 | apps="` |
| 5 | grep ^IF_ include/applets.h \ |
| 6 | | grep -v ^IF_FEATURE_ \ |
| 7 | | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \ |
| 8 | | sort | uniq |
| 9 | `" |
| 10 | |
| 11 | # Take existing config |
| 12 | test -f .config || { echo "No .config file"; exit 1; } |
| 13 | cfg="`cat .config`" |
| 14 | |
| 15 | # Make a config with all applet symbols off |
| 16 | allno="$cfg" |
| 17 | for app in $apps; do |
| 18 | allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`" |
| 19 | done |
| 20 | #echo "$allno" >.config_allno |
| 21 | |
| 22 | test $# = 0 && set -- $apps |
| 23 | |
| 24 | mintext=999999999 |
| 25 | for app; do |
| 26 | b="busybox_${app}" |
| 27 | test -f "$b" || continue |
| 28 | text=`size "$b" | tail -1 | sed -e's/\t/ /g' -e's/^ *//' -e's/ .*//'` |
| 29 | #echo "text from $app: $text" |
| 30 | test x"${text//[0123456789]/}" = x"" || { |
| 31 | echo "Can't get: size $b" |
| 32 | exit 1 |
| 33 | } |
| 34 | test $mintext -gt $text && { |
| 35 | mintext=$text |
| 36 | echo "New mintext from $app: $mintext" |
| 37 | } |
| 38 | eval "text_${app}=$text" |
| 39 | done |
| 40 | |
| 41 | for app; do |
| 42 | b="busybox_${app}" |
| 43 | test -f "$b" || continue |
| 44 | eval "text=\$text_${app}" |
| 45 | echo "$app adds $((text-mintext))" |
| 46 | done |