2025-12-11 14:24:59 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Package\Library;
|
|
|
|
|
|
|
|
|
|
use StaticPHP\Attribute\Package\BuildFor;
|
|
|
|
|
use StaticPHP\Attribute\Package\Library;
|
|
|
|
|
use StaticPHP\Package\LibraryPackage;
|
2026-02-04 16:24:57 +08:00
|
|
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
2025-12-11 14:24:59 +08:00
|
|
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
|
|
|
|
use StaticPHP\Util\FileSystem;
|
|
|
|
|
|
|
|
|
|
#[Library('onig')]
|
|
|
|
|
class onig
|
|
|
|
|
{
|
|
|
|
|
#[BuildFor('Windows')]
|
|
|
|
|
public function buildWin(LibraryPackage $package): void
|
|
|
|
|
{
|
|
|
|
|
WindowsCMakeExecutor::create($package)
|
|
|
|
|
->addConfigureArgs('-DMSVC_STATIC_RUNTIME=ON')
|
|
|
|
|
->build();
|
|
|
|
|
FileSystem::copy("{$package->getLibDir()}\\onig.lib", "{$package->getLibDir()}\\onig_a.lib");
|
|
|
|
|
}
|
2026-02-04 16:24:57 +08:00
|
|
|
|
|
|
|
|
#[BuildFor('Linux')]
|
|
|
|
|
#[BuildFor('Darwin')]
|
|
|
|
|
public function buildUnix(LibraryPackage $lib): void
|
|
|
|
|
{
|
|
|
|
|
UnixAutoconfExecutor::create($lib)->configure()->make();
|
|
|
|
|
$lib->patchPkgconfPrefix(['oniguruma.pc']);
|
|
|
|
|
}
|
2025-12-11 14:24:59 +08:00
|
|
|
}
|