1 |
Add a --modules option to cleanly remove .la files for modules without |
2 |
triggering unwanted --all behavior. |
3 |
--- |
4 |
gx86/eclass/eutils.eclass | 29 ++++++++++++++++++++--------- |
5 |
1 file changed, 20 insertions(+), 9 deletions(-) |
6 |
|
7 |
diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass |
8 |
index 77f7b0c..062e8a1 100644 |
9 |
--- a/gx86/eclass/eutils.eclass |
10 |
+++ b/gx86/eclass/eutils.eclass |
11 |
@@ -1380,7 +1380,7 @@ if has "${EAPI:-0}" 0 1 2 3 4; then |
12 |
fi |
13 |
|
14 |
# @FUNCTION: prune_libtool_files |
15 |
-# @USAGE: [--all] |
16 |
+# @USAGE: [--all|--modules] |
17 |
# @DESCRIPTION: |
18 |
# Locate unnecessary libtool files (.la) and libtool static archives |
19 |
# (.a) and remove them from installation image. |
20 |
@@ -1389,9 +1389,13 @@ fi |
21 |
# either be performed using pkg-config or doesn't introduce additional |
22 |
# flags. |
23 |
# |
24 |
-# If '--all' argument is passed, all .la files are removed. This is |
25 |
-# usually useful when the package installs plugins and does not use .la |
26 |
-# files for loading them. |
27 |
+# If '--modules' argument is passed, .la files for modules (plugins) are |
28 |
+# removed as well. This is usually useful when the package installs |
29 |
+# plugins and the plugin loader does not use .la files. |
30 |
+# |
31 |
+# If '--all' argument is passed, all .la files are removed without |
32 |
+# performing any heuristic on them. You shouldn't ever use that, |
33 |
+# and instead report a bug in the algorithm instead. |
34 |
# |
35 |
# The .a files are only removed whenever corresponding .la files state |
36 |
# that they should not be linked to, i.e. whenever these files |
37 |
@@ -1402,11 +1406,15 @@ fi |
38 |
prune_libtool_files() { |
39 |
debug-print-function ${FUNCNAME} "$@" |
40 |
|
41 |
- local removing_all opt |
42 |
+ local removing_all removing_modules opt |
43 |
for opt; do |
44 |
case "${opt}" in |
45 |
--all) |
46 |
removing_all=1 |
47 |
+ removing_modules=1 |
48 |
+ ;; |
49 |
+ --modules) |
50 |
+ removing_modules=1 |
51 |
;; |
52 |
*) |
53 |
die "Invalid argument to ${FUNCNAME}(): ${opt}" |
54 |
@@ -1420,6 +1428,8 @@ prune_libtool_files() { |
55 |
|
56 |
[[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' |
57 |
|
58 |
+ local reason pkgconfig_scanned |
59 |
+ |
60 |
# Remove static libs we're not supposed to link against. |
61 |
if grep -q '^shouldnotlink=yes$' "${f}"; then |
62 |
if [[ -f ${archivefile} ]]; then |
63 |
@@ -1429,16 +1439,17 @@ prune_libtool_files() { |
64 |
|
65 |
# The .la file may be used by a module loader, so avoid removing it |
66 |
# unless explicitly requested. |
67 |
- [[ ${removing_all} ]] || continue |
68 |
- fi |
69 |
+ if [[ ${removing_modules} ]]; then |
70 |
+ reason='module' |
71 |
+ fi |
72 |
|
73 |
# Remove .la files when: |
74 |
# - user explicitly wants us to remove all .la files, |
75 |
# - respective static archive doesn't exist, |
76 |
# - they are covered by a .pc file already, |
77 |
# - they don't provide any new information (no libs & no flags). |
78 |
- local reason pkgconfig_scanned |
79 |
- if [[ ${removing_all} ]]; then |
80 |
+ |
81 |
+ elif [[ ${removing_all} ]]; then |
82 |
reason='requested' |
83 |
elif [[ ! -f ${archivefile} ]]; then |
84 |
reason='no static archive' |
85 |
-- |
86 |
1.7.12 |