aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-08-30 04:42:49 -0500
committerRob Landley <rob@landley.net>2015-08-30 04:42:49 -0500
commit6fde0f9be2c78d336b2bbcb4c1488bd171c8bccd (patch)
treef50328e23aac5f631d0e0c9fc636babcf912ccec
parent8c588d822a4771420fa32571693f728e809bb2f2 (diff)
downloadtoybox-6fde0f9be2c78d336b2bbcb4c1488bd171c8bccd.tar.gz
Build updates: make change should use top level .config for global settings,
add NOSTRIP variable to force skipping strip, and save intermediate flag data in generated/flags.raw and have mkflags.c error message point to that.
-rwxr-xr-xscripts/make.sh11
-rw-r--r--scripts/mkflags.c2
-rwxr-xr-xscripts/single.sh20
3 files changed, 23 insertions, 10 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 7ebe148d..f6e0c6d5 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -177,7 +177,7 @@ do
# If no pair (because command's disabled in config), use " " for flags
# so allflags can define the appropriate zero macros.
-done | sort -s | sed -n 's/ A / /;t pair;h;s/\([^ ]*\).*/\1 " "/;x;b single;:pair;h;n;:single;s/[^ ]* B //;H;g;s/\n/ /;p' |\
+done | sort -s | sed -n 's/ A / /;t pair;h;s/\([^ ]*\).*/\1 " "/;x;b single;:pair;h;n;:single;s/[^ ]* B //;H;g;s/\n/ /;p' | tee generated/flags.raw | \
generated/mkflags > generated/flags.h || exit 1
# Extract global structure definitions and flag definitions from toys/*/*.c
@@ -271,12 +271,13 @@ done
[ $DONE -ne 0 ] && exit 1
do_loudly $BUILD $LFILES $LINK || exit 1
-if ! do_loudly ${CROSS_COMPILE}strip toybox_unstripped -o toybox
+if [ ! -z "$NOSTRIP" ] || ! do_loudly ${CROSS_COMPILE}strip toybox_unstripped -o toybox
then
echo "strip failed, using unstripped" && cp toybox_unstripped toybox ||
exit 1
+else
+ # gcc 4.4's strip command is buggy, and doesn't set the executable bit on
+ # its output the way SUSv4 suggests it do so.
+ do_loudly chmod +x toybox || exit 1
fi
-# gcc 4.4's strip command is buggy, and doesn't set the executable bit on
-# its output the way SUSv4 suggests it do so.
-do_loudly chmod +x toybox || exit 1
echo
diff --git a/scripts/mkflags.c b/scripts/mkflags.c
index 7e57f843..b57f0577 100644
--- a/scripts/mkflags.c
+++ b/scripts/mkflags.c
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
if (!*command) break;
if (bit != 3) {
- fprintf(stderr, "\nError in %s (duplicate command?)\n", command);
+ fprintf(stderr, "\nError in %s (see generated/flags.raw)\n", command);
exit(1);
}
diff --git a/scripts/single.sh b/scripts/single.sh
index 1d075fd7..cea972a1 100755
--- a/scripts/single.sh
+++ b/scripts/single.sh
@@ -8,9 +8,16 @@ then
exit 1
fi
+# Harvest TOYBOX_* symbols from .config
+if [ ! -e .config ]
+then
+ echo "Need .config for toybox global settings. Run defconfig/menuconfig." >&2
+ exit 1
+fi
+
+export KCONFIG_CONFIG=.singleconfig
for i in "$@"
do
-
TOYFILE="$(egrep -l "TOY[(]($i)[ ,]" toys/*/*.c)"
if [ -z "$TOYFILE" ]
@@ -22,12 +29,17 @@ do
DEPENDS="$(sed -n 's/^[ \t]*depends on //;T;s/[!][A-Z0-9_]*//g;s/ *&& */|/g;p' $TOYFILE | grep -v SMACK | 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/" \
+ sed -ri -e '/CONFIG_TOYBOX/d' \
+ -e "s/# (CONFIG_($NAME|${NAME}_.*${DEPENDS:+|$DEPENDS})) is not set/\1=y/" \
"$KCONFIG_CONFIG" &&
+ echo "# CONFIG_TOYBOX is not set" >> "$KCONFIG_CONFIG" &&
+ grep "CONFIG_TOYBOX_" .config >> "$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