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 1R3Tj8-0003NH-EY for garchives@archives.gentoo.org; Tue, 13 Sep 2011 14:12:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2DE7021C0EA; Tue, 13 Sep 2011 14:11:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 29C8321C0C3 for ; Tue, 13 Sep 2011 14:08:54 +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 9A2271B4019; Tue, 13 Sep 2011 14:08:52 +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 3/9] For .la removal, look for static archives rather than USE=static-libs. Date: Tue, 13 Sep 2011 16:10:27 +0200 Message-Id: <1315923033-23397-3-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: 7f5d117e02706c10c46eb47ef6c5ed94 --- eclass/autotools-utils.eclass | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass index 31d228b..ab8650f 100644 --- a/eclass/autotools-utils.eclass +++ b/eclass/autotools-utils.eclass @@ -132,13 +132,13 @@ _check_build_dir() { } # @FUNCTION: remove_libtool_files -# @USAGE: [all|none] +# @USAGE: [all] # @DESCRIPTION: # Determines unnecessary libtool files (.la) and libtool static archives (.a) # and removes them from installation image. +# # To unconditionally remove all libtool files, pass 'all' as argument. -# To leave all libtool files alone, pass 'none' as argument. -# Unnecessary static archives are removed in any case. +# Otherwise, libtool archives required for static linking will be preserved. # # In most cases it's not necessary to manually invoke this function. # See autotools-utils_src_install for reference. @@ -147,14 +147,17 @@ remove_libtool_files() { local f find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do - # Keep only .la files with shouldnotlink=yes - likely plugins local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") - if [[ "$1" == 'all' || -z ${shouldnotlink} ]]; then - if [[ "$1" != 'none' ]]; then - einfo "Removing unnecessary ${f#${D%/}}" - rm -f "${f}" - fi + local archivefile=${f/%.la/.a} + + # Keep .la files when: + # - they have shouldnotlink=yes - likely plugins, + # - respective static archive exists. + if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then + einfo "Removing unnecessary ${f#${D%/}}" + rm -f "${f}" fi + # Remove static libs we're not supposed to link against if [[ -n ${shouldnotlink} ]]; then local remove=${f/%.la/.a} @@ -245,9 +248,7 @@ autotools-utils_src_install() { popd > /dev/null # Remove libtool files and unnecessary static libs - local args - has static-libs ${IUSE//+} && ! use static-libs || args='none' - remove_libtool_files ${args} + remove_libtool_files } # @FUNCTION: autotools-utils_src_test -- 1.7.6.1