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 1ScIJ6-0003zK-JK for garchives@archives.gentoo.org; Wed, 06 Jun 2012 15:38:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F2D16E07A1; Wed, 6 Jun 2012 15:37:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B4145E07A1 for ; Wed, 6 Jun 2012 15:37:52 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E87881B4004 for ; Wed, 6 Jun 2012 15:37:51 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2279) id 9490B2004B; Wed, 6 Jun 2012 15:37:50 +0000 (UTC) From: "Michal Gorny (mgorny)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, mgorny@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog eutils.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: ChangeLog eutils.eclass X-VCS-Directories: eclass X-VCS-Committer: mgorny X-VCS-Committer-Name: Michal Gorny Content-Type: text/plain; charset=utf8 Message-Id: <20120606153750.9490B2004B@flycatcher.gentoo.org> Date: Wed, 6 Jun 2012 15:37:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: b6cb6200-c96b-448f-ab60-5a5547f874f4 X-Archives-Hash: 1d40cc2d33a2d539d8d7bb0ed7c0dc84 mgorny 12/06/06 15:37:50 Modified: ChangeLog eutils.eclass Log: Introduce prune_libtool_files() for .la file removal. Based on one used= by autotools-utils. Revision Changes Path 1.291 eclass/ChangeLog file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r= ev=3D1.291&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r= ev=3D1.291&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r= 1=3D1.290&r2=3D1.291 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v retrieving revision 1.290 retrieving revision 1.291 diff -u -r1.290 -r1.291 --- ChangeLog 5 Jun 2012 18:31:54 -0000 1.290 +++ ChangeLog 6 Jun 2012 15:37:50 -0000 1.291 @@ -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.290 2012/06/05 1= 8:31:54 grobian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.291 2012/06/06 1= 5:37:50 mgorny Exp $ + + 06 Jun 2012; Micha=C5=82 G=C3=B3rny eutils.eclass: + Introduce prune_libtool_files() for .la file removal. Based on one use= d + by autotools-utils. =20 05 Jun 2012; Fabian Groffen autotools.eclass: Avoid type -P output for glibtoolize, bug #419641 1.395 eclass/eutils.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.ecla= ss?rev=3D1.395&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.ecla= ss?rev=3D1.395&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/eutils.ecla= ss?r1=3D1.394&r2=3D1.395 Index: eutils.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v retrieving revision 1.394 retrieving revision 1.395 diff -u -r1.394 -r1.395 --- eutils.eclass 5 Jun 2012 17:40:12 -0000 1.394 +++ eutils.eclass 6 Jun 2012 15:37:50 -0000 1.395 @@ -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.394 2012/06/= 05 17:40:12 hasufell Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.395 2012/06/= 06 15:37:50 mgorny Exp $ =20 # @ECLASS: eutils.eclass # @MAINTAINER: @@ -18,7 +18,7 @@ if [[ ${___ECLASS_ONCE_EUTILS} !=3D "recur -_+^+_- spank" ]] ; then ___ECLASS_ONCE_EUTILS=3D"recur -_+^+_- spank" =20 -inherit multilib user +inherit multilib toolchain-funcs user =20 DESCRIPTION=3D"Based on the ${ECLASS} eclass" =20 @@ -1399,6 +1399,100 @@ echo ${jobs:-1} } =20 +# @FUNCTION: prune_libtool_files +# @USAGE: [--all] +# @DESCRIPTION: +# Locate unnecessary libtool files (.la) and libtool static archives +# (.a) and remove them from installation image. +# +# By default, .la files are removed whenever the static linkage can +# 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. +# +# The .a files are only removed whenever corresponding .la files state +# that they should not be linked to, i.e. whenever these files +# correspond to plugins. +# +# Note: if your package installs any .pc files, this function implicitly +# calls pkg-config. You should add it to your DEPEND in that case. +prune_libtool_files() { + debug-print-function ${FUNCNAME} "$@" + + local removing_all opt + for opt; do + case "${opt}" in + --all) + removing_all=3D1 + ;; + *) + die "Invalid argument to ${FUNCNAME}(): ${opt}" + esac + done + + # Create a list of all .pc-covered libs. + local pc_libs=3D() + if [[ ! ${removing_all} ]]; then + local f + local tf=3D${T}/prune-lt-files.pc + local pkgconf=3D$(tc-getPKG_CONFIG) + + while IFS=3D 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} =3D=3D -l* ]] && pc_libs+=3D( lib${arg#-l}.la ) + done + done < <(find "${D}" -type f -name '*.pc' -print0) + + rm -f "${tf}" + fi + + local f + while IFS=3D read -r -d '' f; do # for all .la files + local archivefile=3D${f/%.la/.a} + + [[ ${f} !=3D ${archivefile} ]] || die 'regex sanity check failed' + + # Remove static libs we're not supposed to link against. + if grep -q '^shouldnotlink=3Dyes$' "${f}"; then + einfo "Removing unnecessary ${archivefile#${D%/}}" + rm -f "${archivefile}" + + # The .la file may be used by a module loader, so avoid removing it + # unless explicitly requested. + [[ ${removing_all} ]] || continue + 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 + if [[ ${removing_all} ]]; then + reason=3D'requested' + elif [[ ! -f ${archivefile} ]]; then + reason=3D'no static archive' + elif has "${f##*/}" "${pc_libs[@]}"; then + reason=3D'covered by .pc' + elif [[ ! $(sed -nre \ + "s/^(dependency_libs|inherited_linker_flags)=3D'(.*)'$/\2/p" \ + "${f}") ]]; then + reason=3D'no libs & flags' + fi + + if [[ ${reason} ]]; then + einfo "Removing unnecessary ${f#${D%/}} (${reason})" + rm -f "${f}" + fi + done < <(find "${D}" -type f -name '*.la' -print0) +} + check_license() { die "you no longer need this as portage supports ACCEP= T_LICENSE itself"; } =20 fi