Mercurial > hg > toybox
view scripts/single.sh @ 1724:81d8a7b20ce9 draft
sed depends on -r to be rightmost flag to simplify the REG_EXTENDED test.
(If a flag is 1, you can multiply it by the value you want and get that value
else zero without a branch or conditional assignment.) So move -E one to the
left so FLAG_r is 1 again, and add a [+Er] suffix instead of testing
FLAG_r | FLAG_E in the users.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 06 Mar 2015 16:50:54 -0600 |
parents | f18d0a08b471 |
children |
line wrap: on
line source
#!/bin/bash # Build a standalone toybox command if [ -z "$1" ] then echo "usage: single.sh command..." >&2 exit 1 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 make allnoconfig > /dev/null && 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