1 |
--- |
2 |
eclass/autotools-utils.eclass | 22 ++++++++++++++++------ |
3 |
1 files changed, 16 insertions(+), 6 deletions(-) |
4 |
|
5 |
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass |
6 |
index 48b39cb..9d7e134 100644 |
7 |
--- a/eclass/autotools-utils.eclass |
8 |
+++ b/eclass/autotools-utils.eclass |
9 |
@@ -162,18 +162,28 @@ remove_libtool_files() { |
10 |
local archivefile=${f/%.la/.a} |
11 |
[[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed' |
12 |
|
13 |
- # Remove static libs we're not supposed to link against |
14 |
+ # Remove static libs we're not supposed to link against. |
15 |
if [[ ${shouldnotlink} ]]; then |
16 |
einfo "Removing unnecessary ${archivefile#${D%/}}" |
17 |
rm -f "${archivefile}" || die |
18 |
- # We're never going to remove the .la file. |
19 |
+ # The .la file may be used by a module loader, so avoid removing it |
20 |
+ # unless explicitly requested. |
21 |
[[ ${removing_all} ]] || continue |
22 |
fi |
23 |
|
24 |
- # Keep .la files when: |
25 |
- # - they have shouldnotlink=yes - likely plugins (handled above), |
26 |
- # - respective static archive exists. |
27 |
- if [[ ${removing_all} || ! -f ${archivefile} ]]; then |
28 |
+ # Remove .la files when: |
29 |
+ # - user explicitly wants us to remove all .la files, |
30 |
+ # - respective static archive doesn't exist, |
31 |
+ # - they don't provide any new information (no libs & no flags). |
32 |
+ local removing |
33 |
+ if [[ ${removing_all} ]]; then removing=1 |
34 |
+ elif [[ ! -f ${archivefile} ]]; then removing=1 |
35 |
+ elif [[ ! $(sed -n -e \ |
36 |
+ "s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \ |
37 |
+ "${f}") ]]; then removing=1 |
38 |
+ fi |
39 |
+ |
40 |
+ if [[ ${removing} ]]; then |
41 |
einfo "Removing unnecessary ${f#${D%/}}" |
42 |
rm -f "${f}" || die |
43 |
fi |
44 |
-- |
45 |
1.7.6.1 |