mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 18:05:36 +08:00
Add ext-uv and libuv support on Windows
This commit is contained in:
@@ -9,3 +9,5 @@ libuv:
|
|||||||
license: MIT
|
license: MIT
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libuv.a
|
- libuv.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libuv.lib
|
||||||
|
|||||||
@@ -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'])]
|
#[BeforeStage('ext-uv', [PhpExtensionPackage::class, 'makeForUnix'])]
|
||||||
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
|
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('libuv')]
|
#[Library('libuv')]
|
||||||
class libuv
|
class libuv
|
||||||
@@ -22,4 +23,12 @@ class libuv
|
|||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWindows(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
|
||||||
|
->build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user