Removing duplicate arguments in Cflags and Libs can give incorrect results in some cases. Doing it correctly is very difficult - it requires understanding the semantics of all the arguments - so it's probably best not to do it at all. Here are some examples of where duplicate removal is wrong:
-O2 -O0 -O2 (equivalent to just -O2) => -O2 -O0 (equivalent to just -O0)
-Xlinker -R -Xlinker /dir1 -Xlinker -R -Xlinker /dir2 (meaningful) => -Xlinker -R /dir1 /dir2 (gives an error)
*** Bug 32536 has been marked as a duplicate of this bug. ***
I pushed the flag-order-fixes branch to git which I believe addresses this issue.
Some info can be found on the list at http://lists.freedesktop.org/archives/pkg-config/2012-December/000908.html.
Please test out the branch if you can. If there aren't any comments after a bit, I'll push to master and close this bug.
I merged the flag-order-fixes branch to master now and I think this bug should be fixed. Please reopen if that's not the case.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.