summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Luttringer <seblu@seblu.net>2013-03-05 02:03:43 +0100
committerAllan McRae <allan@archlinux.org>2013-03-07 15:38:48 +1000
commita03f5f55cd46cc69f01a04be2114056decc9beb6 (patch)
tree0a02f7d27a21bc0b18a8b120fd6101e7b8503db8
parent017184fab55b22c1efd8a7d6d6d832ca302d8e15 (diff)
downloadpacman-a03f5f55cd46cc69f01a04be2114056decc9beb6.tar.xz
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>
-rw-r--r--doc/PKGBUILD.5.txt4
-rw-r--r--doc/makepkg.conf.5.txt6
-rw-r--r--etc/makepkg.conf.in21
-rw-r--r--scripts/makepkg.sh.in9
4 files changed, 27 insertions, 13 deletions
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index c37477ac..ea280a0e 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -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.
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index 71cfc5d8..0d1cf00c 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -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.
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 1436042a..b2bf8114 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -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
-#
-OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug)
+#-- 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 staticlibs emptydirs zipman purge !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index bd29d737..9b89c639 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -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