Commit 7caeccc
authored
Add mergeback for -D and -W cflags to match pkgconf behavior (#43)
When multiple packages have the same -D or -W flags, pkgconf removes
previous occurrences and keeps only the last one (merge back).
This prevents flag duplication like "-DNOMINMAX"
appearing many times.
```console
$ pkgconf --cflags re2
-pthread -DNOMINMAX
$ ruby -r pkg-config -e 'puts PKGConfig.cflags("re2")'
-pthread -DNOMINMAX -DNOMINMAX -DNOMINMAX ...
```
Flags excluded from merge back (kept as duplicates):
- -Wa, (assembler options)
- -Wl, (linker options)
- -Wp, (preprocessor options)
This PR only supports merge back for -D and -W flags. Other flags that
pkgconf also merges back are not yet supported.1 parent ca9ad8a commit 7caeccc
2 files changed
+57
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| 548 | + | |
548 | 549 | | |
549 | 550 | | |
550 | 551 | | |
| |||
579 | 580 | | |
580 | 581 | | |
581 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
582 | 609 | | |
583 | 610 | | |
584 | 611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
317 | 347 | | |
0 commit comments