1 |
--- |
2 |
gx86/eclass/eutils.eclass | 33 +++++++++++++++++++++++++-------- |
3 |
1 file changed, 25 insertions(+), 8 deletions(-) |
4 |
|
5 |
diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass |
6 |
index f662041..a8bf512 100644 |
7 |
--- a/gx86/eclass/eutils.eclass |
8 |
+++ b/gx86/eclass/eutils.eclass |
9 |
@@ -1407,8 +1407,9 @@ fi |
10 |
# that they should not be linked to, i.e. whenever these files |
11 |
# correspond to plugins. |
12 |
# |
13 |
-# Note: if your package installs both static libraries and .pc files, |
14 |
-# you need to add pkg-config to your DEPEND. |
15 |
+# Note: if your package installs both static libraries and .pc files |
16 |
+# which use variable substitution for -l flags, you need to add |
17 |
+# pkg-config to your DEPEND. |
18 |
prune_libtool_files() { |
19 |
debug-print-function ${FUNCNAME} "$@" |
20 |
|
21 |
@@ -1470,14 +1471,30 @@ prune_libtool_files() { |
22 |
if [[ ! ${removing_all} ]]; then |
23 |
local pc |
24 |
local tf=${T}/prune-lt-files.pc |
25 |
- local pkgconf=$(tc-getPKG_CONFIG) |
26 |
+ local pkgconf=$(tc-getPKG_CONFIG)1 |
27 |
|
28 |
while IFS= read -r -d '' pc; do # for all .pc files |
29 |
- local arg |
30 |
- |
31 |
- sed -e '/^Requires:/d' "${pc}" > "${tf}" |
32 |
- for arg in $("${pkgconf}" --libs "${tf}"); do |
33 |
- [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) |
34 |
+ local arg libs |
35 |
+ |
36 |
+ # Use pkg-config if available (and works), |
37 |
+ # fallback to sed. |
38 |
+ if ${pkgconf} --exists "${pc}" &>/dev/null; then |
39 |
+ sed -e '/^Requires:/d' "${pc}" > "${tf}" |
40 |
+ libs=$(${pkgconf} --libs "${tf}") |
41 |
+ else |
42 |
+ libs=$(sed -ne 's/^Libs://p' "${pc}") |
43 |
+ fi |
44 |
+ |
45 |
+ for arg in ${libs}; do |
46 |
+ if [[ ${arg} == -l* ]]; then |
47 |
+ if [[ ${arg} == '*$*' ]]; then |
48 |
+ eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}" |
49 |
+ eqawarn "(arg: ${arg})" |
50 |
+ eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND." |
51 |
+ fi |
52 |
+ |
53 |
+ pc_libs+=( lib${arg#-l}.la ) |
54 |
+ fi |
55 |
done |
56 |
done < <(find "${D}" -type f -name '*.pc' -print0) |
57 |
|
58 |
-- |
59 |
1.8.1.4 |