summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2013-10-31 14:24:26 +0100
committerAllan McRae <allan@archlinux.org>2013-11-08 00:28:02 +0100
commitfe824f87b9f1e40d88bd1a190a0bc1c80f2e91eb (patch)
tree8c6675e67984c362833847b65be3497cab15c0bb
parent5c5b28833c0c47d31c58d40cd13b69227de6eb48 (diff)
downloadpacman-fe824f87b9f1e40d88bd1a190a0bc1c80f2e91eb.tar.gz
pacman-fe824f87b9f1e40d88bd1a190a0bc1c80f2e91eb.tar.xz
makepkg: only remove static libraries if they have a shared version
It is fairly common that packages contain static libraries with no shared counterpart. These should not be removed with !staticlibs. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--doc/PKGBUILD.5.txt2
-rw-r--r--doc/makepkg.conf.5.txt2
-rw-r--r--scripts/makepkg.sh.in7
3 files changed, 8 insertions, 3 deletions
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index 4ac7dc11..6c5ef842 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -250,7 +250,7 @@ A normal sync or upgrade will not use its value.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
- remove them.
+ remove them (if they have a shared counterpart).
*emptydirs*;;
Leave empty directories in packages.
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index be5b809a..ef64d17c 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -162,7 +162,7 @@ Options
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
- remove them.
+ remove them (if they have a shared counterpart).
*emptydirs*;;
Leave empty directories in packages.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b2cc8e27..e01e7ab3 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1584,7 +1584,12 @@ tidy_install() {
if check_option "staticlibs" "n"; then
msg2 "$(gettext "Removing static library files...")"
- find . ! -type d -name "*.a" -exec rm -f -- '{}' +
+ local l
+ while read -rd '' l; do
+ if [[ -f "${l%.a}.so" ]]; then
+ rm "$l"
+ fi
+ done < <(find . ! -type d -name "*.a" -print0)
fi
if check_option "emptydirs" "n"; then