halflife25-sdk/linux/gendbg.sh
shawns-valve 536998dfb5 Updated Linux makefiles
- Remove USE_STEAM_RUNTIME checks -- assume we're running in the Steam Runtime "scout" environment
- Remove VALVE_NO_AUTO_P4 checks -- assume we're not in a Perforce depot
- Add check for CREATE_OUTPUT_DIRS environment variable, which will automatically create the output directory structure
- Remove validator.o from the Half-Life client Makefile, as the corresponding source file is no longer present in the SDK
2024-08-29 22:09:09 -07:00

60 lines
945 B
Bash
Executable file

#!/bin/bash
p4_edit () {
chmod -R +w "$@" || true
}
p4_revert () {
true
}
UNAME=$(uname)
if [ "$UNAME" == "Darwin" ]; then
p4_edit "$1.dSYM/..."
dsymutil "$1"
p4 revert -a "$1.dSYM/..."
exit 0;
fi
OBJCOPY=objcopy
function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
echo ""
}
if [ $# == 0 ]; then
usage
exit 2
fi
if [ $(basename "$1") == "$1" ]; then
INFILEDIR=$PWD
else
INFILEDIR=$(cd "${1%/*}" && echo "$PWD")
fi
INFILE=$(basename "$1")
OUTFILEDIR=$INFILEDIR
OUTFILE=$INFILE.dbg
while getopts "o:" opt; do
case $opt in
o)
OUTFILEDIR=$(cd "${OPTARG%/*}" && echo "$PWD")
OUTFILE=$(basename "$OPTARG")
;;
esac
done
if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
INFILE=${INFILEDIR}/${INFILE}
OUTFILE=${OUTFILEDIR}/${OUTFILE}
fi
pushd "$INFILEDIR" || exit
p4_edit "$OUTFILE"
$OBJCOPY "$INFILE" "$OUTFILE"
$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
p4_revert -a "$OUTFILE"
popd || exit