mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Fix transitive extension dependency not enabled bug
This commit is contained in:
parent
32bb0aadce
commit
13ab3e2b6c
@ -216,14 +216,21 @@ class php extends TargetPackage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark transitive PHP extension dependencies of static extensions as static too
|
// Mark transitive PHP extension dependencies of static/shared extensions as static too.
|
||||||
if (!empty($static_extensions)) {
|
// For static extensions: their ext deps must also be static.
|
||||||
$static_ext_pkgs = array_map(fn ($x) => "ext-{$x}", $static_extensions);
|
// For shared extensions: their ext deps that are not themselves shared must be compiled
|
||||||
$transitive_deps = DependencyResolver::resolve($static_ext_pkgs, include_suggests: (bool) $package->getBuildOption('with-suggests', false));
|
// into the static PHP build so their headers and symbols are available when linking the .so.
|
||||||
|
$all_input_ext_pkgs = array_map(fn ($x) => "ext-{$x}", array_values(array_unique([...$static_extensions, ...$shared_extensions])));
|
||||||
|
if (!empty($all_input_ext_pkgs)) {
|
||||||
|
$transitive_deps = DependencyResolver::resolve($all_input_ext_pkgs, include_suggests: (bool) $package->getBuildOption('with-suggests', false));
|
||||||
foreach ($transitive_deps as $dep_name) {
|
foreach ($transitive_deps as $dep_name) {
|
||||||
if (!str_starts_with($dep_name, 'ext-') || !PackageLoader::hasPackage($dep_name)) {
|
if (!str_starts_with($dep_name, 'ext-') || !PackageLoader::hasPackage($dep_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$dep_extname = substr($dep_name, 4);
|
||||||
|
if (in_array($dep_extname, $shared_extensions)) {
|
||||||
|
continue; // already designated as shared
|
||||||
|
}
|
||||||
$dep_instance = PackageLoader::getPackage($dep_name);
|
$dep_instance = PackageLoader::getPackage($dep_name);
|
||||||
if (!$dep_instance instanceof PhpExtensionPackage || $dep_instance->isBuildStatic() || $dep_instance->isBuildShared()) {
|
if (!$dep_instance instanceof PhpExtensionPackage || $dep_instance->isBuildStatic() || $dep_instance->isBuildShared()) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user