3 # Build a standalone toybox command
7 echo "usage: single.sh command..." >&2
11 # Harvest TOYBOX_* symbols from .config
14 echo "Need .config for toybox global settings. Run defconfig/menuconfig." >&2
18 export KCONFIG_CONFIG=.singleconfig
22 TOYFILE="$(egrep -l "TOY[(]($i)[ ,]" toys/*/*.c)"
26 echo "Unknown command '$i'" >&2
30 # Enable stuff this command depends on
31 DEPENDS="$(sed -n "/^config *$i"'$/,/^$/{s/^[ \t]*depends on //;T;s/[!][A-Z0-9_]*//g;s/ *&& */|/g;p}' $TOYFILE | xargs | tr ' ' '|')"
33 NAME=$(echo $i | tr a-z- A-Z_)
34 make allnoconfig > /dev/null &&
35 sed -ri -e '/CONFIG_TOYBOX/d' \
36 -e "s/# (CONFIG_($NAME|${NAME}_.*${DEPENDS:+|$DEPENDS})) is not set/\1=y/" \
38 echo "# CONFIG_TOYBOX is not set" >> "$KCONFIG_CONFIG" &&
39 grep "CONFIG_TOYBOX_" .config >> "$KCONFIG_CONFIG" &&
42 OUTNAME="$PREFIX$i" scripts/make.sh || exit 1