From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R3Tj1-0003Mt-7W for garchives@archives.gentoo.org; Tue, 13 Sep 2011 14:12:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0F8F921C0F2; Tue, 13 Sep 2011 14:11:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3D9F521C0D3 for ; Tue, 13 Sep 2011 14:09:02 +0000 (UTC) Received: from localhost.localdomain (77-255-22-60.adsl.inetia.pl [77.255.22.60]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id BA2451B4019; Tue, 13 Sep 2011 14:09:00 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: reavertm@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH autotools-utils 8/9] Remove static libs covered by .pc files as well. Date: Tue, 13 Sep 2011 16:10:32 +0200 Message-Id: <1315923033-23397-8-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <1315923033-23397-1-git-send-email-mgorny@gentoo.org> References: <1315857465-8179-1-git-send-email-mgorny@gentoo.org> <1315923033-23397-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: X-Archives-Hash: 84bdd69e568dac93d316433add493412 --- eclass/autotools-utils.eclass | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass index 9d7e134..2e01dcc 100644 --- a/eclass/autotools-utils.eclass +++ b/eclass/autotools-utils.eclass @@ -156,6 +156,15 @@ remove_libtool_files() { esac fi + local pc_libs=() + if [[ ! ${removing_all} ]]; then + local arg + for arg in $(find "${D}" -name '*.pc' -exec \ + sed -n -e 's;^Libs:;;p' {} +); do + [[ ${arg} == -l* ]] && pc_libs+=(lib${arg#-l}.la) + done + fi + local f find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") @@ -174,10 +183,12 @@ remove_libtool_files() { # Remove .la files when: # - user explicitly wants us to remove all .la 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 removing if [[ ${removing_all} ]]; then removing=1 elif [[ ! -f ${archivefile} ]]; then removing=1 + elif has "$(basename "${f}")" "${pc_libs[@]}"; then removing=1 elif [[ ! $(sed -n -e \ "s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \ "${f}") ]]; then removing=1 -- 1.7.6.1