1 |
--- |
2 |
eclass/autotools-utils.eclass | 25 +++++++++++++------------ |
3 |
1 files changed, 13 insertions(+), 12 deletions(-) |
4 |
|
5 |
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass |
6 |
index 31d228b..ab8650f 100644 |
7 |
--- a/eclass/autotools-utils.eclass |
8 |
+++ b/eclass/autotools-utils.eclass |
9 |
@@ -132,13 +132,13 @@ _check_build_dir() { |
10 |
} |
11 |
|
12 |
# @FUNCTION: remove_libtool_files |
13 |
-# @USAGE: [all|none] |
14 |
+# @USAGE: [all] |
15 |
# @DESCRIPTION: |
16 |
# Determines unnecessary libtool files (.la) and libtool static archives (.a) |
17 |
# and removes them from installation image. |
18 |
+# |
19 |
# To unconditionally remove all libtool files, pass 'all' as argument. |
20 |
-# To leave all libtool files alone, pass 'none' as argument. |
21 |
-# Unnecessary static archives are removed in any case. |
22 |
+# Otherwise, libtool archives required for static linking will be preserved. |
23 |
# |
24 |
# In most cases it's not necessary to manually invoke this function. |
25 |
# See autotools-utils_src_install for reference. |
26 |
@@ -147,14 +147,17 @@ remove_libtool_files() { |
27 |
|
28 |
local f |
29 |
find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do |
30 |
- # Keep only .la files with shouldnotlink=yes - likely plugins |
31 |
local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
32 |
- if [[ "$1" == 'all' || -z ${shouldnotlink} ]]; then |
33 |
- if [[ "$1" != 'none' ]]; then |
34 |
- einfo "Removing unnecessary ${f#${D%/}}" |
35 |
- rm -f "${f}" |
36 |
- fi |
37 |
+ local archivefile=${f/%.la/.a} |
38 |
+ |
39 |
+ # Keep .la files when: |
40 |
+ # - they have shouldnotlink=yes - likely plugins, |
41 |
+ # - respective static archive exists. |
42 |
+ if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then |
43 |
+ einfo "Removing unnecessary ${f#${D%/}}" |
44 |
+ rm -f "${f}" |
45 |
fi |
46 |
+ |
47 |
# Remove static libs we're not supposed to link against |
48 |
if [[ -n ${shouldnotlink} ]]; then |
49 |
local remove=${f/%.la/.a} |
50 |
@@ -245,9 +248,7 @@ autotools-utils_src_install() { |
51 |
popd > /dev/null |
52 |
|
53 |
# Remove libtool files and unnecessary static libs |
54 |
- local args |
55 |
- has static-libs ${IUSE//+} && ! use static-libs || args='none' |
56 |
- remove_libtool_files ${args} |
57 |
+ remove_libtool_files |
58 |
} |
59 |
|
60 |
# @FUNCTION: autotools-utils_src_test |
61 |
-- |
62 |
1.7.6.1 |