-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add brotli support to FoundationNetworking #83441
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
base: main
Are you sure you want to change the base?
Conversation
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
Seems windows ci passed. Linux failed due to test compilation error. I've added one more commit to enable test on Linux for swiftlang/swift-corelibs-foundation#5251 |
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
1 similar comment
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
Linux test failure should be fixed now on swiftlang/swift-corelibs-foundation#5251 |
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test Linux platform |
cf08366
to
39f056b
Compare
rebased. swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to get a bit more background on what is being done and why.
Build-CMakeProject ` | ||
-Src $SourceCache\brotli ` | ||
-Bin "$BinaryCache\$($Platform.Triple)\brotli" ` | ||
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to install it? Can we not use it from the build tree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm following the example of zlib here, and it feels cleaner to rely on build artifacts being in a consistent place for all dependency outputs. It seems all other dependencies already do this, so I think we should be consistent. (Maybe let's do these kind of changes in a separate PR for all dependencies if you feel strongly about it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zlib is the only one doing this because it cannot be used from the build tree (I would love to migrate to that model for zlib as well). We no longer install any library which is not being distributed as a DLL - but that requires switching to the master branch rather than a release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, by "use it from the build tree", we'll be referencing .lib object files in brotli build tree like brotli\out\Release\brotlicommon.lib
, and header files in its source tree at paths like brotli\c\include\brotli\decode.h
?
I could try but I doubt it'll play well with the goal in the other comment which is using Brotli_DIR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, except, the idea with Brotli_DIR
is that you tell CMake the directory to look into for BrotliConfig.cmake
and it will wire up the headers and libraries appropriately. You don't need to pass flags or paths to the libraries or headers.
@@ -2334,6 +2349,8 @@ function Build-CURL([Hashtable] $Platform) { | |||
USE_WIN32_LDAP = "NO"; | |||
ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr"; | |||
ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"; | |||
BROTLIDEC_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib" | |||
BROTLICOMMON_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass in the library paths or do they generate a config file that we can use with Brotli_DIR
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build output of brotli does include 3 .pc files, but unsure how well curl supports BROTLI_DIR. The input variables for curl's brotli cmake are BROTLI_INCLUDE_DIR
, BROTLICOMMON_LIBRARY
, BROTLIDEC_LIBRARY
according to https://github.com/curl/curl/blob/master/CMake/FindBrotli.cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .pc
files are for pkg-config, which we do not use or support as that is not something that is available on Windows by default. https://github.com/curl/curl/blob/master/CMake/FindBrotli.cmake#L62-L68 is the bit that matters - it should hopefully allow us to specify just the _DIR
suffixed variable to find everything.
Updated the overview for this PR. Let me know if any details are missing. |
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
@compnerd is https://github.com/swiftlang/swift/blob/main/docs/WindowsBuild.md the best way to go about testing the build on Windows? So far I've been relying on the CI for the toolchain side of changes. |
No, I would suggest that you reference https://github.com/compnerd/swift-build/blob/main/docs/WindowsQuickStart.md. It is much simpler and up-to-date. The use of |
unfortunately the build did not go very far for me while following the instructions:
I looked at the path and don't see swiftc.exe there. Instead it's a nested folders Is there anything obvious I'm missing? |
I think that a small optimization that matters for local development is biting you. We don't re-extract the toolchain, and I suspect that the extraction failed in the first run. Try again adding |
Very likely to be the case. I just installed the .NET runtime and retrying. Separately when you get a chance, would you also mind taking a look at my questions above: #83441 (comment) |
Add brotli as a dependency to enable brotli decoding for curl.
brotli is a general purpose compression algorithm used extensively on web. (https://datatracker.ietf.org/doc/html/rfc7932)
brotli support for curl is enabled by integrating the brotli compression library (https://github.com/google/brotli). I've also added some tests for FoundationNetworking in swiftlang/swift-corelibs-foundation#5251 which exercises this feature by