1 |
Right now, the .pc file parsing takes place each time |
2 |
prune_libtool_files() is called, even when there are no .la files |
3 |
installed. After this commit, the .pc files will be parsed only when |
4 |
it is necessary, i.e. no other criteria allow removal of a particular |
5 |
.la file. |
6 |
--- |
7 |
gx86/eclass/eutils.eclass | 48 +++++++++++++++++++++++++---------------------- |
8 |
1 file changed, 26 insertions(+), 22 deletions(-) |
9 |
|
10 |
diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass |
11 |
index 1017243..c4cf3c9 100644 |
12 |
--- a/gx86/eclass/eutils.eclass |
13 |
+++ b/gx86/eclass/eutils.eclass |
14 |
@@ -1436,25 +1436,6 @@ prune_libtool_files() { |
15 |
esac |
16 |
done |
17 |
|
18 |
- # Create a list of all .pc-covered libs. |
19 |
- local pc_libs=() |
20 |
- if [[ ! ${removing_all} ]]; then |
21 |
- local f |
22 |
- local tf=${T}/prune-lt-files.pc |
23 |
- local pkgconf=$(tc-getPKG_CONFIG) |
24 |
- |
25 |
- while IFS= read -r -d '' f; do # for all .pc files |
26 |
- local arg |
27 |
- |
28 |
- sed -e '/^Requires:/d' "${f}" > "${tf}" |
29 |
- for arg in $("${pkgconf}" --libs "${tf}"); do |
30 |
- [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) |
31 |
- done |
32 |
- done < <(find "${D}" -type f -name '*.pc' -print0) |
33 |
- |
34 |
- rm -f "${tf}" |
35 |
- fi |
36 |
- |
37 |
local f |
38 |
while IFS= read -r -d '' f; do # for all .la files |
39 |
local archivefile=${f/%.la/.a} |
40 |
@@ -1478,17 +1459,40 @@ prune_libtool_files() { |
41 |
# - respective static archive doesn't exist, |
42 |
# - they are covered by a .pc file already, |
43 |
# - they don't provide any new information (no libs & no flags). |
44 |
- local reason |
45 |
+ local reason pkgconfig_scanned |
46 |
if [[ ${removing_all} ]]; then |
47 |
reason='requested' |
48 |
elif [[ ! -f ${archivefile} ]]; then |
49 |
reason='no static archive' |
50 |
- elif has "${f##*/}" "${pc_libs[@]}"; then |
51 |
- reason='covered by .pc' |
52 |
elif [[ ! $(sed -nre \ |
53 |
"s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \ |
54 |
"${f}") ]]; then |
55 |
reason='no libs & flags' |
56 |
+ else |
57 |
+ if [[ ! ${pkgconfig_scanned} ]]; then |
58 |
+ # Create a list of all .pc-covered libs. |
59 |
+ local pc_libs=() |
60 |
+ if [[ ! ${removing_all} ]]; then |
61 |
+ local f |
62 |
+ local tf=${T}/prune-lt-files.pc |
63 |
+ local pkgconf=$(tc-getPKG_CONFIG) |
64 |
+ |
65 |
+ while IFS= read -r -d '' f; do # for all .pc files |
66 |
+ local arg |
67 |
+ |
68 |
+ sed -e '/^Requires:/d' "${f}" > "${tf}" |
69 |
+ for arg in $("${pkgconf}" --libs "${tf}"); do |
70 |
+ [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) |
71 |
+ done |
72 |
+ done < <(find "${D}" -type f -name '*.pc' -print0) |
73 |
+ |
74 |
+ rm -f "${tf}" |
75 |
+ fi |
76 |
+ |
77 |
+ pkgconfig_scanned=1 |
78 |
+ fi |
79 |
+ |
80 |
+ has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' |
81 |
fi |
82 |
|
83 |
if [[ ${reason} ]]; then |
84 |
-- |
85 |
1.7.12 |