docs/cookbook/c/allconfig.do: avoid need for '&' backgrounding.

Instead of running a bunch of separate rc_include statements in the
background, which causes unpredictable ordering of log output and
prevents -j from controlling parallelism, let's do a single
redo-ifchange for all of them (the slow part) followed by sequentially
checking the results (the fast part).
This commit is contained in:
Avery Pennarun 2019-02-25 13:44:28 +00:00
commit e036e2522d

View file

@ -8,24 +8,35 @@ config() {
( (
cd "$dir" && cd "$dir" &&
../configure --host="$arch" "$@" && ../configure --host="$arch" "$@" &&
( set --;
. ./redoconf.rc &&
rc_include rc/CC.rc &&
[ -n "$HAVE_CC" ]
) &&
echo "$dir" echo "$dir"
) || (echo "Skipping arch '$arch' $*" >&2) )
} }
dirs=$(
for d in $(cat arches); do for d in $(cat arches); do
if [ "$d" = "native" ]; then if [ "$d" = "native" ]; then
arch="" arch=""
else else
arch="$d" arch="$d"
fi fi
config "out.$d" "$arch" & config "out.$d" "$arch"
config "out.$d.static" "$arch" "--enable-static" & config "out.$d.static" "$arch" "--enable-static"
config "out.$d.opt" "$arch" "--enable-optimization" & config "out.$d.opt" "$arch" "--enable-optimization"
done
)
for dir in $dirs; do
echo "$dir/rc/CC.rc"
done | xargs redo-ifchange
for dir in $dirs; do
( cd "$dir" &&
set --;
. ./redoconf.rc &&
rc_include rc/CC.rc &&
[ -n "$HAVE_CC" ] &&
echo "$dir"
) || (echo "Skipping $dir' - no working C compiler." >&2)
done >$3 done >$3
wait wait