mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
Add homebrew llvm version toolchain support
This commit is contained in:
@@ -7,6 +7,7 @@ namespace StaticPHP\Doctor\Item;
|
||||
use StaticPHP\Attribute\Doctor\CheckItem;
|
||||
use StaticPHP\Attribute\Doctor\FixItem;
|
||||
use StaticPHP\Doctor\CheckResult;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\System\MacOSUtil;
|
||||
|
||||
class MacOSToolCheck
|
||||
@@ -58,6 +59,20 @@ class MacOSToolCheck
|
||||
return CheckResult::ok();
|
||||
}
|
||||
|
||||
#[CheckItem('if homebrew llvm are installed', limit_os: 'Darwin')]
|
||||
public function checkBrewLLVM(): ?CheckResult
|
||||
{
|
||||
if (getenv('SPC_USE_LLVM') === 'brew') {
|
||||
$homebrew_prefix = getenv('HOMEBREW_PREFIX') ?: (SystemTarget::getTargetArch() === 'aarch64' ? '/opt/homebrew' : '/usr/local/homebrew');
|
||||
|
||||
if (MacOSUtil::findCommand('clang', ["{$homebrew_prefix}/opt/llvm/bin"]) === null) {
|
||||
return CheckResult::fail('Homebrew llvm is not installed', 'brew', ['missing' => ['llvm']]);
|
||||
}
|
||||
return CheckResult::ok();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#[CheckItem('if bison version is 3.0 or later', limit_os: 'Darwin')]
|
||||
public function checkBisonVersion(array $command_path = []): ?CheckResult
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user