mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
zig toolchain stuff
This commit is contained in:
@@ -13,4 +13,6 @@ abstract class CustomPackage
|
||||
abstract public function extract(string $name): void;
|
||||
|
||||
abstract public static function getEnvironment(): array;
|
||||
|
||||
abstract public static function isInstalled(): bool;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,27 @@ use SPC\store\LockFile;
|
||||
|
||||
class Zig extends CustomPackage
|
||||
{
|
||||
private static function getPath(): string
|
||||
{
|
||||
$arch = arch2gnu(php_uname('m'));
|
||||
$os = match (PHP_OS_FAMILY) {
|
||||
'Linux' => 'linux',
|
||||
'Windows' => 'win',
|
||||
'Darwin' => 'macos',
|
||||
'BSD' => 'freebsd',
|
||||
default => 'linux',
|
||||
};
|
||||
|
||||
$packageName = "zig-{$arch}-{$os}";
|
||||
return PKG_ROOT_PATH . "/{$packageName}";
|
||||
}
|
||||
|
||||
public static function isInstalled(): bool
|
||||
{
|
||||
$path = self::getPath();
|
||||
return file_exists("$path/zig") && file_exists("$path/zig-cc") && file_exists("$path/zig-c++");
|
||||
}
|
||||
|
||||
public function getSupportName(): array
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user