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