summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2011-09-16 15:38:40 +0000
committerMichał Górny <mgorny@gentoo.org>2011-09-16 15:38:40 +0000
commitabb7728d67c22976c15faad3524e4887aebfd31b (patch)
treec9496d6ad0f031dab685d4d061ddb4aa372ed2aa /eclass/autotools-utils.eclass
parentDrop 'empty' .la files as well (those lacking libs & flags). (diff)
downloadhistorical-abb7728d67c22976c15faad3524e4887aebfd31b.tar.gz
historical-abb7728d67c22976c15faad3524e4887aebfd31b.tar.bz2
historical-abb7728d67c22976c15faad3524e4887aebfd31b.zip
Remove static libs covered by .pc files as well.
Diffstat (limited to 'eclass/autotools-utils.eclass')
-rw-r--r--eclass/autotools-utils.eclass13
1 files changed, 12 insertions, 1 deletions
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index 682dc77f0bd5..5dc26f3495b4 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.18 2011/09/16 15:38:26 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.19 2011/09/16 15:38:40 mgorny Exp $
# @ECLASS: autotools-utils.eclass
# @MAINTAINER:
@@ -156,6 +156,15 @@ remove_libtool_files() {
esac
fi
+ local pc_libs=()
+ if [[ ! ${removing_all} ]]; then
+ local arg
+ for arg in $(find "${D}" -name '*.pc' -exec \
+ sed -n -e 's;^Libs:;;p' {} +); do
+ [[ ${arg} == -l* ]] && pc_libs+=(lib${arg#-l}.la)
+ done
+ fi
+
local f
find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do
local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
@@ -174,10 +183,12 @@ remove_libtool_files() {
# Remove .la files when:
# - user explicitly wants us to remove all .la files,
# - respective static archive doesn't exist,
+ # - they are covered by a .pc file already,
# - 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 has "$(basename "${f}")" "${pc_libs[@]}"; then removing=1
elif [[ ! $(sed -n -e \
"s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \
"${f}") ]]; then removing=1