-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bring PkgConfig parsing to greater parity with pkg-config #2094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This brings the PkgConfig parsing to greater parity with the pkg-config command-line tool, which includes the private dependencies' cFlags when listing cFlags for a package.
This brings the PkgConfigParser to greater parity with the pkg-config command-line tool, which adds the global variable pc_sysrootdir when parsing `.pc` files.
Thanks for the PR. Do you have use cases where this is required for Swift packages? |
@aciidb0mb3r Yeah, the reason that I made this PR was because I was trying to develop a systemLibrary wrapper package, but I couldn't get it to compile because it was missing header search paths. Eventually I realized that Also, I added the |
Hi @aciidb0mb3r, just a friendly request to review this PR. Thanks! 😄 |
Sorry, this slipped my mind. You're always free to ping me after a few days of inactivity! This PR looks good! Can you add a unit test? Look at PkgConfigTests.swift for existing pkgconfig parser tests. |
@aciidb0mb3r I added two very simple tests to PkgConfigParserTests. Let me know if more in-depth tests are needed or if it's sufficient as is. |
Looks great! Thanks! |
@swift-ci smoke test |
It seems there was a test failure because some of the tests require every pkg-config variable to be accounted for. Is the best solution here to add that variable to all of the checks? |
@aciidb0mb3r Friendly ping :) |
I think so? Unless you think that won't be valuable. |
Well, I don't think that it will be very valuable as a test. The implementation I added for the one instance of variable checking is already rather useless; it just replicates the functionality of the code it is testing. That said, it would be out of the scope of this PR to refactor the code such that it doesn't need to check for the environment variable that's being added. I'm not even certain what the |
Is using |
Ah! I have no idea how that slipped past me. It should be |
@aciidb0mb3r Ignoring the gaffe with |
We can create an extension in the test code that has a computed property of all the variables without the |
This brings the PkgConfig parsing to greater parity with the pkg-config command-line tool, which includes the private dependencies' cFlags when listing cFlags for a package.
This brings the PkgConfigParser to greater parity with the pkg-config command-line tool, which adds the global variable pc_sysrootdir when parsing `.pc` files.
I've attempted to fix the pkgconfig tests and (rather messily) resolved the conflicts created by the TSC restructure. |
@swift-ci smoke test |
@aciidb0mb3r The smoke tests seem to have completed. |
This PR includes two main changes:
Required.private
dependencies inpc
files and adds theircFlags
to the mainPkgConfig
instance. Thepkg-config
command line tool seems to add only privatecFlags
(notlibs
) when using the--cflags
flag.pc_sysrootdir
global variable toPkgConfigParser
. This is simply a global variable thatpkg-config
includes but the parser does not.