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 1R3Dci-0000yZ-PN for garchives@archives.gentoo.org; Mon, 12 Sep 2011 21:01:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5938321C103; Mon, 12 Sep 2011 21:00:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7E2C321C0BD for ; Mon, 12 Sep 2011 21:00:23 +0000 (UTC) Received: from localhost (24-179-244-217.dhcp.roch.mn.charter.com [24.179.244.217]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: dberkholz) by smtp.gentoo.org (Postfix) with ESMTPSA id B73C164CA1 for ; Mon, 12 Sep 2011 21:00:22 +0000 (UTC) Date: Mon, 12 Sep 2011 16:00:20 -0500 From: Donnie Berkholz To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] autotools-utils.eclass: punt unnecessary .la files even w/ USE=static-libs. Message-ID: <20110912210020.GA31178@comet> References: <1315857465-8179-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 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <1315857465-8179-1-git-send-email-mgorny@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: X-Archives-Hash: d912df13c557ad9eb4cff09520b9d4f2 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 21:57 Mon 12 Sep , Micha=C5=82 G=C3=B3rny wrote: > Right now, autotools-utils.eclass punts .la files only with > USE=3D-static-libs. We'd like to broaden the range of it and strip .la > files when they are not necessary for static linkage as well. >=20 > The following patch introduces an initial support for that. It assumes > that the .la file can be removed if the library is mentioned in any of > pkg-config files installed by the package, or if doesn't specify any > dependency libs nor linker flags. If I understand correctly, this will break for any packages that don't=20 use pkg-config to link. The maintainers will manually need to add=20 pkg-config calls to the ebuilds of anything that could statically link=20 against a library using only libtool and not pkg-config. Is that=20 accurate? It might be worthwhile to add an easy way to force this argument on for=20 every package for the purposes of testing, e.g. an environment variable. > # @FUNCTION: remove_libtool_files > -# @USAGE: [all|none] > +# @USAGE: [all|only-not-required|none] Is there a way to document the arguments of eclass functions? You added=20 the name of the arg but didn't describe its purpose or why anyone would=20 want to use it. On a semantic note, that argument name (only-not-required) doesn't make=20 sense to me. I might do something more helpful like pkgconfig-duplicates=20 instead. > + if [[ "$1" =3D=3D 'only-not-required' ]]; then This is way more quoting than you need within double brackets. > local f > for f in $(find "${D}" -type f -name '*.la'); do > # Keep only .la files with shouldnotlink=3Dyes - likely plugins > local shouldnotlink=3D$(sed -ne '/^shouldnotlink=3Dyes$/p' "${f}") > if [[ "$1" =3D=3D 'all' || -z ${shouldnotlink} ]]; then > + if [[ "$1" =3D=3D 'only-not-required' ]]; then Is there a case where one of those arguments might be $2 but you'd still=20 want to run this? I feel like that shouldnotlink thing is really confusing the logic,=20 because there's multiple nested tests for different values of $1 in here=20 instead of just testing the args once at the top and setting variables. > + # remove .la files only when .pc files provide the libs > + # already or they don't give any information > + ! has $(basename "${f}") ${pc_libs} \ > + && [[ -n "$(sed -n \ The comment says "or" but I see an "and" here. > + -e "s/^dependency_libs=3D'\(.*\)'$/\1/p" \ > + -e "s/^inherited_linker_flags=3D'\(.*\)'$/\1/p" \ > + "${f}")" ]] \ > + && continue > + fi > + --=20 Thanks, Donnie Donnie Berkholz Council Member / Sr. Developer Gentoo Linux Blog: http://dberkholz.com --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEABECAAYFAk5ucuQACgkQXVaO67S1rttN5ACg4W37C8Yr6ro/wHS7to9vpfkf 61cAoLU8i8vRc1BYL/qFnzRWNXwEnKgg =RNC9 -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND--