Skip to content

Commit 3a80993

Browse files
committed
build.ps1: repair the Android SDK build
When building Android, we would fail to find the brotli build. Explicitly pass the library paths and include paths to workaround the issue. This is not ideal, but will unblock the build. Avoid the installation of the library as it is not required, which avoids updating the mtime on a null-build.
1 parent 9e8ba0c commit 3a80993

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

utils/build.ps1

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,9 +2479,9 @@ function Build-Brotli([Hashtable] $Platform) {
24792479
Build-CMakeProject `
24802480
-Src $SourceCache\brotli `
24812481
-Bin "$(Get-ProjectBinaryCache $Platform brotli)" `
2482-
-InstallTo "$BinaryCache\$($Platform.Triple)\usr" `
24832482
-Platform $Platform `
24842483
-UseMSVCCompilers C `
2484+
-BuildTargets default `
24852485
-Defines @{
24862486
BUILD_SHARED_LIBS = "NO";
24872487
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
@@ -2572,6 +2572,17 @@ function Build-CURL([Hashtable] $Platform) {
25722572
BUILD_SHARED_LIBS = "NO";
25732573
BUILD_TESTING = "NO";
25742574
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
2575+
BROTLI_INCLUDE_DIR = "$SourceCache\brotli\c\include";
2576+
BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2577+
"$(Get-ProjectBinaryCache $Platform brotli)\brotlicommon.lib"
2578+
} else {
2579+
"$(Get-ProjectBinaryCache $Platform brotli)\libbrotlicommon.a"
2580+
};
2581+
BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
2582+
"$(Get-ProjectBinaryCache $Platform brotli)\brotlidec.lib"
2583+
} else {
2584+
"$(Get-ProjectBinaryCache $Platform brotli)\libbrotlidec.a"
2585+
}
25752586
BUILD_CURL_EXE = "NO";
25762587
BUILD_LIBCURL_DOCS = "NO";
25772588
BUILD_MISC_DOCS = "NO";
@@ -2656,7 +2667,6 @@ function Build-CURL([Hashtable] $Platform) {
26562667
USE_WIN32_LDAP = "NO";
26572668
ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr";
26582669
ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib";
2659-
BROTLI_DIR = "$BinaryCache\$($Platform.Triple)\usr";
26602670
})
26612671
}
26622672

@@ -3046,6 +3056,17 @@ function Build-Foundation([Hashtable] $Platform) {
30463056
# FIXME(compnerd) - workaround ARM64 build failure when cross-compiling.
30473057
CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES";
30483058
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3059+
BROTLI_INCLUDE_DIR = "$SourceCache\brotli\c\include";
3060+
BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3061+
"$(Get-ProjectBinaryCache $Platform brotli)\brotlicommon.lib"
3062+
} else {
3063+
"$(Get-ProjectBinaryCache $Platform brotli)\libbrotlicommon.a"
3064+
};
3065+
BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3066+
"$(Get-ProjectBinaryCache $Platform brotli)\brotlidec.lib"
3067+
} else {
3068+
"$(Get-ProjectBinaryCache $Platform brotli)\libbrotlidec.a"
3069+
}
30493070
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" };
30503071
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
30513072
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
@@ -3056,7 +3077,6 @@ function Build-Foundation([Hashtable] $Platform) {
30563077
};
30573078
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
30583079
dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
3059-
BROTLI_DIR = "$BinaryCache\$($Platform.Triple)\usr";
30603080
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
30613081
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
30623082
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
@@ -3081,7 +3101,7 @@ function Test-Foundation {
30813101
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
30823102
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
30833103
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
3084-
$env:BROTLI_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
3104+
$env:BROTLI_LIBRARY_PATH="$(Get-ProjectBinaryCache $BuildPlatform brotli)"
30853105
$env:CURL_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
30863106
$env:CURL_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include"
30873107
Build-SPMProject `
@@ -4196,15 +4216,12 @@ if (-not $SkipBuild) {
41964216
if (-not $Build.LinkModes.Contains("static")) { continue }
41974217

41984218
$SDKROOT = Get-SwiftSDK -OS $Build.OS -Identifier "$($Build.OS)Experimental"
4199-
Copy-Item -Force `
4200-
-Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.lib" `
4201-
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libcurl.lib" | Out-Null
4202-
Copy-Item -Force `
4203-
-Path "${BinaryCache}\$($Build.Triple)\libxml2-2.11.5\libxml2s.lib" `
4204-
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libxml2s.lib" | Out-Null
4205-
Copy-Item -Force `
4206-
-Path "${BinaryCache}\$($Build.Triple)\zlib\zlibstatic.lib" `
4207-
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\zlibstatic.lib" | Out-Null
4219+
$SwiftResourceDir = "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)"
4220+
Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\brotlicommon.lib" -Destination "${SwiftResourceDir}\brotlicommon.lib" | Out-Null
4221+
Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\brotlidec.lib" -Destination "${SwiftResourceDir}\brotlidec.lib" | Out-Null
4222+
Copy-Item -Force -Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.lib" -Destination "${SwiftResourceDir}\libcurl.lib" | Out-Null
4223+
Copy-Item -Force -Path "${BinaryCache}\$($Build.Triple)\libxml2-2.11.5\libxml2s.lib" -Destination "${SwiftResourceDir}\libxml2s.lib" | Out-Null
4224+
Copy-Item -Force -Path "${BinaryCache}\$($Build.Triple)\zlib\zlibstatic.lib" -Destination "${SwiftResourceDir}\zlibstatic.lib" | Out-Null
42084225
}
42094226
}
42104227

0 commit comments

Comments
 (0)