Skip to content

Commit f27db2b

Browse files
committed
Add brotli support to FoundationNetworking
1 parent b250ef7 commit f27db2b

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

utils/build.ps1

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ enum Project {
840840
SourceKitLSP
841841
SymbolKit
842842
DocC
843+
brotli
843844

844845
LLVM
845846
Runtime
@@ -2429,6 +2430,21 @@ function Build-CompilerRuntime([Hashtable] $Platform) {
24292430
}
24302431
}
24312432

2433+
function Build-Brotli([Hashtable] $Platform) {
2434+
Build-CMakeProject `
2435+
-Src $SourceCache\brotli `
2436+
-Bin "$(Get-ProjectBinaryCache $Platform brotli)" `
2437+
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" `
2438+
-Platform $Platform `
2439+
-UseMSVCCompilers C `
2440+
-Defines @{
2441+
BUILD_SHARED_LIBS = "NO";
2442+
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
2443+
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
2444+
}
2445+
}
2446+
2447+
24322448
function Build-ZLib([Hashtable] $Platform) {
24332449
Build-CMakeProject `
24342450
-Src $SourceCache\zlib `
@@ -2517,7 +2533,7 @@ function Build-CURL([Hashtable] $Platform) {
25172533
CURL_CA_BUNDLE = "none";
25182534
CURL_CA_FALLBACK = "NO";
25192535
CURL_CA_PATH = "none";
2520-
CURL_BROTLI = "NO";
2536+
CURL_BROTLI = "YES";
25212537
CURL_DISABLE_ALTSVC = "NO";
25222538
CURL_DISABLE_AWS = "YES";
25232539
CURL_DISABLE_BASIC_AUTH = "NO";
@@ -2595,6 +2611,7 @@ function Build-CURL([Hashtable] $Platform) {
25952611
USE_WIN32_LDAP = "NO";
25962612
ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr";
25972613
ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib";
2614+
BROTLI_DIR = "$BinaryCache\$($Platform.Triple)\usr";
25982615
})
25992616
}
26002617

@@ -2992,6 +3009,7 @@ function Build-Foundation([Hashtable] $Platform) {
29923009
};
29933010
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
29943011
dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
3012+
BROTLI_DIR = "$BinaryCache\$($Platform.Triple)\usr";
29953013
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
29963014
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
29973015
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
@@ -3016,6 +3034,7 @@ function Test-Foundation {
30163034
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
30173035
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
30183036
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
3037+
$env:BROTLI_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
30193038
$env:CURL_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
30203039
$env:CURL_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include"
30213040
Build-SPMProject `
@@ -4043,6 +4062,7 @@ if (-not $SkipBuild) {
40434062
}
40444063

40454064
Invoke-BuildStep Build-ZLib $Build
4065+
Invoke-BuildStep Build-Brotli $Platform
40464066
Invoke-BuildStep Build-XML2 $Build
40474067
Invoke-BuildStep Build-CURL $Build
40484068
}

utils/swift_build_support/swift_build_support/products/curl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def build(self, host_target):
110110
self.cmake_options.define('CURL_DISABLE_SMTP', 'YES')
111111
self.cmake_options.define('CURL_DISABLE_GOPHER', 'YES')
112112
self.cmake_options.define('CURL_ZLIB', 'YES')
113+
self.cmake_options.define('CURL_BROTLI', 'YES')
113114
self.cmake_options.define('ENABLE_CURL_MANUAL', 'NO')
114115
self.cmake_options.define('ENABLE_UNIX_SOCKETS', 'NO')
115116
self.cmake_options.define('ENABLE_THREADED_RESOLVER', 'NO')

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": "0.1"
185189
}
@@ -291,6 +295,7 @@
291295
"curl": "curl-8_9_1",
292296
"libxml2": "v2.11.5",
293297
"zlib": "v1.3.1",
298+
"brotli": "v1.1.0",
294299
"mimalloc": "v3.0.1"
295300
}
296301
},
@@ -608,6 +613,7 @@
608613
"curl": "curl-8_9_1",
609614
"libxml2": "v2.11.5",
610615
"zlib": "v1.3.1",
616+
"brotli": "v1.1.0",
611617
"mimalloc": "v3.0.3",
612618
"swift-subprocess": "0.1"
613619
}
@@ -666,6 +672,7 @@
666672
"curl": "curl-8_9_1",
667673
"libxml2": "v2.11.5",
668674
"zlib": "v1.3.1",
675+
"brotli": "v1.1.0",
669676
"mimalloc": "v3.0.3",
670677
"swift-subprocess": "0.1"
671678
}

0 commit comments

Comments
 (0)