diff options
author | Allan McRae <allan@archlinux.org> | 2011-06-14 22:01:05 +1000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-22 10:45:18 -0500 |
commit | b803a33a8fc2ef86ba2d986c36f31524532d454b (patch) | |
tree | 6a5e5a8a88be9ab10535a352d09a19647baf037c /scripts | |
parent | b8990993271b34d309ada49197090895b0fbdfb6 (diff) |
makepkg: Add UPX compression support
This patch enables the automatic compression of executable binaries
using UPX when the 'upx' options is specified in makepkg.conf or the
PKGBUILD. Additional arguments can be passed to UPX by specifying
the UPXFLAGS variable.
Original-patch-by: Bryce Gibson <bryce@gibson-consulting.com.au>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/makepkg.sh.in | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 78cd4cfc..b0247bdf 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,7 +44,7 @@ startdir="$PWD" srcdir="$startdir/src" pkgdir="$startdir/pkg" -packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge') +packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \ 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \ @@ -940,6 +940,17 @@ tidy_install() { msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -empty -delete fi + + if [[ $(check_option upx) = "y" ]]; then + msg2 "$(gettext "Compressing binaries with %s...")" "UPX" + local binary + find . -type f -perm -u+w 2>/dev/null | while read binary ; do + if [[ $(file -bi "$binary") = *'application/x-executable'* ]]; then + upx $UPXFLAGS "$binary" &>/dev/null || + warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}" + fi + done + fi } find_libdepends() { |