public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Donnie Berkholz <dberkholz@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] autotools-utils.eclass: punt unnecessary .la files even w/ USE=static-libs.
Date: Mon, 12 Sep 2011 16:00:20 -0500	[thread overview]
Message-ID: <20110912210020.GA31178@comet> (raw)
In-Reply-To: <1315857465-8179-1-git-send-email-mgorny@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 2675 bytes --]

On 21:57 Mon 12 Sep     , Michał Górny wrote:
> Right now, autotools-utils.eclass punts .la files only with
> USE=-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.
> 
> 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 
use pkg-config to link. The maintainers will manually need to add 
pkg-config calls to the ebuilds of anything that could statically link 
against a library using only libtool and not pkg-config. Is that 
accurate?

It might be worthwhile to add an easy way to force this argument on for 
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 
the name of the arg but didn't describe its purpose or why anyone would 
want to use it.

On a semantic note, that argument name (only-not-required) doesn't make 
sense to me. I might do something more helpful like pkgconfig-duplicates 
instead.

> +	if [[ "$1" == '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=yes - likely plugins
>  		local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
>  		if [[  "$1" == 'all' || -z ${shouldnotlink} ]]; then
> +			if [[ "$1" == 'only-not-required' ]]; then

Is there a case where one of those arguments might be $2 but you'd still 
want to run this?

I feel like that shouldnotlink thing is really confusing the logic, 
because there's multiple nested tests for different values of $1 in here 
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='\(.*\)'$/\1/p" \
> +							-e "s/^inherited_linker_flags='\(.*\)'$/\1/p" \
> +							"${f}")" ]] \
> +						&& continue
> +			fi
> +

-- 
Thanks,
Donnie

Donnie Berkholz
Council Member / Sr. Developer
Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-09-12 21:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 19:57 [gentoo-dev] [PATCH] autotools-utils.eclass: punt unnecessary .la files even w/ USE=static-libs Michał Górny
2011-09-12 21:00 ` Donnie Berkholz [this message]
2011-09-12 21:46   ` Samuli Suominen
2011-09-12 21:51     ` Donnie Berkholz
2011-09-12 22:34       ` Samuli Suominen
2011-09-12 21:58   ` Michał Górny
2011-09-12 22:10     ` Donnie Berkholz
2011-09-13  6:40       ` Michał Górny
2011-09-13 14:10 ` [gentoo-dev] [PATCH autotools-utils 1/9] Fix handling whitespace in filenames when looking for .la files Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 2/9] Strip ${D} from removal message to shorten it Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 3/9] For .la removal, look for static archives rather than USE=static-libs Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 4/9] Clean up & simplify la removal code a little Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 5/9] Check command-line args completely in remove_libtool_files() Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 6/9] Refactor remove_libtool_files() to simplify conditions Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 7/9] Drop 'empty' .la files as well (those lacking libs & flags) Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 8/9] Remove static libs covered by .pc files as well Michał Górny
2011-09-13 14:10   ` [gentoo-dev] [PATCH autotools-utils 9/9] Explain .la removal reasons in output Michał Górny
2011-09-13 15:13   ` [gentoo-dev] [PATCH autotools-utils 1/9] Fix handling whitespace in filenames when looking for .la files Dirkjan Ochtman
2011-09-13 16:23     ` Nirbheek Chauhan
2011-09-16 13:45       ` Donnie Berkholz
2011-09-13 18:33     ` Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110912210020.GA31178@comet \
    --to=dberkholz@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox