Skip to content

Commit cf08366

Browse files
committed
Add brotli support to FoundationNetworking
1 parent f0b4545 commit cf08366

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
@@ -2199,6 +2199,21 @@ function Build-Sanitizers([Hashtable] $Platform) {
21992199
})
22002200
}
22012201

2202+
function Build-Brotli([Hashtable] $Platform) {
2203+
Build-CMakeProject `
2204+
-Src $SourceCache\brotli `
2205+
-Bin "$BinaryCache\$($Platform.Triple)\brotli" `
2206+
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" `
2207+
-Platform $Platform `
2208+
-UseMSVCCompilers C `
2209+
-Defines @{
2210+
BUILD_SHARED_LIBS = "NO";
2211+
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
2212+
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
2213+
}
2214+
}
2215+
2216+
22022217
function Build-ZLib([Hashtable] $Platform) {
22032218
Build-CMakeProject `
22042219
-Src $SourceCache\zlib `
@@ -2287,7 +2302,7 @@ function Build-CURL([Hashtable] $Platform) {
22872302
CURL_CA_BUNDLE = "none";
22882303
CURL_CA_FALLBACK = "NO";
22892304
CURL_CA_PATH = "none";
2290-
CURL_BROTLI = "NO";
2305+
CURL_BROTLI = "YES";
22912306
CURL_DISABLE_ALTSVC = "NO";
22922307
CURL_DISABLE_AWS = "YES";
22932308
CURL_DISABLE_BASIC_AUTH = "NO";
@@ -2365,6 +2380,8 @@ function Build-CURL([Hashtable] $Platform) {
23652380
USE_WIN32_LDAP = "NO";
23662381
ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr";
23672382
ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib";
2383+
BROTLIDEC_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib"
2384+
BROTLICOMMON_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib"
23682385
})
23692386
}
23702387

@@ -2776,6 +2793,17 @@ function Build-Foundation {
27762793
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
27772794
};
27782795
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
2796+
BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2797+
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib"
2798+
} else {
2799+
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlidec.a"
2800+
}
2801+
BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2802+
"$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib"
2803+
}else {
2804+
"$BinaryCache\$($Platform.Triple)\usr\lib64\brotlicommon.a"
2805+
}
2806+
DBROTLI_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
27792807
dispatch_DIR = $DispatchCMakeModules;
27802808
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
27812809
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
@@ -2798,6 +2826,7 @@ function Test-Foundation {
27982826
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
27992827
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
28002828
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
2829+
$env:BROTLI_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
28012830
$env:CURL_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
28022831
$env:CURL_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include"
28032832
Build-SPMProject `
@@ -2943,6 +2972,7 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
29432972

29442973
# Third Party Dependencies
29452974
Invoke-BuildStep Build-ZLib $Platform
2975+
Invoke-BuildStep Build-Brotli $Platform
29462976
Invoke-BuildStep Build-XML2 $Platform
29472977
Invoke-BuildStep Build-CURL $Platform
29482978
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" ]
@@ -177,6 +180,7 @@
177180
"curl": "curl-8_9_1",
178181
"libxml2": "v2.11.5",
179182
"zlib": "v1.3.1",
183+
"brotli": "v1.1.0",
180184
"mimalloc": "v3.0.3"
181185
}
182186
},
@@ -232,6 +236,7 @@
232236
"curl": "curl-8_9_1",
233237
"libxml2": "v2.11.5",
234238
"zlib": "v1.3.1",
239+
"brotli": "v1.1.0",
235240
"mimalloc": "v3.0.1"
236241
}
237242
},
@@ -494,6 +499,7 @@
494499
"curl": "curl-8_9_1",
495500
"libxml2": "v2.11.5",
496501
"zlib": "v1.3.1",
502+
"brotli": "v1.1.0",
497503
"mimalloc": "v3.0.1"
498504
}
499505
},
@@ -544,6 +550,7 @@
544550
"curl": "curl-8_9_1",
545551
"libxml2": "v2.11.5",
546552
"zlib": "v1.3.1",
553+
"brotli": "v1.1.0",
547554
"mimalloc": "v3.0.1"
548555
}
549556
}

0 commit comments

Comments
 (0)