Add staticlibs option in PKGBUILD

This option helps to removes static library files in packages.

Related to the thread:
https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.html

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Sébastien Luttringer 2013-03-05 02:03:43 +01:00 committed by Allan McRae
parent 017184fab5
commit a03f5f55cd
4 changed files with 26 additions and 12 deletions

View File

@ -243,6 +243,10 @@ A normal sync or upgrade will not use its value.
Leave libtool (.la) files in packages. Specify `!libtool` to
remove them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them.
*emptydirs*;;
Leave empty directories in packages.

View File

@ -138,7 +138,7 @@ Options
Specify a key to use for gpg signing instead of the default key in the
keyring. Can be overridden with makepkg's '\--key' option.
**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**::
**OPTIONS=(**strip docs libtool staticlibs emptydirs zipman purge !upx**)**::
This array contains options that affect the default packaging. They 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
@ -160,6 +160,10 @@ Options
Leave libtool (.la) files in packages. Specify `!libtool` to remove
them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them.
*emptydirs*;;
Leave empty directories in packages.

View File

@ -68,16 +68,17 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- upx: Compress binary executable files using UPX
#-- debug: Add debugging flags as specified in DEBUG_* variables
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- upx: Compress binary executable files using UPX
#-- debug: Add debugging flags as specified in DEBUG_* variables
#
OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug)
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)

View File

@ -44,8 +44,8 @@ declare -r confdir='@sysconfdir@'
declare -r BUILDSCRIPT='@BUILDSCRIPT@'
declare -r startdir="$PWD"
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \
'debug')
packaging_options=('strip' 'docs' 'libtool' 'staticlibs' 'emptydirs' 'zipman' \
'purge' 'upx' 'debug')
other_options=('ccache' 'distcc' 'buildflags' 'makeflags')
splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \
'groups' 'depends' 'optdepends' 'provides' 'conflicts' \
@ -1503,6 +1503,11 @@ tidy_install() {
find . ! -type d -name "*.la" -exec rm -f -- '{}' \;
fi
if check_option "staticlibs" "n"; then
msg2 "$(gettext "Removing "%s" files...")" "static library"
find . ! -type d -name "*.a" -exec rm -f -- '{}' +
fi
if check_option "emptydirs" "n"; then
msg2 "$(gettext "Removing empty directories...")"
find . -depth -type d -exec rmdir '{}' + 2>/dev/null