comparison scripts/make.sh @ 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 19435f12ec63
comparison
equal deleted inserted replaced
1469:558b990afadc 1470:4f25d3a3eda9
164 { 164 {
165 [ ! -z "$V" ] && echo "$@" || echo -n . 165 [ ! -z "$V" ] && echo "$@" || echo -n .
166 "$@" 166 "$@"
167 } 167 }
168 168
169 BUILD="${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE" 169 BUILD="$(echo ${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE)"
170 FILES="$(ls lib/*.c) main.c $TOYFILES" 170 FILES="$(echo lib/*.c main.c $TOYFILES)"
171 LINK="$LDOPTIMIZE -o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat)" 171 LINK="$(echo $LDOPTIMIZE -o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat))"
172 172
173 # This is a parallel version of: do_loudly $BUILD $FILES $LINK || exit 1 173 # This is a parallel version of: do_loudly $BUILD $FILES $LINK || exit 1
174
175 # Write a canned build line for use on crippled build machines.
176 (
177 echo "#!/bin/sh"
178 echo
179 echo "BUILD=\"$BUILD\""
180 echo
181 echo "LINK=\"$LINK\""
182 echo
183 echo "FILES=\"$FILES\""
184 echo
185 echo '$BUILD $FILES $LINK'
186 ) > generated/build.sh && chmod +x generated/build.sh || echo 1
174 187
175 rm -rf generated/obj && mkdir -p generated/obj || exit 1 188 rm -rf generated/obj && mkdir -p generated/obj || exit 1
176 PENDING= 189 PENDING=
177 for i in $FILES 190 for i in $FILES
178 do 191 do