PIKApp/build/windows/gitlab-ci/split-debug-msys2.sh

30 lines
776 B
Bash
Raw Normal View History

2023-09-26 00:35:21 +02:00
#!/bin/bash
2023-10-30 23:55:30 +01:00
if [[ "$MSYSTEM" == "CLANGARM64" ]]; then
# Apparently -v is unknown argument for clangarm64 version of objcopy.exe.
export OBJCOPY_OPTIONS=""
else
export OBJCOPY_OPTIONS="-v"
fi
2023-09-26 00:35:21 +02:00
if [ -z "$1" ]
then
2023-10-30 23:55:30 +01:00
find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy ${OBJCOPY_OPTIONS} --only-keep-debug '{}' '{}'.debug \;
find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy ${OBJCOPY_OPTIONS} --add-gnu-debuglink='{}'.debug '{}' --strip-unneeded \;
2023-09-26 00:35:21 +02:00
find . -iname '*.debug' -exec "$0" {} +
else
while [ -n "$1" ]
do
FP="$1"
NAME="${FP##*/}"
DIR="${FP%/*}"
echo "$FP -> $DIR/.debug"
if [ ! -d "$DIR/.debug" ]
then
mkdir "$DIR/.debug"
fi
mv "$FP" "$DIR/.debug"
shift
done
fi