2026-02-06 12:32:04 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Package\Library;
|
|
|
|
|
|
|
|
|
|
use StaticPHP\Attribute\Package\BuildFor;
|
|
|
|
|
use StaticPHP\Attribute\Package\Library;
|
|
|
|
|
use StaticPHP\Package\LibraryPackage;
|
|
|
|
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
2026-04-10 16:15:07 +08:00
|
|
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
2026-02-06 12:32:04 +08:00
|
|
|
|
|
|
|
|
#[Library('libuv')]
|
|
|
|
|
class libuv
|
|
|
|
|
{
|
2026-05-26 21:10:00 +07:00
|
|
|
private const array DISABLE_ARGS = [
|
|
|
|
|
'-DLIBUV_BUILD_SHARED=OFF',
|
|
|
|
|
'-DLIBUV_BUILD_TESTS=OFF',
|
|
|
|
|
'-DLIBUV_BUILD_BENCH=OFF',
|
|
|
|
|
];
|
|
|
|
|
|
2026-02-06 12:32:04 +08:00
|
|
|
#[BuildFor('Darwin')]
|
|
|
|
|
#[BuildFor('Linux')]
|
|
|
|
|
public function buildUnix(LibraryPackage $lib): void
|
|
|
|
|
{
|
|
|
|
|
UnixCMakeExecutor::create($lib)
|
2026-05-26 21:10:00 +07:00
|
|
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
2026-02-06 12:32:04 +08:00
|
|
|
->build();
|
|
|
|
|
// patch pkgconfig
|
|
|
|
|
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
|
|
|
|
}
|
2026-04-10 16:15:07 +08:00
|
|
|
|
|
|
|
|
#[BuildFor('Windows')]
|
|
|
|
|
public function buildWindows(LibraryPackage $lib): void
|
|
|
|
|
{
|
|
|
|
|
WindowsCMakeExecutor::create($lib)
|
2026-05-26 21:10:00 +07:00
|
|
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
2026-04-10 16:15:07 +08:00
|
|
|
->build();
|
|
|
|
|
}
|
2026-02-06 12:32:04 +08:00
|
|
|
}
|