Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,21 @@ function Build-Sanitizers([Hashtable] $Platform) {
}
}

function Build-Brotli([Hashtable] $Platform) {
Build-CMakeProject `
-Src $SourceCache\brotli `
-Bin "$BinaryCache\$($Platform.Triple)\brotli" `
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" `
-Platform $Platform `
-UseMSVCCompilers C `
-Defines @{
BUILD_SHARED_LIBS = "NO";
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
}
}


function Build-ZLib([Hashtable] $Platform) {
Build-CMakeProject `
-Src $SourceCache\zlib `
Expand Down Expand Up @@ -2256,7 +2271,7 @@ function Build-CURL([Hashtable] $Platform) {
CURL_CA_BUNDLE = "none";
CURL_CA_FALLBACK = "NO";
CURL_CA_PATH = "none";
CURL_BROTLI = "NO";
CURL_BROTLI = "YES";
CURL_DISABLE_ALTSVC = "NO";
CURL_DISABLE_AWS = "YES";
CURL_DISABLE_BASIC_AUTH = "NO";
Expand Down Expand Up @@ -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"
})
}

Expand Down Expand Up @@ -2723,6 +2740,17 @@ function Build-Foundation {
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
};
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib"
} else {
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlidec.a"
}
BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib"
}else {
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlicommon.a"
}
DBROTLI_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
dispatch_DIR = $DispatchCMakeModules;
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
Expand All @@ -2745,6 +2773,7 @@ function Test-Foundation {
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
$env:BROTLI_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
$env:CURL_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
$env:CURL_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include"
Build-SPMProject `
Expand Down Expand Up @@ -2895,6 +2924,7 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {

# Third Party Dependencies
Invoke-BuildStep Build-ZLib $Platform
Invoke-BuildStep Build-Brotli $Platform
Invoke-BuildStep Build-XML2 $Platform
Invoke-BuildStep Build-CURL $Platform
Invoke-BuildStep Build-LLVM $Platform
Expand Down
7 changes: 7 additions & 0 deletions utils/update_checkout/update-checkout-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
"zlib": {
"remote": { "id": "madler/zlib" }
},
"brotli": {
"remote": { "id": "google/brotli" }
},
"mimalloc": {
"remote": { "id": "microsoft/mimalloc" },
"platforms": [ "Windows" ]
Expand Down Expand Up @@ -180,6 +183,7 @@
"curl": "curl-8_9_1",
"libxml2": "v2.11.5",
"zlib": "v1.3.1",
"brotli": "v1.1.0",
"mimalloc": "v3.0.3",
"swift-subprocess": "development-snapshot-2025-07-21"
}
Expand Down Expand Up @@ -236,6 +240,7 @@
"curl": "curl-8_9_1",
"libxml2": "v2.11.5",
"zlib": "v1.3.1",
"brotli": "v1.1.0",
"mimalloc": "v3.0.1"
}
},
Expand Down Expand Up @@ -498,6 +503,7 @@
"curl": "curl-8_9_1",
"libxml2": "v2.11.5",
"zlib": "v1.3.1",
"brotli": "v1.1.0",
"mimalloc": "v3.0.1",
"swift-subprocess": "development-snapshot-2025-07-21"
}
Expand Down Expand Up @@ -549,6 +555,7 @@
"curl": "curl-8_9_1",
"libxml2": "v2.11.5",
"zlib": "v1.3.1",
"brotli": "v1.1.0",
"mimalloc": "v3.0.1",
"swift-subprocess": "development-snapshot-2025-07-21"
}
Expand Down