2020-07-24 21:39:27 +03:00
|
|
|
<#
|
|
|
|
|
|
|
|
.SYNOPSIS
|
|
|
|
This script assembles the archives into a distribution.
|
|
|
|
|
|
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
Set-StrictMode -Version 'Latest'
|
|
|
|
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
|
|
|
|
|
|
|
# Root directory of the project.
|
|
|
|
$RootDir = Split-Path $PSScriptRoot -Parent
|
|
|
|
|
|
|
|
# Find all types we can archive
|
|
|
|
$BaseArtifactsDir = Join-Path $RootDir "artifacts"
|
|
|
|
$ArtifactsBinDir = Join-Path $BaseArtifactsDir "bin"
|
|
|
|
|
|
|
|
# All direct subfolders are OS's
|
|
|
|
$Platforms = Get-ChildItem -Path $ArtifactsBinDir
|
|
|
|
|
2023-04-18 23:00:13 +03:00
|
|
|
$Version = "2.3.0"
|
2022-02-05 00:41:55 +03:00
|
|
|
|
2020-07-24 21:39:27 +03:00
|
|
|
$WindowsBuilds = @()
|
|
|
|
$AllBuilds = @()
|
|
|
|
|
|
|
|
foreach ($Platform in $Platforms) {
|
2021-08-05 22:08:01 +03:00
|
|
|
$PlatBuilds = Get-ChildItem -Path $Platform.FullName
|
2020-07-24 21:39:27 +03:00
|
|
|
foreach ($PlatBuild in $PlatBuilds) {
|
2021-08-13 23:42:09 +03:00
|
|
|
if (!(Test-Path $PlatBuild.FullName -PathType Container)) {
|
2021-08-09 21:22:08 +03:00
|
|
|
continue;
|
|
|
|
}
|
2021-12-08 01:02:55 +03:00
|
|
|
if ($PlatBuild.Name -eq "_manifest") {
|
2021-12-08 00:12:21 +03:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-24 21:39:27 +03:00
|
|
|
$AllBuilds += $PlatBuild
|
|
|
|
if ($Platform.Name -eq "windows") {
|
|
|
|
$WindowsBuilds += $PlatBuild
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($Build in $AllBuilds) {
|
|
|
|
$BuildBaseName = $Build.Name
|
2021-08-05 22:08:01 +03:00
|
|
|
$Platform = Split-Path -Path (Split-Path -Path $Build.FullName -Parent) -Leaf
|
2020-07-24 21:39:27 +03:00
|
|
|
|
|
|
|
if ($Platform -eq "winkernel") {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
# Important directory paths.
|
|
|
|
$ArtifactsDir = $Build.FullName
|
|
|
|
|
|
|
|
$DistDir = Join-Path $BaseArtifactsDir "dist"
|
|
|
|
|
2021-08-05 22:08:01 +03:00
|
|
|
$TempDir = Join-Path $BaseArtifactsDir "temp/zip/$Platform"
|
2020-07-24 21:39:27 +03:00
|
|
|
$TempDir = Join-Path $TempDir $BuildBaseName
|
|
|
|
|
|
|
|
# Initialize directories needed for building.
|
|
|
|
if (!(Test-Path $DistDir)) {
|
|
|
|
New-Item -Path $DistDir -ItemType Directory -Force | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((Test-Path $TempDir)) {
|
|
|
|
Remove-Item -Path "$TempDir/*" -Recurse -Force
|
|
|
|
}
|
|
|
|
|
|
|
|
New-Item -Path $TempDir -ItemType Directory -Force | Out-Null
|
|
|
|
|
2021-08-05 22:08:01 +03:00
|
|
|
$HeaderDir = Join-Path $RootDir "src/inc"
|
2020-07-24 21:39:27 +03:00
|
|
|
|
|
|
|
# Find Headers
|
|
|
|
|
|
|
|
$Headers = @(Join-Path $HeaderDir "msquic.h")
|
|
|
|
|
2021-10-20 22:53:41 +03:00
|
|
|
if ($Platform -eq "windows" -or $Platform -eq "uwp" -or $Platform -eq "gamecore_console") {
|
2020-07-24 21:39:27 +03:00
|
|
|
$Headers += Join-Path $HeaderDir "msquic_winuser.h"
|
|
|
|
} else {
|
2021-02-12 23:29:22 +03:00
|
|
|
$Headers += Join-Path $HeaderDir "msquic_posix.h"
|
2020-07-24 21:39:27 +03:00
|
|
|
$Headers += Join-Path $HeaderDir "quic_sal_stub.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Find Binaries
|
|
|
|
|
|
|
|
$Binaries = @()
|
2022-02-05 00:41:55 +03:00
|
|
|
$DebugFolders = @()
|
2022-02-11 22:45:42 +03:00
|
|
|
$TestBinary = ""
|
2020-07-24 21:39:27 +03:00
|
|
|
|
2021-10-20 22:53:41 +03:00
|
|
|
if ($Platform -eq "windows" -or $Platform -eq "uwp" -or $Platform -eq "gamecore_console") {
|
2020-07-24 21:39:27 +03:00
|
|
|
$Binaries += Join-Path $ArtifactsDir "msquic.dll"
|
|
|
|
$Binaries += Join-Path $ArtifactsDir "msquic.pdb"
|
2022-02-11 22:45:42 +03:00
|
|
|
if ($Platform -eq "windows") {
|
|
|
|
$TestBinary = Join-Path $ArtifactsDir "msquictest.exe"
|
|
|
|
}
|
2021-02-12 23:29:22 +03:00
|
|
|
} elseif ($Platform -eq "linux") {
|
2022-02-05 00:41:55 +03:00
|
|
|
$Binaries += Join-Path $ArtifactsDir "libmsquic.so.$Version"
|
|
|
|
$LttngBin = Join-Path $ArtifactsDir "libmsquic.lttng.so.$Version"
|
2020-07-30 17:33:11 +03:00
|
|
|
if (Test-Path $LttngBin) {
|
|
|
|
$Binaries += $LttngBin
|
|
|
|
}
|
2022-02-11 22:45:42 +03:00
|
|
|
$TestBinary = Join-Path $ArtifactsDir "msquictest"
|
2021-02-12 23:29:22 +03:00
|
|
|
} else {
|
|
|
|
# macos
|
2022-02-05 00:41:55 +03:00
|
|
|
$Binaries += Join-Path $ArtifactsDir "libmsquic.$Version.dylib"
|
|
|
|
$DebugFolder = Join-Path $ArtifactsDir "libmsquic.$Version.dylib.dSYM"
|
|
|
|
if (Test-Path $DebugFolder) {
|
|
|
|
$DebugFolders += $DebugFolder
|
|
|
|
}
|
2022-02-11 22:45:42 +03:00
|
|
|
$TestBinary = Join-Path $ArtifactsDir "msquictest"
|
2020-07-24 21:39:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
$Libraries = @()
|
|
|
|
|
2021-10-20 22:53:41 +03:00
|
|
|
if ($Platform -eq "windows" -or $Platform -eq "uwp" -or $Platform -eq "gamecore_console") {
|
2020-07-24 21:39:27 +03:00
|
|
|
$Libraries += Join-Path $ArtifactsDir "msquic.lib"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Copy items into temp folder that can be zipped in 1 command
|
|
|
|
|
|
|
|
$IncludeDir = Join-Path $TempDir "include"
|
|
|
|
New-Item -Path $IncludeDir -ItemType Directory -Force | Out-Null
|
|
|
|
|
|
|
|
$BinFolder = Join-Path $TempDir "bin"
|
|
|
|
New-Item -Path $BinFolder -ItemType Directory -Force | Out-Null
|
|
|
|
|
|
|
|
$LibFolder = Join-Path $TempDir "lib"
|
|
|
|
New-Item -Path $LibFolder -ItemType Directory -Force | Out-Null
|
|
|
|
|
|
|
|
foreach ($Header in $Headers) {
|
|
|
|
$FileName = Split-Path -Path $Header -Leaf
|
|
|
|
$CopyToFolder = (Join-Path $IncludeDir $FileName)
|
|
|
|
Copy-Item -LiteralPath $Header -Destination $CopyToFolder -Force
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($Binary in $Binaries) {
|
|
|
|
$FileName = Split-Path -Path $Binary -Leaf
|
|
|
|
$CopyToFolder = (Join-Path $BinFolder $FileName)
|
|
|
|
Copy-Item -LiteralPath $Binary -Destination $CopyToFolder -Force
|
|
|
|
}
|
|
|
|
|
2022-02-05 00:41:55 +03:00
|
|
|
foreach ($DebugFolder in $DebugFolders) {
|
|
|
|
Copy-Item -Path $DebugFolder -Destination $BinFolder -Recurse
|
|
|
|
}
|
|
|
|
|
2020-07-24 21:39:27 +03:00
|
|
|
foreach ($Library in $Libraries) {
|
|
|
|
$FileName = Split-Path -Path $Library -Leaf
|
|
|
|
$CopyToFolder = (Join-Path $LibFolder $FileName)
|
|
|
|
Copy-Item -LiteralPath $Library -Destination $CopyToFolder -Force
|
|
|
|
}
|
|
|
|
|
2021-01-15 23:53:25 +03:00
|
|
|
# Copy License
|
|
|
|
Copy-Item -Path (Join-Path $RootDir "LICENSE") -Destination $TempDir
|
2021-08-07 02:48:45 +03:00
|
|
|
if (!($BuildBaseName -like "*schannel*")) {
|
2021-01-15 23:53:25 +03:00
|
|
|
# Only need license, no 3rd party code
|
|
|
|
Copy-Item -Path (Join-Path $RootDir "THIRD-PARTY-NOTICES") -Destination $TempDir
|
|
|
|
}
|
2022-02-11 22:45:42 +03:00
|
|
|
|
2020-07-24 21:39:27 +03:00
|
|
|
# Package zip archive
|
|
|
|
Compress-Archive -Path "$TempDir/*" -DestinationPath (Join-Path $DistDir "msquic_$($Platform)_$BuildBaseName.zip") -Force
|
2021-06-14 21:29:21 +03:00
|
|
|
|
|
|
|
# For now, package only x64 Release binaries
|
2022-08-17 14:28:14 +03:00
|
|
|
if ($Platform -eq "linux" -and $BuildBaseName -like "*_Release*") {
|
2021-06-14 21:29:21 +03:00
|
|
|
Write-Output "Packaging $Build"
|
2021-10-07 01:14:58 +03:00
|
|
|
$OldLoc = Get-Location
|
|
|
|
Set-Location $RootDir
|
2023-04-28 22:04:37 +03:00
|
|
|
$Tls = "openssl"
|
|
|
|
if ($BuildBaseName -like "*openssl3*") {
|
|
|
|
$Tls = "openssl3"
|
|
|
|
}
|
2022-08-17 14:28:14 +03:00
|
|
|
if ($BuildBaseName -like "*arm64_*") {
|
2023-04-28 22:04:37 +03:00
|
|
|
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm64 --tls $Tls
|
2022-08-17 14:28:14 +03:00
|
|
|
} elseif ($BuildBaseName -like "*arm_*") {
|
2023-04-28 22:04:37 +03:00
|
|
|
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm --tls $Tls
|
2022-08-17 14:28:14 +03:00
|
|
|
} else {
|
2023-04-28 22:04:37 +03:00
|
|
|
& $RootDir/scripts/make-packages.sh --output $DistDir --tls $Tls # x64
|
2022-08-17 14:28:14 +03:00
|
|
|
}
|
2021-10-07 01:14:58 +03:00
|
|
|
Set-Location $OldLoc
|
2021-06-14 21:29:21 +03:00
|
|
|
}
|
2022-02-11 22:45:42 +03:00
|
|
|
|
|
|
|
# Package msquictest in separate test package.
|
|
|
|
if ($TestBinary -ne "") {
|
|
|
|
Compress-Archive -Path $TestBinary -DestinationPath (Join-Path $DistDir "msquic_$($Platform)_$($BuildBaseName)_test.zip") -Force
|
|
|
|
}
|
2020-07-24 21:39:27 +03:00
|
|
|
}
|