apenwarr-redo/docs/cookbook/c/allconfig.do
Avery Pennarun e036e2522d 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).
2019-03-01 13:55:22 -05:00

42 lines
731 B
Text

redo-ifchange arches configure redoconf/utils.sh
config() {
local dir="$1" arch="$2"
shift
shift
[ -d "$dir" ] || mkdir "$dir"
(
cd "$dir" &&
../configure --host="$arch" "$@" &&
echo "$dir"
)
}
dirs=$(
for d in $(cat arches); do
if [ "$d" = "native" ]; then
arch=""
else
arch="$d"
fi
config "out.$d" "$arch"
config "out.$d.static" "$arch" "--enable-static"
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
wait