mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 10:25:36 +08:00
Add extra build flags for specific extensions
This commit is contained in:
@@ -22,7 +22,15 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
* Extensions excluded from specific OS matrix entries.
|
* Extensions excluded from specific OS matrix entries.
|
||||||
*/
|
*/
|
||||||
private const array OS_EXCLUDE = [
|
private const array OS_EXCLUDE = [
|
||||||
'linux' => ['ext-glfw'],
|
'linux' => ['glfw'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra build flags appended when a matrix entry contains any of the listed extensions.
|
||||||
|
* Key: extension display name (without ext- prefix). Value: extra flags string.
|
||||||
|
*/
|
||||||
|
private const array EXTRA_BUILD_FLAGS = [
|
||||||
|
'parallel' => '--enable-zts',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected bool $no_motd = true;
|
protected bool $no_motd = true;
|
||||||
@@ -59,7 +67,7 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
$os_key = $os_info['os_key'];
|
$os_key = $os_info['os_key'];
|
||||||
|
|
||||||
// Filter by OS support
|
// Filter by OS support
|
||||||
$os_exclude = array_fill_keys(self::OS_EXCLUDE[$os] ?? [], true);
|
$os_exclude = array_fill_keys(array_map(fn ($n) => 'ext-' . $n, self::OS_EXCLUDE[$os] ?? []), true);
|
||||||
$os_regular = array_filter($all_regular, fn ($c, $k) => $this->supportsOS($c, $os_key) && !isset($os_exclude[$k]), ARRAY_FILTER_USE_BOTH);
|
$os_regular = array_filter($all_regular, fn ($c, $k) => $this->supportsOS($c, $os_key) && !isset($os_exclude[$k]), ARRAY_FILTER_USE_BOTH);
|
||||||
$os_virtual = array_filter($all_virtual, fn ($c, $k) => $this->supportsOS($c, $os_key) && !isset($os_exclude[$k]), ARRAY_FILTER_USE_BOTH);
|
$os_virtual = array_filter($all_virtual, fn ($c, $k) => $this->supportsOS($c, $os_key) && !isset($os_exclude[$k]), ARRAY_FILTER_USE_BOTH);
|
||||||
|
|
||||||
@@ -128,12 +136,13 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
|
|
||||||
sort($groups);
|
sort($groups);
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
$extra = $this->extraBuildFlags($group);
|
||||||
$entries[] = [
|
$entries[] = [
|
||||||
'runner' => $os_info['runner'],
|
'runner' => $os_info['runner'],
|
||||||
'os' => $os,
|
'os' => $os,
|
||||||
'arch' => $os_info['arch'],
|
'arch' => $os_info['arch'],
|
||||||
'extension' => $group,
|
'extension' => $group,
|
||||||
'build-args' => '"' . $group . '" ' . self::BUILD_TARGETS,
|
'build-args' => '"' . $group . '" ' . self::BUILD_TARGETS . ($extra !== '' ? ' ' . $extra : ''),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +181,22 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
return str_starts_with($pkg_name, 'ext-') ? substr($pkg_name, 4) : $pkg_name;
|
return str_starts_with($pkg_name, 'ext-') ? substr($pkg_name, 4) : $pkg_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns any extra build flags required for an extension group string.
|
||||||
|
* Checks whether any extension in the comma-separated group matches EXTRA_BUILD_FLAGS.
|
||||||
|
*/
|
||||||
|
private function extraBuildFlags(string $group): string
|
||||||
|
{
|
||||||
|
$names = explode(',', $group);
|
||||||
|
$flags = [];
|
||||||
|
foreach (self::EXTRA_BUILD_FLAGS as $ext => $extra) {
|
||||||
|
if (in_array($ext, $names, true)) {
|
||||||
|
$flags[] = $extra;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode(' ', $flags);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the value of a platform-specific array field, applying the suffix fallback chain.
|
* Resolve the value of a platform-specific array field, applying the suffix fallback chain.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user