From 48fb8e1194aca3ed1a1146033ca3f16e4c855488 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 17 Oct 2022 18:00:08 +0530 Subject: [PATCH] Add debug symbols support to Windows --- src/scripts/win32.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index e6bf3fd8..b6db26db 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -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"