Skip to content

Commit a01f1d5

Browse files
committed
Add brotli support to FoundationNetworking
1 parent 1439408 commit a01f1d5

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

utils/build.ps1

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,21 @@ function Build-Sanitizers([Hashtable] $Platform) {
21722172
}
21732173
}
21742174

2175+
function Build-Brotli([Hashtable] $Platform) {
2176+
Build-CMakeProject `
2177+
-Src $SourceCache\brotli `
2178+
-Bin "$BinaryCache\$($Platform.Triple)\brotli" `
2179+
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" `
2180+
-Platform $Platform `
2181+
-UseMSVCCompilers C `
2182+
-Defines @{
2183+
BUILD_SHARED_LIBS = "NO";
2184+
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
2185+
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
2186+
}
2187+
}
2188+
2189+
21752190
function Build-ZLib([Hashtable] $Platform) {
21762191
Build-CMakeProject `
21772192
-Src $SourceCache\zlib `
@@ -2256,7 +2271,7 @@ function Build-CURL([Hashtable] $Platform) {
22562271
CURL_CA_BUNDLE = "none";
22572272
CURL_CA_FALLBACK = "NO";
22582273
CURL_CA_PATH = "none";
2259-
CURL_BROTLI = "NO";
2274+
CURL_BROTLI = "YES";
22602275
CURL_DISABLE_ALTSVC = "NO";
22612276
CURL_DISABLE_AWS = "YES";
22622277
CURL_DISABLE_BASIC_AUTH = "NO";
@@ -2334,6 +2349,8 @@ function Build-CURL([Hashtable] $Platform) {
23342349
USE_WIN32_LDAP = "NO";
23352350
ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr";
23362351
ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib";
2352+
BROTLIDEC_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib"
2353+
BROTLICOMMON_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib"
23372354
})
23382355
}
23392356

@@ -2723,6 +2740,17 @@ function Build-Foundation {
27232740
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
27242741
};
27252742
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
2743+
BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2744+
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib"
2745+
} else {
2746+
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlidec.a"
2747+
}
2748+
BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2749+
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib"
2750+
}else {
2751+
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlicommon.a"
2752+
}
2753+
DBROTLI_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
27262754
dispatch_DIR = $DispatchCMakeModules;
27272755
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
27282756
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
@@ -2745,6 +2773,7 @@ function Test-Foundation {
27452773
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
27462774
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
27472775
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
2776+
$env:BROTLI_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
27482777
$env:CURL_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
27492778
$env:CURL_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include"
27502779
Build-SPMProject `
@@ -2895,6 +2924,7 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
28952924

28962925
# Third Party Dependencies
28972926
Invoke-BuildStep Build-ZLib $Platform
2927+
Invoke-BuildStep Build-Brotli $Platform
28982928
Invoke-BuildStep Build-XML2 $Platform
28992929
Invoke-BuildStep Build-CURL $Platform
29002930
Invoke-BuildStep Build-LLVM $Platform

utils/update_checkout/update-checkout-config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
"zlib": {
119119
"remote": { "id": "madler/zlib" }
120120
},
121+
"brotli": {
122+
"remote": { "id": "google/brotli" }
123+
},
121124
"mimalloc": {
122125
"remote": { "id": "microsoft/mimalloc" },
123126
"platforms": [ "Windows" ]
@@ -180,6 +183,7 @@
180183
"curl": "curl-8_9_1",
181184
"libxml2": "v2.11.5",
182185
"zlib": "v1.3.1",
186+
"brotli": "v1.1.0",
183187
"mimalloc": "v3.0.3",
184188
"swift-subprocess": "development-snapshot-2025-07-21"
185189
}
@@ -236,6 +240,7 @@
236240
"curl": "curl-8_9_1",
237241
"libxml2": "v2.11.5",
238242
"zlib": "v1.3.1",
243+
"brotli": "v1.1.0",
239244
"mimalloc": "v3.0.1"
240245
}
241246
},
@@ -498,6 +503,7 @@
498503
"curl": "curl-8_9_1",
499504
"libxml2": "v2.11.5",
500505
"zlib": "v1.3.1",
506+
"brotli": "v1.1.0",
501507
"mimalloc": "v3.0.1",
502508
"swift-subprocess": "development-snapshot-2025-07-21"
503509
}
@@ -549,6 +555,7 @@
549555
"curl": "curl-8_9_1",
550556
"libxml2": "v2.11.5",
551557
"zlib": "v1.3.1",
558+
"brotli": "v1.1.0",
552559
"mimalloc": "v3.0.1",
553560
"swift-subprocess": "development-snapshot-2025-07-21"
554561
}

0 commit comments

Comments
 (0)