Add debug symbols support to Windows

This commit is contained in:
Shivam Mathur 2022-10-17 18:00:08 +05:30
parent bbc6e9069b
commit 48fb8e1194
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -229,6 +229,20 @@ Function Set-PhpCache {
} catch { }
}
# Function to add debug symbols to PHP.
Function Add-DebugSymbols {
$release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version
$dev = if ($version -match $nightly_versions) { '-dev' } else { '' }
$asset = $release.assets | ForEach-Object {
if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
return $_.name
}
}
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir
}
# Function to install nightly version of PHP
Function Install-PhpNightly {
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
@ -351,6 +365,10 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
Add-PhpConfig
}
if($env:DEBUG -eq 'true') {
Add-DebugSymbols
}
$installed = Get-Php -Path $php_dir
if($installed.MajorMinorVersion -ne $version) {
Add-Log $cross "PHP" "Could not setup PHP $version"