Allow UPX compression for DOS/Win executables

Hi. This change allows makepkg to UPX-compress executables on Windows, but will probably affect some Linux packages as well (I'm guessing gdbserver, wine, mingw-w64).

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
David Macek 2015-03-01 21:43:40 +01:00 committed by Allan McRae
parent 965539adbf
commit ff8de12151
1 changed files with 5 additions and 3 deletions

View File

@ -35,10 +35,12 @@ tidy_upx() {
msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
local binary
find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do
if [[ $(file --brief --mime-type "$binary") = 'application/x-executable' ]]; then
upx "${UPXFLAGS[@]}" "$binary" &>/dev/null ||
case "$(file --brief --mime-type "$binary")" in
'application/x-executable' | 'application/x-dosexec')
upx "${UPXFLAGS[@]}" "$binary" &>/dev/null ||
warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"
fi
;;
esac
done
fi
}