mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -05:00
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>
This commit is contained in:
parent
b899099327
commit
b803a33a8f
@ -231,6 +231,9 @@ version. Appending the version yourself disables auto detection.
|
|||||||
*zipman*;;
|
*zipman*;;
|
||||||
Compress man and info pages with gzip.
|
Compress man and info pages with gzip.
|
||||||
|
|
||||||
|
*upx*;;
|
||||||
|
Compress binary executable files using UPX.
|
||||||
|
|
||||||
*ccache*;;
|
*ccache*;;
|
||||||
Allow the use of ccache during build. More useful in its negative
|
Allow the use of ccache during build. More useful in its negative
|
||||||
form `!ccache` with select packages that have problems building
|
form `!ccache` with select packages that have problems building
|
||||||
|
@ -114,7 +114,7 @@ Options
|
|||||||
Specify a key to use for gpg signing instead of the default key in the
|
Specify a key to use for gpg signing instead of the default key in the
|
||||||
keyring. Can be overridden with makepkg's `--key` option.
|
keyring. Can be overridden with makepkg's `--key` option.
|
||||||
|
|
||||||
**OPTIONS=(**strip !docs libtool emptydirs zipman**)**::
|
**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**::
|
||||||
This array contains options that affect the default packaging. They are
|
This array contains options that affect the default packaging. They are
|
||||||
equivalent to options that can be placed in the PKGBUILD; the defaults are
|
equivalent to options that can be placed in the PKGBUILD; the defaults are
|
||||||
shown here. All options should always be left in the array; to enable or
|
shown here. All options should always be left in the array; to enable or
|
||||||
@ -146,6 +146,10 @@ Options
|
|||||||
Remove files specified by the `PURGE_TARGETS` variable from the
|
Remove files specified by the `PURGE_TARGETS` variable from the
|
||||||
package.
|
package.
|
||||||
|
|
||||||
|
*upx*;;
|
||||||
|
Compress binary executable files using UPX. Additional options
|
||||||
|
can be passed to UPX by specifying the `UPXFLAGS` variable.
|
||||||
|
|
||||||
**INTEGRITY_CHECK=(**check1 ...**)**::
|
**INTEGRITY_CHECK=(**check1 ...**)**::
|
||||||
File integrity checks to use. Multiple checks may be specified; this
|
File integrity checks to use. Multiple checks may be specified; this
|
||||||
affects both generation and checking. The current valid options are:
|
affects both generation and checking. The current valid options are:
|
||||||
|
@ -60,7 +60,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
|
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@ -69,8 +69,9 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- emptydirs: Leave empty directories in packages
|
#-- emptydirs: Leave empty directories in packages
|
||||||
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
#-- purge: Remove files specified by PURGE_TARGETS
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
|
#-- upx: Compress binary executable files using UPX
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool emptydirs zipman purge)
|
OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
|
@ -44,7 +44,7 @@ startdir="$PWD"
|
|||||||
srcdir="$startdir/src"
|
srcdir="$startdir/src"
|
||||||
pkgdir="$startdir/pkg"
|
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')
|
other_options=('ccache' 'distcc' 'buildflags' 'makeflags')
|
||||||
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
|
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
|
||||||
'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
|
'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
|
||||||
@ -940,6 +940,17 @@ tidy_install() {
|
|||||||
msg2 "$(gettext "Removing empty directories...")"
|
msg2 "$(gettext "Removing empty directories...")"
|
||||||
find . -depth -type d -empty -delete
|
find . -depth -type d -empty -delete
|
||||||
fi
|
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() {
|
find_libdepends() {
|
||||||
|
Loading…
Reference in New Issue
Block a user