-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Use pkg-config on Windows #16752
Comments
Hmm, not quite sure how we should approach the .pc files shipped with winlib builds.
So we could just roll out minimalist .pc files for our builds, not even catering to the "canonical" .pc names, and just have a single .pc file per package (i.e. not openssl.pc, libssl.pc and libcrypto.pc for OpenSSL, but only openssl.pc). That would save a lot of work (including rebuilding the packages), but might not be best for interoperability with custom dependency builds (although these may not be interoperable at all, see https://gitlab.freedesktop.org/pkg-config/pkg-config/-/merge_requests/13). Line 7 in 33ba1a4
is a nice example why not using something like pkg-config is not the best idea. We're unconditionally requiring OpenSSL, even though Net-SNMP might have been built without OpenSSL support. Perhaps better examples are ext/ssh2 and ext/curl, which also require OpenSSL, although either libssh2 and libcurl could be built with Schannel support instead. Or ext/zip, which requires to have liblzma, and sets a couple of defines in the |
Except for Anyhow, I've build libzip as usual, and got the following libzip.pc:
That is pretty accurate (besides that So if we want to use pkg-config on Windows (and I still think this is a good idea for the reasons given in the OP), we should just roll our own .pc files. After all, it's not hard to manually craft (and some automation might still be possible) something like:
Custom dependency builds could copy these and adapt if needed. And downstream consumers other than PHP (if there are any) would likely not be affected, since we've shipped no .pc files so far, so they probably don't use pkg-config at all. |
FWIW, my nitpick here is suggesting pkgconf instead of u-config. It's portable and maintained (unlike fdo p-c), and has been around for years so it should be well tested with libraries (unlike u-c). |
I don't mind which pkg-config variant we use here. u-config was just trivial to build (CMake), while pkgconf would require Meson (not a big deal, though).
This is likely irrelevant here, because we're probably not using *.pc files built by packages (of the 37 core dependencies, only about 6 already produce *.pc files), and we cannot necessarily use these, because:
|
Description
On POSIX systems, we use pkg-config to configure most (all?) dependency libraries. On Windows, we still look for the headers and libraries "manually" (
CHECK_LIB
andCHECK_HEADER_ADD_INCLUDE
, what is clumsy and likely more constraining than necessary. And maybe worse, it makes it harder to port m4 configurations to w32, or to keep them in sync. It gets especially annoying when we want to check for a certain package version (usually a minimum requirement). Instead I suggest to use pkg-config on Windows, too.POC
I've put a pkg-config.exe in the
PATH
, put a suitable zlib.pc in %DEPS%\lib\pkgconfig, and added that toPKG_CONFIG_PATH
.Then I've applied the following patch to php-src:
If we want to take this route, we should ship pkg-config with https://github.com/php/php-sdk-binary-tools (we can probably use https://github.com/skeeto/u-config). And the winlibs builds would need to actually contain .pc files. I don't think it's viable to rebuilt all php-src dependency winlibs right away, but when updating to new versions, the *.pc files could be added, and then php-src could be adapted to use them.
Thoughts?
The text was updated successfully, but these errors were encountered: