diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-23 13:39:22 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-23 13:39:22 +0100 |
commit | 10c01a711f9659f4cb16400ce155d07622d4d3bb (patch) | |
tree | 73645d128d8e4f048e4b0ab541fadef8f7c74828 /make_single_applets.sh | |
parent | 9cc3d3ab21eb8b4766b71dffb04132184c754f7b (diff) | |
download | busybox-w32-10c01a711f9659f4cb16400ce155d07622d4d3bb.tar.gz busybox-w32-10c01a711f9659f4cb16400ce155d07622d4d3bb.tar.bz2 busybox-w32-10c01a711f9659f4cb16400ce155d07622d4d3bb.zip |
make_single_applets.sh: a tool to check single-applet builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'make_single_applets.sh')
-rwxr-xr-x | make_single_applets.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/make_single_applets.sh b/make_single_applets.sh new file mode 100755 index 000000000..5b9393e33 --- /dev/null +++ b/make_single_applets.sh | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/bin/sh | ||
2 | # This script expects that the tree was built with the desired .config: | ||
3 | # in particular, it expects that include/applets.h is generated already. | ||
4 | # | ||
5 | # The script will try to rebuild each enabled applet in isolation. | ||
6 | # All other options which chose general bbox config, applet features, etc, | ||
7 | # are not modified for the builds. | ||
8 | |||
9 | makeopts="-j9" | ||
10 | |||
11 | # The list of all applet config symbols | ||
12 | test -f include/applets.h || { echo "No include/applets.h file"; exit 1; } | ||
13 | apps="` | ||
14 | grep ^IF_ include/applets.h \ | ||
15 | | grep -v ^IF_FEATURE_ \ | ||
16 | | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \ | ||
17 | | grep -v ^MODPROBE_SMALL \ | ||
18 | | sort | uniq | ||
19 | `" | ||
20 | |||
21 | # Take existing config | ||
22 | test -f .config || { echo "No .config file"; exit 1; } | ||
23 | cfg="`cat .config`" | ||
24 | |||
25 | # Make a config with all applet symbols off | ||
26 | allno="$cfg" | ||
27 | for app in $apps; do | ||
28 | allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`" | ||
29 | done | ||
30 | |||
31 | # Turn on each applet individually and build single-applet executable | ||
32 | fail=0 | ||
33 | for app in $apps; do | ||
34 | # Only if it was indeed originally enabled... | ||
35 | { echo "$cfg" | grep -q "^CONFIG_${app}=y\$"; } || continue | ||
36 | |||
37 | echo "Making ${app}..." | ||
38 | mv .config .config.SV | ||
39 | echo "CONFIG_${app}=y" >.config | ||
40 | echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config | ||
41 | if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then | ||
42 | : $((fail++)) | ||
43 | echo "Config error for ${app}" | ||
44 | mv .config busybox_config_${app} | ||
45 | elif ! make $makeopts >busybox_make_${app}.log 2>&1; then | ||
46 | : $((fail++)) | ||
47 | echo "Build error for ${app}" | ||
48 | mv .config busybox_config_${app} | ||
49 | else | ||
50 | mv busybox busybox_${app} | ||
51 | rm busybox_make_${app}.log | ||
52 | fi | ||
53 | mv .config.SV .config | ||
54 | #exit | ||
55 | done | ||
56 | echo "Failures: $fail" | ||
57 | test $fail = 0 # set exitcode | ||