view sources/more/record-commands.sh @ 899:726cac165450

Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
author Rob Landley <rob@landley.net>
date Mon, 23 Nov 2009 21:58:49 -0600
parents 850da666acc6
children 5ffc758bf60a
line wrap: on
line source

#!/bin/bash

source sources/include.sh || exit 1

# Build a wrapper that records each command line the build runs out of the
# host's $PATH, so we know exactly what commands the build uses.

# (Note: this misses things called via absolute paths, such as the #!/bin/bash
# at the start of shell scripts.)

echo "=== Setting up command recording wrapper"

echo OLDPATH=$OLDPATH
echo PATH=$PATH

[ -f "$WRAPDIR/wrappy" ] && PATH="$OLDPATH"
[ -f "$HOSTTOOLS/busybox" ] && PATH="$HOSTTOOLS"
blank_tempdir "$WRAPDIR"
blank_tempdir "$BUILD/logs"

# Populate a directory of symlinks with every command in the $PATH.

wrap_path "$PATH" "$WRAPDIR" wrappy | dotprogress

# Build the wrapper
$CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy"  || dienow