aboutsummaryrefslogtreecommitdiff
path: root/scripts/single.sh
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-02-07 17:20:23 -0600
committerRob Landley <rob@landley.net>2015-02-07 17:20:23 -0600
commit912b2be5e53f2656727beb3158c8d97ad6b1f6f2 (patch)
tree93479fe267f34c0c5ccb97a2ddf43ab1dd1a2494 /scripts/single.sh
parent5eb4475bab76e81fd0119332d761b185a35944a5 (diff)
downloadtoybox-912b2be5e53f2656727beb3158c8d97ad6b1f6f2.tar.gz
Build standalone commands where "depends on" config entries need to be switched on.
Diffstat (limited to 'scripts/single.sh')
-rwxr-xr-xscripts/single.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/single.sh b/scripts/single.sh
index c6416a35..ce8695c0 100755
--- a/scripts/single.sh
+++ b/scripts/single.sh
@@ -10,18 +10,24 @@ fi
for i in "$@"
do
+
+ TOYFILE="$(egrep -l "TOY[(]($i)[ ,]" toys/*/*.c)"
+
+ if [ -z "$TOYFILE" ]
+ then
+ echo "Unknown command '$i'" >&2
+ exit 1
+ fi
+
+ DEPENDS="$(sed -n 's/^[ \t]*depends on //;T;s/[!][A-Z0-9_]*//g;s/ *&& */|/g;p' $TOYFILE | xargs | tr ' ' '|')"
+
NAME=$(echo $i | tr a-z- A-Z_)
export KCONFIG_CONFIG=.singleconfig
- USET="is not set"
make allnoconfig > /dev/null &&
- sed -i -e "s/\(CONFIG_TOYBOX\)=y/# \1 $USET/" \
- -e "s/# \(CONFIG_$NAME\) $USET/\1=y/" \
- -e "s/# \(CONFIG_${NAME}_.*\) $USET/\1=y/" \
- -e "s/# \(CONFIG_TOYBOX_HELP.*\) $USET/\1=y/" \
- -e "s/# \(CONFIG_TOYBOX_I18N\) $USET/\1=y/" \
- -e "s/# \(CONFIG_TOYBOX_FLOAT\) $USET/\1=y/" \
- "$KCONFIG_CONFIG" &&
+ sed -ri -e "s/CONFIG_TOYBOX=y/# CONFIG_TOYBOX is not set/;t" \
+ -e "s/# (CONFIG_(TOYBOX(|_HELP|_I18N|_FLOAT)|$NAME|${NAME}_.*${DEPENDS:+|$DEPENDS})) is not set/\1=y/" \
+ "$KCONFIG_CONFIG" &&
make &&
mv toybox $PREFIX$i || exit 1
done