Implement pkg-config flag deduplication#470
Conversation
dfb18f2 to
841ac83
Compare
|
if it doesn't explode horribly once you have the usual permutation of |
The only corner case I have so far (tested with Windows, macOS ongoing) is that the That one case of relro etc. sounds prime for testing with Android, I'll do that later today. |
bccfe71 to
e3478ac
Compare
Should reduce a lot of the noise in Cflags and Libraries. See lu-zero#455
e3478ac to
e109aed
Compare
|
Speaking as the guy who implemented Meson's de-dup of link args and cflags, this is very easy to get wrong. Did you use Meson's de-dup class as a reference when building this? |
|
@nirbheek do you have a test suite we can share? |
|
Meson's test case won't exactly map here, because reordering link args needs to be done carefully. You can have undefined-symbol errors if you get the order wrong, or pick up the library from the wrong prefix. Meson does these things to alleviate this risk:
(1) (2) can be done by cargo-c, but not (3) since cargo-c doesn't know which one to pick. Anyway, the implementation is here: https://github.com/mesonbuild/meson/blob/master/mesonbuild/arglist.py Cflags-related tests are here: https://github.com/mesonbuild/meson/blob/master/unittests/internaltests.py#L114-L279 Some of the library find/arg tests are here: https://github.com/mesonbuild/meson/blob/master/unittests/internaltests.py#L537-L675. The others are integration tests, not unit tests, so not useful for cargo-c. |
|
thank you a lot :) |
Not at all, I was not thinking of any downstream build system in particular when doing this. I relied on pkg_config's own resolution logic for this, and made sure that flags did not lose their semantics until concatenation was needed e.g. The big blocker for doing a Meson-Rust port here is that |
|
I'm conflicted about this PR, it would be better if this kind of logic is part of cargo itself and possibly not rely on pkg-config being stable on dealing with it. |
Should reduce a lot of the noise in Cflags and Libraries.
See #455