add extra runtime objects for shared libraries built directly by php make too

This commit is contained in:
DubbleClick
2025-07-19 15:10:42 +07:00
parent fff23649cf
commit 01887d652c
13 changed files with 36 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ use SPC\store\FileSystem;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
class Extension
{
@@ -187,6 +188,19 @@ class Extension
*/
public function patchBeforeMake(): bool
{
if (
PHP_OS_FAMILY === 'Linux' &&
$this->isBuildShared() &&
ToolchainManager::getToolchainClass() === ZigToolchain::class &&
($extra = (new ZigToolchain())->getExtraRuntimeObjects())
) {
FileSystem::replaceFileRegex(
$this->source_dir . '/Makefile',
"/^(shared_objects_{$this->getName()}\\s*=.*)$/m",
"$1 {$extra}",
);
return true;
}
return false;
}