mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
feat: build and smoke test native Windows ARM64 packages
This commit is contained in:
8 files changed
+50
-12
No files matched your search
@@ -3,7 +3,7 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$MsysRoot = 'C:\msys64',
|
||||
[ValidateSet('mingw64','ucrt64')][string]$MsysSubsystem = 'mingw64',
|
||||
[ValidateSet('mingw64','ucrt64','clangarm64')][string]$MsysSubsystem = 'mingw64',
|
||||
[string]$Prefix,
|
||||
[int]$Jobs = 4
|
||||
)
|
||||
@@ -19,10 +19,16 @@ $nativeExit = $LASTEXITCODE
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($nativeExit -ne 0) { throw 'OpenConnect compilation failed.' }
|
||||
|
||||
$architecture = 'x64'
|
||||
if ($MsysSubsystem -eq 'clangarm64') { $architecture = 'arm64' }
|
||||
$component = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
|
||||
if ($architecture -eq 'arm64') { $component = 'Microsoft.VisualStudio.Component.VC.Tools.ARM64' }
|
||||
$hostTools = 'Hostx64'
|
||||
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $hostTools = 'Hostarm64' }
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$vs = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
||||
$vs = & $vswhere -latest -products '*' -requires $component -property installationPath
|
||||
if (!$vs) { throw 'Visual Studio C++ Build Tools are required.' }
|
||||
$tools = (Get-ChildItem "$vs\VC\Tools\MSVC\*\bin\Hostx64\x64\lib.exe" |
|
||||
$tools = (Get-ChildItem "$vs\VC\Tools\MSVC\*\bin\$hostTools\$architecture\lib.exe" |
|
||||
Sort-Object FullName | Select-Object -Last 1).DirectoryName
|
||||
$dll = Join-Path $Prefix 'bin\libopenconnect-5.dll'
|
||||
$exports = & "$tools\dumpbin.exe" /nologo /exports $dll
|
||||
@@ -35,7 +41,7 @@ foreach ($symbol in @('openconnect_setup_cmd_pipe', 'openconnect_setup_tun_pipe'
|
||||
}
|
||||
$definition = Join-Path $Prefix 'lib\openconnect.def'
|
||||
[System.IO.File]::WriteAllLines($definition, @('LIBRARY libopenconnect-5.dll', 'EXPORTS') + $names)
|
||||
& "$tools\lib.exe" /nologo /machine:x64 "/def:$definition" "/out:$Prefix\lib\openconnect.lib"
|
||||
& "$tools\lib.exe" /nologo "/machine:$architecture" "/def:$definition" "/out:$Prefix\lib\openconnect.lib"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not generate the MSVC import library.' }
|
||||
|
||||
# Copy only the native DLL's transitive MinGW runtime dependencies.
|
||||
|
||||
@@ -13,7 +13,12 @@ cd "$source_dir"
|
||||
autoreconf -fi
|
||||
mkdir -p "$build_dir"
|
||||
cd "$build_dir"
|
||||
"$source_dir/configure" --host=x86_64-w64-mingw32 --prefix="$prefix" \
|
||||
host=x86_64-w64-mingw32
|
||||
if [[ $subsystem == clangarm64 ]]; then
|
||||
host=aarch64-w64-mingw32
|
||||
export CC=clang AR=llvm-ar RANLIB=llvm-ranlib NM=llvm-nm
|
||||
fi
|
||||
"$source_dir/configure" --host="$host" --prefix="$prefix" \
|
||||
--enable-shared --disable-static --disable-nls --disable-docs --disable-dsa-tests \
|
||||
--without-libproxy --without-stoken --without-libpcsclite --without-libpskc \
|
||||
--without-gssapi --with-gnutls --without-openssl --with-gnutls-tss2=no \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CmdletBinding()]
|
||||
param([string]$MsysRoot = 'C:\msys64', [string]$Prefix = $env:OPENCONNECT_WINDOWS_PREFIX,
|
||||
[ValidateSet('mingw64','ucrt64')][string]$MsysSubsystem = 'mingw64')
|
||||
[ValidateSet('mingw64','ucrt64','clangarm64')][string]$MsysSubsystem = 'mingw64')
|
||||
$repo = Split-Path $PSScriptRoot -Parent
|
||||
if (!$Prefix) { $Prefix = Join-Path $repo 'target\native-windows' }
|
||||
& "$MsysRoot\usr\bin\bash.exe" "$PSScriptRoot/test-openconnect-windows.sh" $repo $Prefix $MsysSubsystem
|
||||
|
||||
@@ -8,7 +8,9 @@ prefix=$(cygpath -u "$2")
|
||||
build_dir="$repo/target/openconnect-windows"
|
||||
source_dir="$repo/crates/openconnect/deps/openconnect"
|
||||
export PATH="$prefix/bin:$PATH"
|
||||
gcc -Wall -Wextra -I"$build_dir" -I"$source_dir" -I"$source_dir/json" \
|
||||
compiler=gcc
|
||||
if [[ $subsystem == clangarm64 ]]; then compiler=clang; fi
|
||||
"$compiler" -Wall -Wextra -I"$build_dir" -I"$source_dir" -I"$source_dir/json" \
|
||||
$(pkg-config --cflags gnutls libxml-2.0) \
|
||||
"$repo/crates/openconnect/tests/windows_packet_pipe.c" \
|
||||
-L"$prefix/lib" -lopenconnect -lws2_32 -o "$build_dir/test-windows-packet-pipe.exe"
|
||||
|
||||
@@ -28,6 +28,13 @@ foreach ($name in @('gpgui.exe', 'gpauth.exe')) {
|
||||
$process = Start-Process (Join-Path $destination $name) -ArgumentList '--version' -PassThru -Wait
|
||||
if ($process.ExitCode -ne 0) { throw "The installed $name cannot start." }
|
||||
}
|
||||
$helper = Join-Path $destination 'gp-posture.exe'
|
||||
$output = Join-Path $env:TEMP 'gp-posture-install-test.json'
|
||||
$process = Start-Process $helper -PassThru -Wait -RedirectStandardOutput $output
|
||||
if ($process.ExitCode -ne 0) { throw 'The installed posture helper failed.' }
|
||||
$report = Get-Content $output -Raw | ConvertFrom-Json
|
||||
if ($null -eq $report.anti_malware -or $null -eq $report.firewall) { throw 'Invalid posture helper output.' }
|
||||
Remove-Item $output
|
||||
$state = Join-Path $env:LOCALAPPDATA 'GP Connect\config\protected-state'
|
||||
New-Item -ItemType Directory -Force $state | Out-Null
|
||||
$marker = Join-Path $state 'ci-install-retention'
|
||||
|
||||
Reference in new issue
Block a user