summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-08-29 13:42:42 +0000
committerMichał Górny <mgorny@gentoo.org>2012-08-29 13:42:42 +0000
commit2eb082849f51ddaf95fffffa60c0f32a9898ce30 (patch)
tree58f042e6a2da5a88b7fd5b9a8f246d04fda6430c /eclass
parentUse QA_PREBUILT. Bug #432442 (diff)
downloadgentoo-2-2eb082849f51ddaf95fffffa60c0f32a9898ce30.tar.gz
gentoo-2-2eb082849f51ddaf95fffffa60c0f32a9898ce30.tar.bz2
gentoo-2-2eb082849f51ddaf95fffffa60c0f32a9898ce30.zip
prune_libtool_files: run pkg-config code only if necessary.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/eutils.eclass54
2 files changed, 33 insertions, 26 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 9d656441a16a..4a6ac5c1d404 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.382 2012/08/28 15:28:01 mpagano Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.383 2012/08/29 13:42:42 mgorny Exp $
+
+ 29 Aug 2012; Michał Górny <mgorny@gentoo.org> eutils.eclass:
+ prune_libtool_files: run pkg-config code only if necessary.
28 Aug 2012; Michael Pagano <mpagano@gentoo.org> linux-mod.eclass:
Remove deprecated and unrecommended parameter -r from depmod
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index e7d47d61eaa3..e3dd14549b8e 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.401 2012/08/20 19:45:57 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.402 2012/08/29 13:42:42 mgorny Exp $
# @ECLASS: eutils.eclass
# @MAINTAINER:
@@ -1395,8 +1395,8 @@ usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963
# that they should not be linked to, i.e. whenever these files
# correspond to plugins.
#
-# Note: if your package installs any .pc files, this function implicitly
-# calls pkg-config. You should add it to your DEPEND in that case.
+# Note: if your package installs both static libraries and .pc files,
+# you need to add pkg-config to your DEPEND.
prune_libtool_files() {
debug-print-function ${FUNCNAME} "$@"
@@ -1411,25 +1411,6 @@ prune_libtool_files() {
esac
done
- # Create a list of all .pc-covered libs.
- local pc_libs=()
- if [[ ! ${removing_all} ]]; then
- local f
- local tf=${T}/prune-lt-files.pc
- local pkgconf=$(tc-getPKG_CONFIG)
-
- while IFS= read -r -d '' f; do # for all .pc files
- local arg
-
- sed -e '/^Requires:/d' "${f}" > "${tf}"
- for arg in $("${pkgconf}" --libs "${tf}"); do
- [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la )
- done
- done < <(find "${D}" -type f -name '*.pc' -print0)
-
- rm -f "${tf}"
- fi
-
local f
while IFS= read -r -d '' f; do # for all .la files
local archivefile=${f/%.la/.a}
@@ -1453,17 +1434,40 @@ prune_libtool_files() {
# - respective static archive doesn't exist,
# - they are covered by a .pc file already,
# - they don't provide any new information (no libs & no flags).
- local reason
+ local reason pkgconfig_scanned
if [[ ${removing_all} ]]; then
reason='requested'
elif [[ ! -f ${archivefile} ]]; then
reason='no static archive'
- elif has "${f##*/}" "${pc_libs[@]}"; then
- reason='covered by .pc'
elif [[ ! $(sed -nre \
"s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
"${f}") ]]; then
reason='no libs & flags'
+ else
+ if [[ ! ${pkgconfig_scanned} ]]; then
+ # Create a list of all .pc-covered libs.
+ local pc_libs=()
+ if [[ ! ${removing_all} ]]; then
+ local f
+ local tf=${T}/prune-lt-files.pc
+ local pkgconf=$(tc-getPKG_CONFIG)
+
+ while IFS= read -r -d '' f; do # for all .pc files
+ local arg
+
+ sed -e '/^Requires:/d' "${f}" > "${tf}"
+ for arg in $("${pkgconf}" --libs "${tf}"); do
+ [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la )
+ done
+ done < <(find "${D}" -type f -name '*.pc' -print0)
+
+ rm -f "${tf}"
+ fi
+
+ pkgconfig_scanned=1
+ fi
+
+ has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
fi
if [[ ${reason} ]]; then