Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: reavertm@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH autotools-utils 8/9] Remove static libs covered by .pc files as well.
Date: Tue, 13 Sep 2011 14:12:35
Message-Id: 1315923033-23397-8-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH autotools-utils 1/9] Fix handling whitespace in filenames when looking for .la files. by "Michał Górny"
1 ---
2 eclass/autotools-utils.eclass | 11 +++++++++++
3 1 files changed, 11 insertions(+), 0 deletions(-)
4
5 diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
6 index 9d7e134..2e01dcc 100644
7 --- a/eclass/autotools-utils.eclass
8 +++ b/eclass/autotools-utils.eclass
9 @@ -156,6 +156,15 @@ remove_libtool_files() {
10 esac
11 fi
12
13 + local pc_libs=()
14 + if [[ ! ${removing_all} ]]; then
15 + local arg
16 + for arg in $(find "${D}" -name '*.pc' -exec \
17 + sed -n -e 's;^Libs:;;p' {} +); do
18 + [[ ${arg} == -l* ]] && pc_libs+=(lib${arg#-l}.la)
19 + done
20 + fi
21 +
22 local f
23 find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do
24 local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
25 @@ -174,10 +183,12 @@ remove_libtool_files() {
26 # Remove .la files when:
27 # - user explicitly wants us to remove all .la files,
28 # - respective static archive doesn't exist,
29 + # - they are covered by a .pc file already,
30 # - they don't provide any new information (no libs & no flags).
31 local removing
32 if [[ ${removing_all} ]]; then removing=1
33 elif [[ ! -f ${archivefile} ]]; then removing=1
34 + elif has "$(basename "${f}")" "${pc_libs[@]}"; then removing=1
35 elif [[ ! $(sed -n -e \
36 "s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \
37 "${f}") ]]; then removing=1
38 --
39 1.7.6.1