From 6862a49ab5662f40924430dfeba1247509f1d2b2 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Thu, 11 Oct 2012 16:52:05 +0000 Subject: prune_libtool_files(): add --modules option to remove modules (plugins) as well. --- eclass/ChangeLog | 6 +++++- eclass/eutils.eclass | 31 +++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'eclass') diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 9b0cfdda371f..aeb2b13744e3 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.436 2012/10/11 16:50:53 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.437 2012/10/11 16:52:05 mgorny Exp $ + + 11 Oct 2012; Michał Górny eutils.eclass: + prune_libtool_files(): add --modules option to remove modules (plugins) as + well. 11 Oct 2012; Michał Górny eutils.eclass: prune_libtool_files(): fix removing symlinked .la files. diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 7cad6186cfec..451fef3a9a1b 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.407 2012/10/11 16:50:53 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.408 2012/10/11 16:52:05 mgorny Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -1380,7 +1380,7 @@ if has "${EAPI:-0}" 0 1 2 3 4; then fi # @FUNCTION: prune_libtool_files -# @USAGE: [--all] +# @USAGE: [--all|--modules] # @DESCRIPTION: # Locate unnecessary libtool files (.la) and libtool static archives # (.a) and remove them from installation image. @@ -1389,9 +1389,13 @@ fi # either be performed using pkg-config or doesn't introduce additional # flags. # -# If '--all' argument is passed, all .la files are removed. This is -# usually useful when the package installs plugins and does not use .la -# files for loading them. +# If '--modules' argument is passed, .la files for modules (plugins) are +# removed as well. This is usually useful when the package installs +# plugins and the plugin loader does not use .la files. +# +# If '--all' argument is passed, all .la files are removed without +# performing any heuristic on them. You shouldn't ever use that, +# and instead report a bug in the algorithm instead. # # The .a files are only removed whenever corresponding .la files state # that they should not be linked to, i.e. whenever these files @@ -1402,11 +1406,15 @@ fi prune_libtool_files() { debug-print-function ${FUNCNAME} "$@" - local removing_all opt + local removing_all removing_modules opt for opt; do case "${opt}" in --all) removing_all=1 + removing_modules=1 + ;; + --modules) + removing_modules=1 ;; *) die "Invalid argument to ${FUNCNAME}(): ${opt}" @@ -1420,6 +1428,8 @@ prune_libtool_files() { [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' + local reason pkgconfig_scanned + # Remove static libs we're not supposed to link against. if grep -q '^shouldnotlink=yes$' "${f}"; then if [[ -f ${archivefile} ]]; then @@ -1429,16 +1439,17 @@ prune_libtool_files() { # The .la file may be used by a module loader, so avoid removing it # unless explicitly requested. - [[ ${removing_all} ]] || continue - fi + if [[ ${removing_modules} ]]; then + reason='module' + fi # 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 reason pkgconfig_scanned - if [[ ${removing_all} ]]; then + + elif [[ ${removing_all} ]]; then reason='requested' elif [[ ! -f ${archivefile} ]]; then reason='no static archive' -- cgit v1.2.3-65-gdbad