30 lines
746 B
PHP
Raw Normal View History

2023-04-15 18:45:11 +08:00
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
2023-11-05 17:48:20 +08:00
use SPC\exception\RuntimeException;
2023-04-15 18:45:11 +08:00
use SPC\util\CustomExt;
#[CustomExt('mbregex')]
class mbregex extends Extension
{
2023-11-05 17:48:20 +08:00
public function getConfigureArg(): string
2023-04-15 18:45:11 +08:00
{
2023-11-05 17:48:20 +08:00
return '';
2023-04-15 18:45:11 +08:00
}
2023-11-05 17:48:20 +08:00
/**
* mbregex is not an extension, we need to overwrite the default check.
*/
2024-01-10 21:08:25 +08:00
public function runCliCheckUnix(): void
{
2023-11-05 17:48:20 +08:00
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring" | grep regex', false);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');
}
}
2023-04-15 18:45:11 +08:00
}