1 |
On 21:57 Mon 12 Sep , Michał Górny wrote: |
2 |
> Right now, autotools-utils.eclass punts .la files only with |
3 |
> USE=-static-libs. We'd like to broaden the range of it and strip .la |
4 |
> files when they are not necessary for static linkage as well. |
5 |
> |
6 |
> The following patch introduces an initial support for that. It assumes |
7 |
> that the .la file can be removed if the library is mentioned in any of |
8 |
> pkg-config files installed by the package, or if doesn't specify any |
9 |
> dependency libs nor linker flags. |
10 |
|
11 |
If I understand correctly, this will break for any packages that don't |
12 |
use pkg-config to link. The maintainers will manually need to add |
13 |
pkg-config calls to the ebuilds of anything that could statically link |
14 |
against a library using only libtool and not pkg-config. Is that |
15 |
accurate? |
16 |
|
17 |
It might be worthwhile to add an easy way to force this argument on for |
18 |
every package for the purposes of testing, e.g. an environment variable. |
19 |
|
20 |
> # @FUNCTION: remove_libtool_files |
21 |
> -# @USAGE: [all|none] |
22 |
> +# @USAGE: [all|only-not-required|none] |
23 |
|
24 |
Is there a way to document the arguments of eclass functions? You added |
25 |
the name of the arg but didn't describe its purpose or why anyone would |
26 |
want to use it. |
27 |
|
28 |
On a semantic note, that argument name (only-not-required) doesn't make |
29 |
sense to me. I might do something more helpful like pkgconfig-duplicates |
30 |
instead. |
31 |
|
32 |
> + if [[ "$1" == 'only-not-required' ]]; then |
33 |
|
34 |
This is way more quoting than you need within double brackets. |
35 |
|
36 |
> local f |
37 |
> for f in $(find "${D}" -type f -name '*.la'); do |
38 |
> # Keep only .la files with shouldnotlink=yes - likely plugins |
39 |
> local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
40 |
> if [[ "$1" == 'all' || -z ${shouldnotlink} ]]; then |
41 |
> + if [[ "$1" == 'only-not-required' ]]; then |
42 |
|
43 |
Is there a case where one of those arguments might be $2 but you'd still |
44 |
want to run this? |
45 |
|
46 |
I feel like that shouldnotlink thing is really confusing the logic, |
47 |
because there's multiple nested tests for different values of $1 in here |
48 |
instead of just testing the args once at the top and setting variables. |
49 |
|
50 |
> + # remove .la files only when .pc files provide the libs |
51 |
> + # already or they don't give any information |
52 |
> + ! has $(basename "${f}") ${pc_libs} \ |
53 |
> + && [[ -n "$(sed -n \ |
54 |
|
55 |
The comment says "or" but I see an "and" here. |
56 |
|
57 |
> + -e "s/^dependency_libs='\(.*\)'$/\1/p" \ |
58 |
> + -e "s/^inherited_linker_flags='\(.*\)'$/\1/p" \ |
59 |
> + "${f}")" ]] \ |
60 |
> + && continue |
61 |
> + fi |
62 |
> + |
63 |
|
64 |
-- |
65 |
Thanks, |
66 |
Donnie |
67 |
|
68 |
Donnie Berkholz |
69 |
Council Member / Sr. Developer |
70 |
Gentoo Linux |
71 |
Blog: http://dberkholz.com |