mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
adjust doctor for os and linux musl check
This commit is contained in:
parent
90b2e5568c
commit
2768dc0c40
@ -26,7 +26,7 @@ class LinuxMuslCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
$musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m'));
|
$musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m'));
|
||||||
if (file_exists($musl_wrapper_lib)) {
|
if (file_exists($musl_wrapper_lib) && file_exists('/usr/local/musl/bin/musl-gcc')) {
|
||||||
return CheckResult::ok();
|
return CheckResult::ok();
|
||||||
}
|
}
|
||||||
return CheckResult::fail('musl-wrapper is not installed on your system', 'fix-musl-wrapper');
|
return CheckResult::fail('musl-wrapper is not installed on your system', 'fix-musl-wrapper');
|
||||||
@ -71,7 +71,7 @@ class LinuxMuslCheck
|
|||||||
Downloader::downloadSource($musl_version_name, $musl_source);
|
Downloader::downloadSource($musl_version_name, $musl_source);
|
||||||
FileSystem::extractSource($musl_version_name, DOWNLOAD_PATH . "/{$musl_version_name}.tar.gz");
|
FileSystem::extractSource($musl_version_name, DOWNLOAD_PATH . "/{$musl_version_name}.tar.gz");
|
||||||
logger()->info('Installing musl wrapper');
|
logger()->info('Installing musl wrapper');
|
||||||
shell(true)->cd(SOURCE_PATH . "/{$musl_version_name}")
|
shell()->cd(SOURCE_PATH . "/{$musl_version_name}")
|
||||||
->exec('./configure')
|
->exec('./configure')
|
||||||
->exec('make -j')
|
->exec('make -j')
|
||||||
->exec("{$prefix}make install");
|
->exec("{$prefix}make install");
|
||||||
@ -106,7 +106,7 @@ class LinuxMuslCheck
|
|||||||
Downloader::downloadSource('musl-compile', $musl_compile_source);
|
Downloader::downloadSource('musl-compile', $musl_compile_source);
|
||||||
logger()->info('Extracting musl-cross');
|
logger()->info('Extracting musl-cross');
|
||||||
FileSystem::extractSource('musl-compile', DOWNLOAD_PATH . "/{$arch}-musl-toolchain.tgz");
|
FileSystem::extractSource('musl-compile', DOWNLOAD_PATH . "/{$arch}-musl-toolchain.tgz");
|
||||||
shell(true)->exec($prefix . 'cp -rf ' . SOURCE_PATH . '/musl-compile/* /usr/local/musl');
|
shell()->exec($prefix . 'cp -rf ' . SOURCE_PATH . '/musl-compile/* /usr/local/musl');
|
||||||
return true;
|
return true;
|
||||||
} catch (RuntimeException) {
|
} catch (RuntimeException) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\doctor\item;
|
namespace SPC\doctor\item;
|
||||||
|
|
||||||
|
use SPC\builder\linux\SystemUtil;
|
||||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||||
use SPC\doctor\AsCheckItem;
|
use SPC\doctor\AsCheckItem;
|
||||||
use SPC\doctor\CheckResult;
|
use SPC\doctor\CheckResult;
|
||||||
@ -18,6 +19,7 @@ class OSCheckList
|
|||||||
if (!in_array(PHP_OS_FAMILY, ['Darwin', 'Linux', 'BSD'])) {
|
if (!in_array(PHP_OS_FAMILY, ['Darwin', 'Linux', 'BSD'])) {
|
||||||
return CheckResult::fail('Current OS is not supported');
|
return CheckResult::fail('Current OS is not supported');
|
||||||
}
|
}
|
||||||
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . ', supported');
|
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
|
||||||
|
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user