Skip to content

Commit bfcabd4

Browse files
committed
build.ps1: stage static library artifacts
These dependencies are normally consumed by the dynamic target that uses them. However, when distributing a static SDK, we must distribute the static library content as well to allow linking against the version of the dependency that the runtime is built against. The binary staging here is required to allow us to package the content into the toolchain distribution.
1 parent e6409d7 commit bfcabd4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

utils/build.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,6 +3733,37 @@ function Install-HostToolchain() {
37333733
Copy-Item -Force `
37343734
-Path $SwiftDriver `
37353735
-Destination "$($HostPlatform.ToolchainInstallRoot)\usr\bin\swiftc.exe"
3736+
3737+
# Copy static dependencies
3738+
if ($Windows) {
3739+
foreach ($Build in $WindowsSDKBuilds) {
3740+
$SDKROOT = Get-SwiftSDK $Build.OS -Identifier "$($Build.OS)Experimental"
3741+
Copy-Item -Force `
3742+
-Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.lib" `
3743+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libcurl.lib" | Out-Null
3744+
Copy-Item -Force `
3745+
-Path "${BinaryCache}\$($Build.Triple)\libxml2-2.11.5\libxml2s.lib" `
3746+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libxml2s.lib" | Out-Null
3747+
Copy-Item -Force `
3748+
-Path "${BinaryCache}\$($Build.Triple)\zlib\zlibstatic.lib" `
3749+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\zlibstatic.lib" | Out-Null
3750+
}
3751+
}
3752+
3753+
if ($Android) {
3754+
foreach ($Build in $AndroidSDKBuilds) {
3755+
$SDKROOT = Get-SwiftSDK $Build.OS -Identifier "$($Build.OS)Experimental"
3756+
Copy-Item -Force `
3757+
-Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.a" `
3758+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libcurl.a" | Out-Null
3759+
Copy-Item -Force `
3760+
-Path "${BinaryCache}\$($Build.Triple)\libxml2-2.11.5\libxml2.a" `
3761+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libxml2.a" | Out-Null
3762+
Copy-Item -Force `
3763+
-Path "${BinaryCache}\$($Build.Triple)\zlib\libz.a" `
3764+
-Destination "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)\libz.a" | Out-Null
3765+
}
3766+
}
37363767
}
37373768

37383769
function Build-Inspect([Hashtable] $Platform) {

0 commit comments

Comments
 (0)