aboutsummaryrefslogtreecommitdiff
path: root/make_single_applets.sh
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-03-24 11:55:30 +0000
committerRon Yorston <rmy@pobox.com>2021-03-24 12:43:15 +0000
commit355a7a6c1e9626b7afe8758a6095f3cf275c52e1 (patch)
tree6dab679c15b049cab97212e0b43077132eec1fbe /make_single_applets.sh
parent71ecc8033e6989996057b32577e71148fd544596 (diff)
parent889425812b5cda8b3394d73253cbde7355fb1115 (diff)
downloadbusybox-w32-w32_1_26_2.tar.gz
busybox-w32-w32_1_26_2.tar.bz2
busybox-w32-w32_1_26_2.zip
Merge tag '1_26_2' into w32_1_26_2w32_1_26_2
Diffstat (limited to '')
-rwxr-xr-xmake_single_applets.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/make_single_applets.sh b/make_single_applets.sh
new file mode 100755
index 000000000..00f502eda
--- /dev/null
+++ b/make_single_applets.sh
@@ -0,0 +1,73 @@
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
9makeopts="-j9"
10
11# The list of all applet config symbols
12test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
13apps="`
14grep ^IF_ include/applets.h \
15| grep -v ^IF_FEATURE_ \
16| sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
17| sort | uniq
18`"
19
20# Take existing config
21test -f .config || { echo "No .config file"; exit 1; }
22cfg="`cat .config`"
23
24# Make a config with all applet symbols off
25allno="$cfg"
26for app in $apps; do
27 allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
28done
29#echo "$allno" >.config_allno
30
31# Turn on each applet individually and build single-applet executable
32fail=0
33for 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
42 if test x"${app}" != x"SH_IS_ASH" && test x"${app}" != x"SH_IS_HUSH"; then
43 # $allno has all choices for "sh" aliasing set to off.
44 # "sh" aliasing defaults to "ash", not none.
45 # without this fix, "make oldconfig" sets it wrong,
46 # resulting in NUM_APPLETS = 2 (the second applet is "sh")
47 sed '/CONFIG_SH_IS_NONE/d' -i .config
48 echo "CONFIG_SH_IS_NONE=y" >>.config
49 fi
50
51 if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
52 : $((fail++))
53 echo "Config error for ${app}"
54 mv .config busybox_config_${app}
55 elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
56 : $((fail++))
57 echo "Build error for ${app}"
58 mv .config busybox_config_${app}
59 elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
60 mv busybox busybox_${app}
61 : $((fail++))
62 echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
63 mv .config busybox_config_${app}
64 else
65 mv busybox busybox_${app}
66 rm busybox_make_${app}.log
67 fi
68 mv .config.SV .config
69 #exit
70done
71touch .config # or else next "make" can be confused
72echo "Failures: $fail"
73test $fail = 0 # set exitcode