Age | Commit message (Collapse) | Author | Files | Lines |
|
pkg-config strips all duplicate arguments from the flag output string.
This is done for 2 reasons:
1. When a package shows up twice in the final package list after
resolving all Requires, stripping was used to ensure it's flags only
showed up once at the correct location.
2. An optimization so that the output string is not excessively long.
Since commit c6ec7869, 1. is no longer necessary as the final package
list only contains each package once. 2. causes problems when applied
too aggressively since some arguments have different semantics depending
on the prior or subsequent arguments.
To keep a bit of optimization, the stripping is reduced to only removing
consecutive duplicate arguments. This should ensure that the semantics
are kept intact while removing obviously unnecessary arguments.
The drawback is that some arguments will now appear multiple times in
the output when they previously would have only appeared once. Here we
have to rely on the tools using these arguments to handle the duplicates
appropriately since there is no way for pkg-config to encode all the
semantics of those arguments. Another thing that can help this situation
is if pkg-config is used for all packages in the Requires chain so that
the Libs/Cflags of each package only pertain to itself and don't encode
the compiling/linking rules of a 3rd party package.
Freedesktop #16101 (https://bugs.freedesktop.org/show_bug.cgi?id=16101)
|
|
Often other Libs flags have semantics that are based on their context
with -l arguments. For example, the GNU linker options
-Bdynamic/-Bstatic pertain only to the objects or link options that
follow them. So, a valid link command containing these options would get
mangled by pkg-config since it separates -l flags from others..
-Bdynamic -la -Bstatic -lb -> -Bdynamic -Bstatic -la -lb
Instead, output -l and other Libs flags in a single pass so they mantain
their ordering.
Freedesktop #19950 (https://bugs.freedesktop.org/show_bug.cgi?id=19950)
|
|
Outputting other Libs flags such as -Wl,foo just prior to the -l Libs
flags gives a better chance the --libs output will be correct. This
should be no change in the usage of the output since pkg-config
currently groups all flag types together.
|
|
Prior to commit 6ecf318, the resolved list of required packages was
built in an appending way where each package on the command line or in
Requires would appear in the list in the order they appeared. With
6ecf318, that list building was changed to prepending, which had a
subtle change on the resolved order.
For example, suppose package a has "Requires: b c d". Previously, the
list would be built as a->b->c->d by appending each as they were
encountered. Now, the list is built by walking all the way down the
dependency chain for each package in a depth first manner and prepending
packages while unwinding. This would result in the package ilst being
a->d->c->b. This same effect happens with the command line packages
where previously requesting packages x and y would create a package list
of x->y and now produces a list of y->x.
While technically these should be the same since there are no
interdependencies, it's causes flags to be output in different order
than previously in pkg-config. This can be seen most readily in the
check-gtk test.
Instead, operate on the package lists backwards when building the
resolved package list.
|
|
Makes the resolved package list be correctly serialized with each
package only appearing once. This provides more consistency between the
various flag outputs by ensuring that the flags from each package are
only grabbed once. This makes a difference since the duplicate flag
stripping happens from the end of the output (-l) or the beginning of
the output (-L/-I/other).
|
|
The pkg-config testsuite has pretty good coverage of the implementation,
but it lacks a complex case that tests the interactions of non-trivial
.pc files. gtk is a very common package that meets this goal. This is a
snapshot from my F16 system, and it should provide a good way to see how
changes in the implementation regress a real world case.
|