mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
Setup MSYS2 for GTK build fallback
Added MSYS2 setup step for GTK build fallback in GitHub Actions workflow.
This commit is contained in:
committed by
GitHub
parent
2da635c048
commit
ffe8a9f7a6
379
.github/workflows/windows-build.yml
vendored
379
.github/workflows/windows-build.yml
vendored
@@ -32,6 +32,18 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# MSYS2 is required for the gvsbuild-from-source fallback path.
|
||||
- name: Setup MSYS2 (for GTK build fallback)
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msys2-location: C:\tools\msys64
|
||||
update: true
|
||||
install: >-
|
||||
base-devel
|
||||
git
|
||||
unzip
|
||||
p7zip
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.14.2"
|
||||
@@ -63,63 +75,33 @@ jobs:
|
||||
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/perl-5.20.0-${{ matrix.arch }}.7z -OutFile deps\perl-${{ matrix.arch }}.7z
|
||||
& 7z.exe x deps\perl-${{ matrix.arch }}.7z -oC:\gtk-build\perl-5.20\${{ matrix.platform }} | Out-Null
|
||||
|
||||
# ------------------------------------------
|
||||
# GTK: download wingtk/gvsbuild GTK3 bundle and normalize into:
|
||||
# C:\gtk-build\gtk\<platform>\release\{bin,include,lib}
|
||||
# ------------------------------------------
|
||||
$wantArch = if ("${{ matrix.platform }}" -eq "x64") { "x64" } else { "x86" }
|
||||
$wantPlat = "${{ matrix.platform }}"
|
||||
# Discover perl.exe and persist its bin dir.
|
||||
$perlExe = Get-ChildItem -Path "C:\gtk-build\perl-5.20\${{ matrix.platform }}" -Recurse -File -Filter "perl.exe" | Select-Object -First 1
|
||||
if (-not $perlExe) { throw "perl.exe not found under C:\gtk-build\perl-5.20\${{ matrix.platform }}" }
|
||||
"PERL_BIN=$($perlExe.Directory.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||
|
||||
$extractRoot = "C:\_gtk_extract"
|
||||
if (Test-Path $extractRoot) { Remove-Item $extractRoot -Recurse -Force }
|
||||
New-Item -Path $extractRoot -ItemType Directory -Force | Out-Null
|
||||
function Find-GtkPrefix([string]$root) {
|
||||
$gtkH = Get-ChildItem -Path $root -Recurse -File -Filter "gtk.h" |
|
||||
Where-Object { $_.FullName -match '\\include\\gtk-3\.0\\gtk\\gtk\.h$' } |
|
||||
Select-Object -First 1
|
||||
if (-not $gtkH) { return $null }
|
||||
return $gtkH.Directory.Parent.Parent.Parent.FullName # ...\include\gtk-3.0\gtk\gtk.h -> prefix
|
||||
}
|
||||
|
||||
function Get-PEMachine([string]$path) {
|
||||
try {
|
||||
$fs = [System.IO.File]::Open($path, 'Open', 'Read', 'ReadWrite')
|
||||
try {
|
||||
$br = New-Object System.IO.BinaryReader($fs)
|
||||
$mz = $br.ReadUInt16()
|
||||
if ($mz -ne 0x5A4D) { return $null } # MZ
|
||||
$fs.Seek(0x3C, [System.IO.SeekOrigin]::Begin) | Out-Null
|
||||
$peOff = $br.ReadUInt32()
|
||||
$fs.Seek($peOff, [System.IO.SeekOrigin]::Begin) | Out-Null
|
||||
$peSig = $br.ReadUInt32()
|
||||
if ($peSig -ne 0x00004550) { return $null } # PE\0\0
|
||||
$machine = $br.ReadUInt16()
|
||||
return $machine
|
||||
} finally {
|
||||
$fs.Close()
|
||||
}
|
||||
} catch {
|
||||
return $null
|
||||
function Ensure-Junction([string]$linkPath, [string]$targetPath) {
|
||||
if (Test-Path $linkPath) {
|
||||
cmd /c rmdir /s /q "$linkPath" | Out-Null
|
||||
}
|
||||
New-Item -Path $linkPath -ItemType Junction -Value $targetPath | Out-Null
|
||||
}
|
||||
|
||||
function Ensure-Dir([string]$p) {
|
||||
if (-not (Test-Path $p)) { New-Item -Path $p -ItemType Directory -Force | Out-Null }
|
||||
}
|
||||
|
||||
function Pick-GtkPrefix([string]$root) {
|
||||
$libs = Get-ChildItem -Path $root -Recurse -File -Filter "*.lib" -ErrorAction SilentlyContinue
|
||||
$preferred = @('^gtk-3\.0\.lib$', '^gtk-3-0\.lib$', '^gtk-3\.lib$')
|
||||
foreach ($rx in $preferred) {
|
||||
$cand = $libs | Where-Object { $_.Name -match $rx } | Select-Object -First 1
|
||||
if ($cand) { return (Split-Path -Parent $cand.Directory.FullName) }
|
||||
}
|
||||
$cand2 = $libs | Where-Object { $_.Name -match '^gtk-3.*\.lib$' } | Select-Object -First 1
|
||||
if ($cand2) { return (Split-Path -Parent $cand2.Directory.FullName) }
|
||||
return $null
|
||||
}
|
||||
|
||||
function Copy-AliasLib([string]$gtkLibDir, [string]$targetName, [string[]]$sourceNameRegexes) {
|
||||
$target = Join-Path $gtkLibDir $targetName
|
||||
function Copy-AliasLib([string]$libDir, [string]$targetName, [string[]]$sourcePatterns) {
|
||||
$target = Join-Path $libDir $targetName
|
||||
if (Test-Path $target) { return }
|
||||
|
||||
$allLibs = Get-ChildItem -Path $gtkLibDir -File -Filter "*.lib" -ErrorAction SilentlyContinue
|
||||
$src = $null
|
||||
foreach ($rx in $sourceNameRegexes) {
|
||||
$src = $allLibs | Where-Object { $_.Name -match $rx } | Select-Object -First 1
|
||||
foreach ($pat in $sourcePatterns) {
|
||||
$src = Get-ChildItem -Path $libDir -File -Filter "*.lib" | Where-Object { $_.Name -match $pat } | Select-Object -First 1
|
||||
if ($src) { break }
|
||||
}
|
||||
|
||||
@@ -127,97 +109,97 @@ jobs:
|
||||
Copy-Item $src.FullName $target -Force
|
||||
Write-Host "Alias: $targetName <= $($src.Name)"
|
||||
} else {
|
||||
Write-Host "Alias not created: $targetName (no match in $gtkLibDir)"
|
||||
Write-Host "Alias not created: $targetName (no match in $libDir)"
|
||||
}
|
||||
}
|
||||
|
||||
function Ensure-GenmarshalReady([string]$gtkBinDir, [string]$gtkPrefix, [string]$wantPlat) {
|
||||
Ensure-Dir $gtkBinDir
|
||||
function Ensure-GlibGenmarshalWrapper([string]$gtkBin) {
|
||||
$wrapperPath = Join-Path $gtkBin "glib-genmarshal"
|
||||
$exePath = Join-Path $gtkBin "glib-genmarshal.exe"
|
||||
|
||||
$wantMachine = if ($wantPlat -eq "x64") { 0x8664 } else { 0x014c }
|
||||
# If a non-exe tool exists, move it aside so our wrapper name is stable.
|
||||
$realPath = Join-Path $gtkBin "glib-genmarshal.real"
|
||||
if (Test-Path $realPath) { Remove-Item $realPath -Force }
|
||||
|
||||
$binScript = Join-Path $gtkBinDir "glib-genmarshal"
|
||||
$binExe = Join-Path $gtkBinDir "glib-genmarshal.exe"
|
||||
|
||||
# 1) If we already have glib-genmarshal (no extension) in bin, prefer it.
|
||||
if (Test-Path $binScript) {
|
||||
$m = Get-PEMachine $binScript
|
||||
if ($m) {
|
||||
# It's a PE binary without .exe. Make an .exe copy for subprocess callers, and keep python wrapper.
|
||||
if ($m -ne $wantMachine) {
|
||||
throw "glib-genmarshal in bin is PE but wrong arch (machine=0x{0:X})." -f $m
|
||||
}
|
||||
Copy-Item $binScript $binExe -Force
|
||||
$wrapperLines = @(
|
||||
"import os, subprocess, sys",
|
||||
"tool = os.path.join(os.path.dirname(__file__), 'glib-genmarshal.exe')",
|
||||
"sys.exit(subprocess.call([tool] + sys.argv[1:]))"
|
||||
)
|
||||
$wrapperLines | Set-Content -Path $binScript -Encoding ASCII
|
||||
return
|
||||
if (Test-Path $wrapperPath) {
|
||||
# If it's already our wrapper, keep it. Otherwise move to .real.
|
||||
$first = (Get-Content -Path $wrapperPath -TotalCount 1 -ErrorAction SilentlyContinue)
|
||||
if ($first -notmatch 'import os') {
|
||||
Move-Item $wrapperPath $realPath -Force
|
||||
}
|
||||
}
|
||||
|
||||
# Not PE: likely a script. If it's python-ish, we're done because vcxproj calls python.exe <script>.
|
||||
$head = Get-Content -Path $binScript -TotalCount 5 -ErrorAction SilentlyContinue
|
||||
$headText = ($head -join "`n")
|
||||
$looksPython =
|
||||
($headText -match 'python') -or
|
||||
($headText -match '^\s*#!') -or
|
||||
($headText -match '^\s*import\s+') -or
|
||||
($headText -match '^\s*from\s+\w+\s+import\s+')
|
||||
|
||||
if ($looksPython) {
|
||||
Write-Host "glib-genmarshal in bin looks like a script; using it as-is."
|
||||
return
|
||||
# If no exe and no real tool, search for any glib-genmarshal* in bin and use that.
|
||||
if (-not (Test-Path $exePath) -and -not (Test-Path $realPath)) {
|
||||
$cand = Get-ChildItem -Path $gtkBin -File -Filter "glib-genmarshal*" | Select-Object -First 1
|
||||
if ($cand) {
|
||||
Move-Item $cand.FullName $realPath -Force
|
||||
}
|
||||
|
||||
throw "Found glib-genmarshal in bin, but it does not look like a PE or a Python script. Cannot run it via python.exe."
|
||||
}
|
||||
|
||||
# 2) Otherwise, search under prefix for .exe OR script and copy into bin.
|
||||
$exeCands = Get-ChildItem -Path $gtkPrefix -Recurse -File -Filter "glib-genmarshal*.exe" -ErrorAction SilentlyContinue
|
||||
if ($exeCands -and $exeCands.Count -gt 0) {
|
||||
$picked = $null
|
||||
foreach ($c in $exeCands) {
|
||||
$m = Get-PEMachine $c.FullName
|
||||
if ($m -eq $wantMachine) { $picked = $c; break }
|
||||
}
|
||||
if (-not $picked) { $picked = $exeCands | Select-Object -First 1 }
|
||||
Copy-Item $picked.FullName $binExe -Force
|
||||
|
||||
$wrapperLines = @(
|
||||
"import os, subprocess, sys",
|
||||
"tool = os.path.join(os.path.dirname(__file__), 'glib-genmarshal.exe')",
|
||||
"sys.exit(subprocess.call([tool] + sys.argv[1:]))"
|
||||
)
|
||||
$wrapperLines | Set-Content -Path $binScript -Encoding ASCII
|
||||
return
|
||||
if (-not (Test-Path $exePath) -and -not (Test-Path $realPath)) {
|
||||
throw "GTK3 prefix present, but no glib-genmarshal tool found under $gtkBin"
|
||||
}
|
||||
|
||||
$scriptCands = Get-ChildItem -Path $gtkPrefix -Recurse -File -Filter "glib-genmarshal" -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -notmatch '\\\.git\\' } |
|
||||
Select-Object -First 1
|
||||
|
||||
if ($scriptCands) {
|
||||
Copy-Item $scriptCands.FullName $binScript -Force
|
||||
Write-Host "Copied glib-genmarshal script to bin: $($scriptCands.FullName)"
|
||||
return
|
||||
}
|
||||
|
||||
# If we got here, nothing usable exists.
|
||||
$nonExe = Get-ChildItem -Path $gtkPrefix -Recurse -File -Filter "glib-genmarshal*" -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Extension -notin @(".exe",".pdb",".txt") } |
|
||||
Select-Object -First 20
|
||||
|
||||
if ($nonExe) {
|
||||
Write-Host "Found non-.exe glib-genmarshal candidates:"
|
||||
$nonExe | ForEach-Object { Write-Host " - $($_.FullName)" }
|
||||
}
|
||||
|
||||
throw "GTK3 bundle extracted, but no usable glib-genmarshal was found under detected GTK prefix: $gtkPrefix"
|
||||
# Write a python wrapper that dispatches to:
|
||||
# - glib-genmarshal.exe if present
|
||||
# - otherwise glib-genmarshal.real (perl or python script)
|
||||
$wrapper = @(
|
||||
"import os, subprocess, sys",
|
||||
"base = os.path.dirname(__file__)",
|
||||
"exe = os.path.join(base, 'glib-genmarshal.exe')",
|
||||
"real = os.path.join(base, 'glib-genmarshal.real')",
|
||||
"tool = exe if os.path.exists(exe) else real",
|
||||
"if not os.path.exists(tool):",
|
||||
" sys.stderr.write('glib-genmarshal tool not found\\n')",
|
||||
" sys.exit(1)",
|
||||
"if tool.lower().endswith('.exe'):",
|
||||
" sys.exit(subprocess.call([tool] + sys.argv[1:]))",
|
||||
"first = b''",
|
||||
"try:",
|
||||
" with open(tool, 'rb') as f: first = f.readline().lower()",
|
||||
"except Exception:",
|
||||
" pass",
|
||||
"if b'perl' in first:",
|
||||
" sys.exit(subprocess.call(['perl', tool] + sys.argv[1:]))",
|
||||
"sys.exit(subprocess.call([sys.executable, tool] + sys.argv[1:]))"
|
||||
)
|
||||
$wrapper | Set-Content -Path $wrapperPath -Encoding ASCII
|
||||
}
|
||||
|
||||
function Ensure-LuaHeaders([string]$gtkInc) {
|
||||
# Provide <lua.h> et al for the lua plugin build.
|
||||
$zip = "deps\luajit-v2.1.zip"
|
||||
$dst = "deps\luajit-src"
|
||||
if (-not (Test-Path $dst)) { New-Item -Path $dst -ItemType Directory -Force | Out-Null }
|
||||
|
||||
Invoke-WebRequest https://github.com/LuaJIT/LuaJIT/archive/refs/heads/v2.1.zip -OutFile $zip
|
||||
Expand-Archive -Force $zip -DestinationPath $dst
|
||||
|
||||
$srcDir = Get-ChildItem -Path $dst -Directory | Select-Object -First 1
|
||||
if (-not $srcDir) { throw "LuaJIT source zip extracted, but no top directory found." }
|
||||
|
||||
$hdrRoot = Join-Path $srcDir.FullName "src"
|
||||
foreach ($h in @("lua.h", "lualib.h", "lauxlib.h", "luaconf.h")) {
|
||||
$p = Join-Path $hdrRoot $h
|
||||
if (-not (Test-Path $p)) { throw "LuaJIT header missing: $p" }
|
||||
Copy-Item $p (Join-Path $gtkInc $h) -Force
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------
|
||||
# GTK: Prefer prebuilt wingtk/gvsbuild GTK3 bundles.
|
||||
# If missing for x86 (win32), build GTK3 via gvsbuild from source.
|
||||
# ------------------------------------------
|
||||
$wantArch = if ("${{ matrix.platform }}" -eq "x64") { "x64" } else { "x86" } # gvsbuild uses x64/x86
|
||||
$wantPlat = "${{ matrix.platform }}" # solution uses x64/win32
|
||||
|
||||
$extractRoot = "C:\_gtk_extract"
|
||||
if (Test-Path $extractRoot) { Remove-Item $extractRoot -Recurse -Force }
|
||||
New-Item -Path $extractRoot -ItemType Directory -Force | Out-Null
|
||||
|
||||
$gtkPrefix = $null
|
||||
|
||||
$headers = @{
|
||||
"User-Agent" = "zoitechat-ci"
|
||||
"Authorization" = "Bearer $env:GITHUB_TOKEN"
|
||||
@@ -227,72 +209,105 @@ jobs:
|
||||
try {
|
||||
$release = Invoke-RestMethod -Headers $headers -Uri "https://api.github.com/repos/wingtk/gvsbuild/releases/latest"
|
||||
|
||||
# Try a couple of patterns in case naming shifts slightly.
|
||||
$asset = $release.assets |
|
||||
Where-Object { $_.name -imatch '^GTK3_Gvsbuild_.*_(x64|x86)\.zip$' -and $_.name -imatch "_$wantArch\.zip$" } |
|
||||
Where-Object {
|
||||
($_.name -match '^GTK3_Gvsbuild_.*_(x64|x86)\.zip$' -or $_.name -match '(?i)gtk3.*(x64|x86)\.zip$') -and
|
||||
$_.name -match "_$wantArch\.zip$"
|
||||
} |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $asset) {
|
||||
Write-Host "Available assets:"
|
||||
$release.assets | ForEach-Object { Write-Host " - $($_.name)" }
|
||||
throw "Could not find a GTK3 $wantArch zip in wingtk/gvsbuild latest release."
|
||||
}
|
||||
if ($asset) {
|
||||
$bundlePath = "deps\gtk3-$wantArch-bundle.zip"
|
||||
Invoke-WebRequest $asset.browser_download_url -OutFile $bundlePath
|
||||
Expand-Archive -Force $bundlePath -DestinationPath $extractRoot
|
||||
|
||||
$bundlePath = "deps\gtk3-$wantArch-bundle.zip"
|
||||
Invoke-WebRequest $asset.browser_download_url -OutFile $bundlePath
|
||||
Expand-Archive -Force $bundlePath -DestinationPath $extractRoot
|
||||
$gtkPrefix = Find-GtkPrefix $extractRoot
|
||||
if (-not $gtkPrefix) { throw "GTK3 bundle extracted, but gtk.h not found. Layout unexpected." }
|
||||
|
||||
$gtkPrefix = Pick-GtkPrefix -root $extractRoot
|
||||
if (-not $gtkPrefix) {
|
||||
throw "GTK3 bundle extracted, but could not locate any gtk-3*.lib to determine prefix."
|
||||
}
|
||||
|
||||
Write-Host "Detected GTK prefix: $gtkPrefix"
|
||||
} catch {
|
||||
if ($wantArch -eq "x86") {
|
||||
Write-Host "Wingtk GTK3 discovery failed for win32 (x86). Falling back to legacy GTK bundle."
|
||||
$gtkPrefix = $null
|
||||
Write-Host "Detected GTK prefix: $gtkPrefix"
|
||||
} else {
|
||||
throw
|
||||
Write-Host "No prebuilt GTK3 bundle found for $wantArch. Will build GTK3 from source via gvsbuild."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Prebuilt GTK3 discovery failed: $($_.Exception.Message)"
|
||||
Write-Host "Will build GTK3 from source via gvsbuild."
|
||||
}
|
||||
|
||||
if (-not $gtkPrefix) {
|
||||
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/gtk-${{ matrix.platform }}-2018-08-29-openssl1.1.7z -OutFile deps\gtk-${{ matrix.platform }}.7z
|
||||
Ensure-Dir "C:\gtk-build\gtk"
|
||||
& 7z.exe x deps\gtk-${{ matrix.platform }}.7z -oC:\gtk-build\gtk | Out-Null
|
||||
} else {
|
||||
$normBase = "C:\gtk-build\gtk\$wantPlat"
|
||||
Ensure-Dir $normBase
|
||||
# Build GTK3 via gvsbuild (VS2019) as a fallback.
|
||||
$gvsDir = "C:\gtk-build\github\gvsbuild"
|
||||
if (-not (Test-Path $gvsDir)) {
|
||||
New-Item -Path "C:\gtk-build\github" -ItemType Directory -Force | Out-Null
|
||||
git clone --depth 1 https://github.com/wingtk/gvsbuild.git $gvsDir
|
||||
}
|
||||
|
||||
$normRel = Join-Path $normBase "release"
|
||||
if (Test-Path $normRel) { cmd /c rmdir /s /q "$normRel" | Out-Null }
|
||||
New-Item -Path $normRel -ItemType Junction -Value $gtkPrefix | Out-Null
|
||||
Push-Location $gvsDir
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r requirements.txt
|
||||
|
||||
$gtkBin = Join-Path $normRel "bin"
|
||||
$gtkLib = Join-Path $normRel "lib"
|
||||
$gtkInc = Join-Path $normRel "include"
|
||||
Ensure-Dir $gtkBin
|
||||
Ensure-Dir $gtkLib
|
||||
Ensure-Dir $gtkInc
|
||||
# Build GTK3 (3.24) for VS2019 (16), using MSYS2.
|
||||
python .\build.py build -p=$wantArch --vs-ver=16 --msys-dir=C:\tools\msys64 --gtk3-ver=3.24 -c=release gtk3
|
||||
Pop-Location
|
||||
|
||||
Ensure-GenmarshalReady -gtkBinDir $gtkBin -gtkPrefix $gtkPrefix -wantPlat $wantPlat
|
||||
|
||||
Copy-AliasLib $gtkLib "gtk-win32-2.0.lib" @(
|
||||
'^gtk-3\.0\.lib$',
|
||||
'^gtk-3-0\.lib$',
|
||||
'^gtk-3\.lib$',
|
||||
'^gtk-3.*\.lib$'
|
||||
)
|
||||
|
||||
Copy-AliasLib $gtkLib "ssleay32.lib" @('^libssl\.lib$', '^ssl\.lib$')
|
||||
Copy-AliasLib $gtkLib "libeay32.lib" @('^libcrypto\.lib$', '^crypto\.lib$')
|
||||
Copy-AliasLib $gtkLib "libxml2.lib" @('^libxml2\.lib$', '^libxml2-2\.0\.lib$', '^libxml2.*\.lib$')
|
||||
$gtkPrefix = "C:\gtk-build\gtk\$wantArch\release"
|
||||
if (-not (Test-Path (Join-Path $gtkPrefix "include\gtk-3.0\gtk\gtk.h"))) {
|
||||
throw "gvsbuild finished, but expected GTK headers were not found under $gtkPrefix"
|
||||
}
|
||||
}
|
||||
|
||||
# Normalize GTK location to the path your solution expects:
|
||||
# C:\gtk-build\gtk\<platform>\release\...
|
||||
$normBase = "C:\gtk-build\gtk\$wantPlat"
|
||||
New-Item -Path $normBase -ItemType Directory -Force | Out-Null
|
||||
$normRel = Join-Path $normBase "release"
|
||||
Ensure-Junction $normRel $gtkPrefix
|
||||
|
||||
$gtkBin = Join-Path $normRel "bin"
|
||||
$gtkLib = Join-Path $normRel "lib"
|
||||
$gtkInc = Join-Path $normRel "include"
|
||||
|
||||
if (-not (Test-Path $gtkBin)) { throw "GTK bin dir missing at $gtkBin" }
|
||||
if (-not (Test-Path $gtkLib)) { throw "GTK lib dir missing at $gtkLib" }
|
||||
if (-not (Test-Path $gtkInc)) { throw "GTK include dir missing at $gtkInc" }
|
||||
|
||||
# glib-genmarshal: vcxproj calls python.exe <path>\glib-genmarshal (no extension).
|
||||
# Ensure we always have a python wrapper named glib-genmarshal in GTK\bin.
|
||||
Ensure-GlibGenmarshalWrapper $gtkBin
|
||||
|
||||
# Provide Lua headers for the lua plugin (lua.c includes <lua.h>).
|
||||
Ensure-LuaHeaders $gtkInc
|
||||
|
||||
# Compatibility aliases for differing .lib names across bundles.
|
||||
Copy-AliasLib $gtkLib "gtk-3.0.lib" @(
|
||||
'^gtk-3-0\.lib$',
|
||||
'^gtk-3\.lib$',
|
||||
'^gtk-3.*\.lib$',
|
||||
'^gtk-win32-2\.0\.lib$'
|
||||
)
|
||||
|
||||
Copy-AliasLib $gtkLib "gtk-win32-2.0.lib" @(
|
||||
'^gtk-3\.0\.lib$',
|
||||
'^gtk-3-0\.lib$',
|
||||
'^gtk-3\.lib$',
|
||||
'^gtk-3.*\.lib$'
|
||||
)
|
||||
|
||||
# OpenSSL legacy names (keep older projects happy if they still reference these)
|
||||
Copy-AliasLib $gtkLib "ssleay32.lib" @('^libssl\.lib$', '^ssl\.lib$')
|
||||
Copy-AliasLib $gtkLib "libeay32.lib" @('^libcrypto\.lib$', '^crypto\.lib$')
|
||||
|
||||
# libxml2 legacy name
|
||||
Copy-AliasLib $gtkLib "libxml2.lib" @('^libxml2.*\.lib$')
|
||||
|
||||
# Persist GTK root for later steps.
|
||||
"GTK_ROOT=$normRel" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||
|
||||
# Resolve python root from setup-python
|
||||
$pyRoot = $env:pythonLocation
|
||||
if (-not $pyRoot) { $pyRoot = & python -c "import sys; print(sys.prefix)" }
|
||||
|
||||
# Create BOTH paths because the .vcxproj hard-codes python-3.14\...
|
||||
foreach ($pyDir in @("C:\gtk-build\python-3.14.2", "C:\gtk-build\python-3.14")) {
|
||||
New-Item -Path $pyDir -ItemType Directory -Force | Out-Null
|
||||
$target = Join-Path $pyDir "${{ matrix.platform }}"
|
||||
@@ -308,25 +323,27 @@ jobs:
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
|
||||
|
||||
set "GTKROOT=C:\gtk-build\gtk\${{ matrix.platform }}\release"
|
||||
set "PYTHON_DIR=C:\gtk-build\python-3.14.2\${{ matrix.platform }}"
|
||||
set "GTKROOT=%GTK_ROOT%"
|
||||
if not exist "%GTKROOT%\include\gtk-3.0\gtk\gtk.h" (
|
||||
echo Missing GTK headers under %GTKROOT%
|
||||
dir "%GTKROOT%\include\gtk-3.0\gtk"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set "PATH=%PERL_BIN%;%GTKROOT%\bin;%PATH%"
|
||||
set "LIB=%GTKROOT%\lib;%LIB%"
|
||||
set "INCLUDE=%GTKROOT%\include;%INCLUDE%"
|
||||
|
||||
set "PYTHON_DIR=C:\gtk-build\python-3.14.2\${{ matrix.platform }}"
|
||||
if not exist "%PYTHON_DIR%\libs\python314.lib" (
|
||||
echo Missing %PYTHON_DIR%\libs\python314.lib
|
||||
dir "%PYTHON_DIR%\libs"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if exist "%GTKROOT%\include" set "INCLUDE=%GTKROOT%\include;%INCLUDE%"
|
||||
if exist "%GTKROOT%\lib" set "LIB=%GTKROOT%\lib;%LIB%"
|
||||
|
||||
set "LIB=%PYTHON_DIR%\libs;%LIB%"
|
||||
set "INCLUDE=%PYTHON_DIR%\include;%INCLUDE%"
|
||||
|
||||
rem Fix Lua plugin build: include LuaJIT headers from repo if present
|
||||
if exist "plugins\lua\luajit\src\lua.h" set "INCLUDE=%CD%\plugins\lua\luajit\src;%INCLUDE%"
|
||||
if exist "plugins\lua\luajit-2.1\src\lua.h" set "INCLUDE=%CD%\plugins\lua\luajit-2.1\src;%INCLUDE%"
|
||||
|
||||
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
|
||||
|
||||
- name: Preparing Artifacts
|
||||
|
||||
Reference in New Issue
Block a user