mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Cmake version check (#400)
* add cmake version checker for doctor * fix linux distro checker message
This commit is contained in:
parent
d3a001d808
commit
da6d9ffb4b
@ -74,6 +74,22 @@ class LinuxToolCheckList
|
|||||||
return CheckResult::ok();
|
return CheckResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')]
|
||||||
|
public function checkCMakeVersion(): ?CheckResult
|
||||||
|
{
|
||||||
|
$check_cmd = 'cmake --version';
|
||||||
|
$pattern = '/cmake version (.*)/m';
|
||||||
|
$out = shell()->execWithResult($check_cmd, false)[1][0];
|
||||||
|
if (preg_match($pattern, $out, $match)) {
|
||||||
|
$ver = $match[1];
|
||||||
|
if (version_compare($ver, '3.18.0') <= 0) {
|
||||||
|
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
|
||||||
|
}
|
||||||
|
return CheckResult::ok($match[1]);
|
||||||
|
}
|
||||||
|
return CheckResult::fail('Failed to get cmake version');
|
||||||
|
}
|
||||||
|
|
||||||
/** @noinspection PhpUnused */
|
/** @noinspection PhpUnused */
|
||||||
#[AsCheckItem('if necessary linux headers are installed', limit_os: 'Linux')]
|
#[AsCheckItem('if necessary linux headers are installed', limit_os: 'Linux')]
|
||||||
public function checkSystemOSPackages(): ?CheckResult
|
public function checkSystemOSPackages(): ?CheckResult
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class OSCheckList
|
|||||||
return CheckResult::fail('Current OS is not supported: ' . PHP_OS_FAMILY);
|
return CheckResult::fail('Current OS is not supported: ' . PHP_OS_FAMILY);
|
||||||
}
|
}
|
||||||
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
|
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
|
||||||
$known_distro = PHP_OS_FAMILY === 'Linux' && in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
|
$known_distro = PHP_OS_FAMILY !== 'Linux' || in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
|
||||||
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
|
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user