mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
134 lines
5.9 KiB
YAML
134 lines
5.9 KiB
YAML
name: Windows Build
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-2019
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: [x64, win32]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python (for gen + embedded)
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.14.2"
|
|
architecture: ${{ matrix.platform == 'win32' && 'x86' || 'x64' }}
|
|
|
|
- name: Install GTK bundle
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$plat = "${{ matrix.platform }}"
|
|
$gtkBuildRoot = "C:\gtk-build"
|
|
$gtkLinkRoot = Join-Path $gtkBuildRoot "gtk"
|
|
$pyLinkRoot = Join-Path $gtkBuildRoot "python-3.14"
|
|
|
|
New-Item -ItemType Directory -Force -Path $gtkBuildRoot | Out-Null
|
|
|
|
# Python junction expected by the VS projects
|
|
$pyActual = $env:pythonLocation
|
|
$pyTarget = Join-Path $pyLinkRoot $plat
|
|
if (Test-Path $pyTarget) { cmd /c rmdir $pyTarget | Out-Null }
|
|
cmd /c mklink /J "$pyTarget" "$pyActual" | Out-Null
|
|
|
|
if ($plat -eq "x64") {
|
|
# Pull latest GTK3 x64 bundle from wingtk/gvsbuild releases via GitHub API
|
|
$rel = Invoke-RestMethod "https://api.github.com/repos/wingtk/gvsbuild/releases/latest"
|
|
$asset = $rel.assets | Where-Object { $_.name -match '^GTK3_Gvsbuild_.*_x64\.zip$' } | Select-Object -First 1
|
|
if (-not $asset) { throw "No GTK3 x64 bundle found in latest wingtk/gvsbuild release." }
|
|
|
|
$zip = Join-Path $env:RUNNER_TEMP $asset.name
|
|
Invoke-WebRequest $asset.browser_download_url -OutFile $zip
|
|
|
|
$extract = "C:\gtk-bundle"
|
|
if (Test-Path $extract) { Remove-Item -Recurse -Force $extract }
|
|
New-Item -ItemType Directory -Force -Path $extract | Out-Null
|
|
Expand-Archive -Force $zip -DestinationPath $extract
|
|
|
|
# Find the *release* prefix that actually contains bin/include/lib
|
|
$prefix = Get-ChildItem -Path $extract -Directory -Recurse |
|
|
Where-Object {
|
|
(Test-Path (Join-Path $_.FullName "bin")) -and
|
|
(Test-Path (Join-Path $_.FullName "include")) -and
|
|
(Test-Path (Join-Path $_.FullName "lib"))
|
|
} |
|
|
Where-Object { $_.FullName -match '\\x64\\release$' } |
|
|
Select-Object -First 1
|
|
|
|
if (-not $prefix) {
|
|
# fallback: first directory containing gtk-3.0.lib
|
|
$lib = Get-ChildItem -Path $extract -File -Recurse -Filter "gtk-3.0.lib" | Select-Object -First 1
|
|
if (-not $lib) { throw "Could not locate gtk-3.0.lib inside extracted GTK bundle." }
|
|
$prefix = $lib.Directory.Parent
|
|
}
|
|
|
|
$depsRoot = Join-Path $gtkLinkRoot "$plat\release"
|
|
if (Test-Path $depsRoot) { cmd /c rmdir $depsRoot | Out-Null }
|
|
New-Item -ItemType Directory -Force -Path (Split-Path $depsRoot) | Out-Null
|
|
cmd /c mklink /J "$depsRoot" "$($prefix.FullName)" | Out-Null
|
|
|
|
# Make sure bin is on PATH for any custom tools
|
|
echo "$depsRoot\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
|
|
|
|
# Optional compat aliases (only if something still hardcodes GTK2/OpenSSL/libxml2 names)
|
|
$libDir = Join-Path $depsRoot "lib"
|
|
if (-not (Test-Path (Join-Path $libDir "gtk-win32-2.0.lib")) -and (Test-Path (Join-Path $libDir "gtk-3.0.lib"))) {
|
|
Copy-Item (Join-Path $libDir "gtk-3.0.lib") (Join-Path $libDir "gtk-win32-2.0.lib")
|
|
}
|
|
if (-not (Test-Path (Join-Path $libDir "gdk-win32-2.0.lib")) -and (Test-Path (Join-Path $libDir "gdk-3.0.lib"))) {
|
|
Copy-Item (Join-Path $libDir "gdk-3.0.lib") (Join-Path $libDir "gdk-win32-2.0.lib")
|
|
}
|
|
if (-not (Test-Path (Join-Path $libDir "libxml2.lib")) -and (Test-Path (Join-Path $libDir "libxml2-2.0.lib"))) {
|
|
Copy-Item (Join-Path $libDir "libxml2-2.0.lib") (Join-Path $libDir "libxml2.lib")
|
|
}
|
|
if (-not (Test-Path (Join-Path $libDir "ssleay32.lib")) -and (Test-Path (Join-Path $libDir "libssl.lib"))) {
|
|
Copy-Item (Join-Path $libDir "libssl.lib") (Join-Path $libDir "ssleay32.lib")
|
|
}
|
|
if (-not (Test-Path (Join-Path $libDir "libeay32.lib")) -and (Test-Path (Join-Path $libDir "libcrypto.lib"))) {
|
|
Copy-Item (Join-Path $libDir "libcrypto.lib") (Join-Path $libDir "libeay32.lib")
|
|
}
|
|
|
|
# Lua headers: if deps prefix doesn't ship them, copy from repo if present
|
|
$luaDst = Join-Path $depsRoot "include\luajit-2.1"
|
|
if (-not (Test-Path (Join-Path $luaDst "lua.h"))) {
|
|
$luaSrc = Join-Path $env:GITHUB_WORKSPACE "plugins\lua\luajit\src"
|
|
if (Test-Path (Join-Path $luaSrc "lua.h")) {
|
|
New-Item -ItemType Directory -Force -Path $luaDst | Out-Null
|
|
Copy-Item (Join-Path $luaSrc "*.h") $luaDst -Force
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
# win32: keep your existing GTK2 path/tooling here
|
|
# (Pin whatever you were already using for x86 builds.)
|
|
Write-Host "win32 build: keeping GTK2 toolchain (GTK3 x86 not available in latest wingtk/gvsbuild)."
|
|
}
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: |
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "PLAT=${{ matrix.platform }}"
|
|
set "PYTHON_DIR=C:\gtk-build\python-3.14\%PLAT%"
|
|
|
|
if not exist "%PYTHON_DIR%\libs\python314.lib" (
|
|
echo Missing %PYTHON_DIR%\libs\python314.lib
|
|
dir "%PYTHON_DIR%\libs"
|
|
exit /b 1
|
|
)
|
|
|
|
set "LIB=%PYTHON_DIR%\libs;%LIB%"
|
|
set "INCLUDE=%PYTHON_DIR%\include;%INCLUDE%"
|
|
|
|
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=%PLAT%
|