aboutsummaryrefslogtreecommitdiff
path: root/size_single_applets.sh
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-18 22:01:24 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-18 22:01:24 +0200
commit4eed2c6c5092ed95b8ee6d994106c54a9fc6ed3e (patch)
tree133b5d5ad9f27d12a913057540d1e877c4bb1436 /size_single_applets.sh
parent483405a9b0df6ea14344b1144959be1debef925e (diff)
downloadbusybox-w32-4eed2c6c5092ed95b8ee6d994106c54a9fc6ed3e.tar.gz
busybox-w32-4eed2c6c5092ed95b8ee6d994106c54a9fc6ed3e.tar.bz2
busybox-w32-4eed2c6c5092ed95b8ee6d994106c54a9fc6ed3e.zip
Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'size_single_applets.sh')
-rwxr-xr-xsize_single_applets.sh52
1 files changed, 41 insertions, 11 deletions
diff --git a/size_single_applets.sh b/size_single_applets.sh
index d59ab045b..0fa56e09e 100755
--- a/size_single_applets.sh
+++ b/size_single_applets.sh
@@ -8,17 +8,6 @@ grep ^IF_ include/applets.h \
8| sort | uniq 8| sort | uniq
9`" 9`"
10 10
11# Take existing config
12test -f .config || { echo "No .config file"; exit 1; }
13cfg="`cat .config`"
14
15# Make a config with all applet symbols off
16allno="$cfg"
17for app in $apps; do
18 allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
19done
20#echo "$allno" >.config_allno
21
22test $# = 0 && set -- $apps 11test $# = 0 && set -- $apps
23 12
24mintext=999999999 13mintext=999999999
@@ -44,3 +33,44 @@ for app; do
44 eval "text=\$text_${app}" 33 eval "text=\$text_${app}"
45 echo "$app adds $((text-mintext))" 34 echo "$app adds $((text-mintext))"
46done 35done
36
37grep ^IF_ include/applets.h \
38| grep -v ^IF_FEATURE_ \
39| sed 's/, .*//' \
40| sed 's/\t//g' \
41| sed 's/ //g' \
42| sed 's/(APPLET(/(/' \
43| sed 's/(APPLET_[A-Z]*(/(/' \
44| sed 's/(IF_[A-Z_]*(/(/' \
45| sed 's/IF_\([A-Z0-9._-]*\)(\(.*\)/\1 \2/' \
46| sort | uniq \
47| while read app name; do
48 b="busybox_${app}"
49 test -f "$b" || continue
50
51 file=`grep -lF "bool \"$name" $(find -name '*.c') | xargs`
52 # so far all such items are in .c files; if need to check Config.* files:
53 #test "$file" || file=`grep -lF "bool \"$name" $(find -name 'Config.*') | xargs`
54 test "$file" || continue
55 #echo "FILE:'$file'"
56
57 eval "text=\$text_${app}"
58 sz=$((text-mintext))
59 sz_kb=$((sz/1000))
60 sz_frac=$(( (sz - sz_kb*1000) ))
61 sz_f=$((sz_frac / 100))
62
63 echo -n "sed 's/bool \"$name *(*[0-9tinykbytes .]*)*\"/"
64 if test "$sz_kb" -ge 10; then
65 echo -n "bool \"$name (${sz_kb} kb)\""
66 elif test "$sz_kb" -gt 0 -a "$sz_f" = 0; then
67 echo -n "bool \"$name (${sz_kb} kb)\""
68 elif test "$sz_kb" -gt 0; then
69 echo -n "bool \"$name ($sz_kb.${sz_f} kb)\""
70 elif test "$sz" -ge 200; then
71 echo -n "bool \"$name ($sz bytes)\""
72 else
73 echo -n "bool \"$name (tiny)\""
74 fi
75 echo "/' -i $file"
76done