Add ext-uv and libuv support on Windows

This commit is contained in:
crazywhalecc
2026-04-10 16:15:07 +08:00
parent db8520d8f0
commit 6ef012e204
3 changed files with 26 additions and 0 deletions

View File

@@ -24,6 +24,21 @@ class uv extends PhpExtensionPackage
}
}
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-uv')]
public function patchBeforeBuild(): void
{
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/php_uv.c",
'#if !defined(PHP_WIN32) || defined(HAVE_SOCKET)',
'#if !defined(PHP_WIN32) || (defined(HAVE_SOCKETS) && !defined(COMPILE_DL_SOCKETS))',
);
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/config.w32",
'CHECK_LIB("Ws2_32.lib","uv", PHP_UV);',
"CHECK_LIB(\"Ws2_32.lib\",\"uv\" , PHP_UV);\n\tCHECK_LIB(\"dbghelp.lib\",\"uv\", PHP_UV);",
);
}
#[BeforeStage('ext-uv', [PhpExtensionPackage::class, 'makeForUnix'])]
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
{