Compare commits

...
4 Commits
7 changed files with 44 additions and 13 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ describe('Config tests', () => {
${'xdebug'} | ${'7.4'} | ${'linux'} | ${'Xdebug $xdebug_version enabled as coverage driver'} ${'xdebug'} | ${'7.4'} | ${'linux'} | ${'Xdebug $xdebug_version enabled as coverage driver'}
${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'} ${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'}
${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'} ${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'}
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'} ${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2 zend_extension 2.9.8'}
${'xdebug2'} | ${'8.0'} | ${'darwin'} | ${'xdebug2 is not supported on PHP 8.0'} ${'xdebug2'} | ${'8.0'} | ${'darwin'} | ${'xdebug2 is not supported on PHP 8.0'}
${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'} ${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'}
${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'} ${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'}
+1
View File
@@ -107,6 +107,7 @@ describe('Extension tests', () => {
${'pecl_http'} | ${'7.3'} | ${'add_http'} ${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'relay-1.2.3'} | ${'7.4'} | ${'add_relay relay-1.2.3'} ${'relay-1.2.3'} | ${'7.4'} | ${'add_relay relay-1.2.3'}
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'} ${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
${'xdebug2'} | ${'7.4'} | ${'add_brew_extension xdebug2 zend_extension 2.9.8'}
${'zephir_parser-v1.2.3'} | ${'7.2'} | ${'add_zephir_parser zephir_parser-v1.2.3'} ${'zephir_parser-v1.2.3'} | ${'7.2'} | ${'add_zephir_parser zephir_parser-v1.2.3'}
`( `(
'checking addExtensionOnDarwin for extension $extension on version $version', 'checking addExtensionOnDarwin for extension $extension on version $version',
+1 -1
View File
File diff suppressed because one or more lines are too long
+9
View File
@@ -84,6 +84,15 @@ export async function addExtensionDarwin(
case /(5\.[3-6]|7\.0)pcov/.test(version_extension): case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin'); add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
return; return;
// match 7.2xdebug2 to 7.4xdebug2
case /^7\.[2-4]xdebug2$/.test(version_extension):
add_script += await utils.joins(
'\nadd_brew_extension',
'xdebug2',
ext_prefix,
'2.9.8'
);
return;
// match brew extensions // match brew extensions
case /(?<!5\.[3-5])(amqp|apcu|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|lua|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test( case /(?<!5\.[3-5])(amqp|apcu|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|lua|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test(
version_extension version_extension
+2 -1
View File
@@ -75,9 +75,10 @@ copy_brew_extensions() {
add_brew_extension() { add_brew_extension() {
formula=$1 formula=$1
prefix=$2 prefix=$2
expected_version=${3:-}
extension="$(get_extension_from_formula "$formula")" extension="$(get_extension_from_formula "$formula")"
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
if check_extension "$extension"; then if check_extension "$extension" && { [ -z "$expected_version" ] || check_extension_version "$extension" "$expected_version"; }; then
add_log "${tick:?}" "$extension" "Enabled" add_log "${tick:?}" "$extension" "Enabled"
else else
add_brew_tap "$php_tap" add_brew_tap "$php_tap"
+8 -1
View File
@@ -21,6 +21,13 @@ check_extension() {
fi fi
} }
# Function to test the loaded version of an extension.
check_extension_version() {
local extension=$1
local ext_version=$2
php -d display_errors=0 -r "exit(phpversion(\$argv[1]) === \$argv[2] ? 0 : 1);" -- "$extension" "$ext_version" >/dev/null 2>&1
}
# Function to check if extension is shared # Function to check if extension is shared
shared_extension() { shared_extension() {
[ -e "${ext_dir:?}/$1.so" ] [ -e "${ext_dir:?}/$1.so" ]
@@ -198,7 +205,7 @@ pecl_install() {
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1 yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
fi fi
local exit_code=$? local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension sudo pecl info "$extension" 2>/dev/null | grep -iq 'zend extension' && prefix=zend_extension
enable_extension "${extension%-*}" "$prefix" enable_extension "${extension%-*}" "$prefix"
return "$exit_code" return "$exit_code"
fi fi
+19 -6
View File
@@ -278,13 +278,23 @@ Function Add-PhpConfig {
Get-Content -Path $ini_files | Add-Content -Path $php_dir\php.ini Get-Content -Path $ini_files | Add-Content -Path $php_dir\php.ini
} }
# Function to get PHP from GitHub releases cache # Function to install PHP directly from the GitHub releases cache.
Function Set-PhpCache { Function Install-PhpFromCache {
try {
$asset = Get-PhpReleaseAsset -Type php $asset = Get-PhpReleaseAsset -Type php
Get-File -Url $php_builder/releases/download/php$version/$asset -FallbackUrl $php_windows/releases/archives/$asset -OutFile $php_dir\$asset $url = "$php_builder/releases/download/php$version/$asset"
Get-File -Url $url -FallbackUrl $php_windows/releases/archives/$asset -OutFile $php_dir\$asset
Set-PhpDownloadCache -Path $php_dir CurrentUser Set-PhpDownloadCache -Path $php_dir CurrentUser
} catch { } $php_manager = Get-Module PhpManager
& $php_manager {
param($url, $path)
$php_version = Get-PhpVersionFromUrl -Url $url -ReleaseState Release
Install-PhpFromUrl -Url $url -Path $path -PhpVersion $php_version -InstallVCRedist $true
} $url $php_dir
$ini_path = "$php_dir\php.ini"
Copy-Item -Path $php_dir\php.ini-production -Destination $ini_path -Force
Set-PhpIniKey -Key date.timezone -Value UTC -Path $ini_path
Set-PhpIniKey -Key default_charset -Value UTF-8 -Path $ini_path
Set-PhpIniKey -Key extension_dir -Value $ext_dir -Path $ini_path
} }
# Function to add debug symbols to PHP. # Function to add debug symbols to PHP.
@@ -415,9 +425,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
if ($version -match $nightly_versions) { if ($version -match $nightly_versions) {
$extra_version = Install-PhpNightly $extra_version = Install-PhpNightly
} else { } else {
Set-PhpCache try {
Install-PhpFromCache > $null 2>&1
} catch {
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni production -Force > $null 2>&1 Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni production -Force > $null 2>&1
} }
}
Add-PhpConfig Add-PhpConfig
} catch { } } catch { }
} else { } else {