diff --git a/build/windows/gitlab-ci/3_bundle-gimp-uni_sym.sh b/build/windows/gitlab-ci/3_bundle-gimp-uni_sym.sh index d13d59fe73..a87ffd0f3a 100644 --- a/build/windows/gitlab-ci/3_bundle-gimp-uni_sym.sh +++ b/build/windows/gitlab-ci/3_bundle-gimp-uni_sym.sh @@ -13,24 +13,21 @@ fi for ARTIFACTS_SUFFIX in "${archsArray[@]}"; do binArray=($(find gimp${ARTIFACTS_SUFFIX} \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f)) for bin in "${binArray[@]}"; do - echo "(INFO): extracting DWARF symbols from $bin" - ## Split/extract DWARF symbols from binary to .debug - objcopy --only-keep-debug $bin $bin.debug - ## Link .debug to binary - objcopy --add-gnu-debuglink=$bin.debug $bin --strip-unneeded - done + debug=$(echo "${bin}.debug") + NAME="${bin##*/}" + DIR="${debug%/*}/.debug/" - ## Move .debug files to .debug folder - debugArray=($(find gimp${ARTIFACTS_SUFFIX} -iname '*.debug')) - for debug in "${debugArray[@]}"; do - DIR="${debug%/*}" - if [ ! -d "$DIR/.debug" ]; then - mkdir "$DIR/.debug" + ## Split/extract DWARF symbols from binary to .debug + echo "(INFO): extracting DWARF symbols from $NAME to $DIR" + objcopy --only-keep-debug $bin $debug + + ## Link .debug to binary + objcopy --add-gnu-debuglink=$debug $bin --strip-unneeded + + ## Move .debug files to .debug folder + if [ ! -d "$DIR" ]; then + mkdir "$DIR" fi - if [ "$DIR" != "$PREVIOUS_DIR" ]; then - echo "(INFO): moving DWARF symbols to $DIR/.debug" - fi - mv "$debug" "$DIR/.debug" - export PREVIOUS_DIR="$DIR" + mv "$debug" "$DIR" done done