Mercurial > hg > toybox
changeset 1470:4f25d3a3eda9 draft
Create a generated/build.sh with a single compiler command line to rebuild the toybox_unstripped binary using the existing generated/*.h files.
This way we can snapshot the generated/*.{h,sh} from a defconfig build into
a "shipped" directory or something, and then people can maybe build on crazy
crippled environments like pcbsd that haven't got gmake and put bash under
/usr/local so none of the #!/scripts can find it. This solves at least
part of the "toybox can build with itself but you need to build toybox first
to have the tools to run the build scripts" problem.
Next up: work out the minimal config to provide the build tools needed
to run an actual build. (This should, eventually, include a "make" command
if freebsd's kernel is going to refuse to build with netbsd's "make" and
we don't just write off the whole thing as crazy. But it probably shouldn't
include commands that #include <linux/*.h> if we are trying to make that work.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 11 Sep 2014 20:50:10 -0500 |
parents | 558b990afadc |
children | b748127e092e |
files | Makefile scripts/make.sh |
diffstat | 2 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Thu Sep 11 00:04:37 2014 -0500 +++ b/Makefile Thu Sep 11 20:50:10 2014 -0500 @@ -41,7 +41,7 @@ scripts/install.sh --long --uninstall clean:: - rm -rf toybox toybox_unstripped testdir \ + rm -rf toybox toybox_unstripped testdir generated/build.sh \ .singleconfig .singleconfig.old generated/obj \ generated/Config.* generated/*.h generated/*.dat \ generated/instlist generated/mkflags generated/config2help
--- a/scripts/make.sh Thu Sep 11 00:04:37 2014 -0500 +++ b/scripts/make.sh Thu Sep 11 20:50:10 2014 -0500 @@ -166,12 +166,25 @@ "$@" } -BUILD="${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE" -FILES="$(ls lib/*.c) main.c $TOYFILES" -LINK="$LDOPTIMIZE -o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat)" +BUILD="$(echo ${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE)" +FILES="$(echo lib/*.c main.c $TOYFILES)" +LINK="$(echo $LDOPTIMIZE -o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat))" # This is a parallel version of: do_loudly $BUILD $FILES $LINK || exit 1 +# Write a canned build line for use on crippled build machines. +( + echo "#!/bin/sh" + echo + echo "BUILD=\"$BUILD\"" + echo + echo "LINK=\"$LINK\"" + echo + echo "FILES=\"$FILES\"" + echo + echo '$BUILD $FILES $LINK' +) > generated/build.sh && chmod +x generated/build.sh || echo 1 + rm -rf generated/obj && mkdir -p generated/obj || exit 1 PENDING= for i in $FILES