view more/record-commands.sh @ 1737:1acbe7e78d9d draft

Switch from bz2 to gz tarball output. bz2 is slowly being replaced by lz variants, but gzip isn't going anywhere. (It retains a niche as a streaming protocol, it's the 80/20 solution optimizing for speed, low memory requirements, and simple compressor implementation.)
author Rob Landley <rob@landley.net>
date Fri, 20 Feb 2015 13:12:45 -0600
parents e4ff2cf4ac62
children 8fc7542bc770
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"

[ -f "$WRAPDIR/wrappy" ] && PATH="$OLDPATH"
[ -f "$HOSTTOOLS/toybox" ] && PATH="$(hosttools_path)"
NO_CLEANUP= blank_tempdir "$WRAPDIR"

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

path_search "$PATH" "*" 'ln -s wrappy "$WRAPDIR/$FILE"' | dotprogress

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