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

23 lines
558 B
Bash
Raw Normal View History

2023-09-26 00:35:21 +02:00
#!/bin/bash
if [ -z "$1" ]
then
find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy -v --only-keep-debug '{}' '{}'.debug \;
find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy -v --add-gnu-debuglink='{}'.debug '{}' --strip-unneeded \;
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