runtime object patch for shared extensions

This commit is contained in:
DubbleClick
2025-06-25 14:32:00 +07:00
parent 55f01149e4
commit 9a3a536479
4 changed files with 17 additions and 1 deletions

View File

@@ -215,7 +215,16 @@ class Extension
*/
public function patchBeforeSharedMake(): bool
{
return false;
if (!str_contains(getenv('CC'), 'zig')) {
return false;
}
$extra = getenv('ZIG_SHARED_EXTENSION_EXTRA_OBJECTS');
FileSystem::replaceFileRegex(
$this->source_dir . '/Makefile',
"/^(shared_objects_{$this->getName()}\s*=.*)$/m",
"$1 {$extra}",
);
return true;
}
/**