From: Michał Górny Date: Fri, 16 Sep 2011 15:33:19 +0000 (+0000) Subject: For .la removal, look for static archives rather than USE=static-libs. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e6a99cc827a278ef80def7de7025646efd080e41;p=gentoo.git For .la removal, look for static archives rather than USE=static-libs. --- diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass index 474da9ba5769..9b65eab2b6ea 100644 --- a/eclass/autotools-utils.eclass +++ b/eclass/autotools-utils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.13 2011/09/16 15:29:22 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.14 2011/09/16 15:33:19 mgorny Exp $ # @ECLASS: autotools-utils.eclass # @MAINTAINER: @@ -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