summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2011-09-16 15:38:26 +0000
committerMichał Górny <mgorny@gentoo.org>2011-09-16 15:38:26 +0000
commit5f631561fadfc7d68275c5a940142e63b0c84889 (patch)
tree1d133e0e4d9f6d22a2a625e8e4ec2397518e00c9 /eclass
parentRefactor remove_libtool_files() to simplify conditions. (diff)
downloadhistorical-5f631561fadfc7d68275c5a940142e63b0c84889.tar.gz
historical-5f631561fadfc7d68275c5a940142e63b0c84889.tar.bz2
historical-5f631561fadfc7d68275c5a940142e63b0c84889.zip
Drop 'empty' .la files as well (those lacking libs & flags).
Diffstat (limited to 'eclass')
-rw-r--r--eclass/autotools-utils.eclass24
1 files changed, 17 insertions, 7 deletions
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index b8ab2ea9d3bb..682dc77f0bd5 100644
--- a/eclass/autotools-utils.eclass
+++ b/eclass/autotools-utils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.17 2011/09/16 15:38:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.18 2011/09/16 15:38:26 mgorny Exp $
# @ECLASS: autotools-utils.eclass
# @MAINTAINER:
@@ -162,18 +162,28 @@ remove_libtool_files() {
local archivefile=${f/%.la/.a}
[[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed'
- # Remove static libs we're not supposed to link against
+ # Remove static libs we're not supposed to link against.
if [[ ${shouldnotlink} ]]; then
einfo "Removing unnecessary ${archivefile#${D%/}}"
rm -f "${archivefile}" || die
- # We're never going to remove the .la file.
+ # The .la file may be used by a module loader, so avoid removing it
+ # unless explicitly requested.
[[ ${removing_all} ]] || continue
fi
- # Keep .la files when:
- # - they have shouldnotlink=yes - likely plugins (handled above),
- # - respective static archive exists.
- if [[ ${removing_all} || ! -f ${archivefile} ]]; then
+ # Remove .la files when:
+ # - user explicitly wants us to remove all .la files,
+ # - respective static archive doesn't exist,
+ # - they don't provide any new information (no libs & no flags).
+ local removing
+ if [[ ${removing_all} ]]; then removing=1
+ elif [[ ! -f ${archivefile} ]]; then removing=1
+ elif [[ ! $(sed -n -e \
+ "s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \
+ "${f}") ]]; then removing=1
+ fi
+
+ if [[ ${removing} ]]; then
einfo "Removing unnecessary ${f#${D%/}}"
rm -f "${f}" || die
fi