This commit is contained in:
DubbleClick
2025-07-01 14:02:10 +07:00
parent 0a33fba23e
commit b7e8587608
3 changed files with 20 additions and 26 deletions

View File

@@ -11,25 +11,10 @@ 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++");
return file_exists("{$path}/zig") && file_exists("{$path}/zig-cc") && file_exists("{$path}/zig-c++");
}
public function getSupportName(): array
@@ -149,6 +134,21 @@ 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}";
}
private function createZigCcScript(string $bin_dir): void
{
$script_path = __DIR__ . '/../scripts/zig-cc.sh';