public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH eutils] prune_libtool_files: run pkg-config code only if necessary.
@ 2012-08-25 19:32 99% Michał Górny
  0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2012-08-25 19:32 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Right now, the .pc file parsing takes place each time
prune_libtool_files() is called, even when there are no .la files
installed. After this commit, the .pc files will be parsed only when
it is necessary, i.e. no other criteria allow removal of a particular
.la file.
---
 gx86/eclass/eutils.eclass | 48 +++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass
index 1017243..c4cf3c9 100644
--- a/gx86/eclass/eutils.eclass
+++ b/gx86/eclass/eutils.eclass
@@ -1436,25 +1436,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}
@@ -1478,17 +1459,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
-- 
1.7.12



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-08-25 19:32 99% [gentoo-dev] [PATCH eutils] prune_libtool_files: run pkg-config code only if necessary Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox