This commit is contained in:
DubbleClick 2025-06-26 14:29:00 +07:00
parent fae2878c41
commit 935f3fc37c
2 changed files with 19 additions and 22 deletions

View File

@ -94,5 +94,4 @@ class GoXcaddy extends CustomPackage
'GOPATH' => "{$pkgroot}/go",
];
}
}

View File

@ -104,15 +104,32 @@ class Zig extends CustomPackage
$filename = DOWNLOAD_PATH . '/' . ($lock[$name]['filename'] ?? $lock[$name]['dirname']);
$extract = "{$pkgroot}/{$name}";
FileSystem::extractPackage($name, $source_type, $filename, $extract);
$this->createZigCcScript($zig_bin_dir);
}
public static function getEnvironment(): array
{
$arch = arch2gnu(php_uname('m'));
$os = match (PHP_OS_FAMILY) {
'Linux' => 'linux',
'Windows' => 'win',
'Darwin' => 'macos',
'BSD' => 'freebsd',
default => 'linux',
};
$packageName = "zig-{$arch}-{$os}";
$path = PKG_ROOT_PATH . "/{$packageName}";
return [
'PATH' => $path,
];
}
private function createZigCcScript(string $bin_dir): void
{
$script_content = <<<'EOF'
#!/usr/bin/env bash
@ -202,23 +219,4 @@ EOF;
file_put_contents("{$bin_dir}/zig-c++", $script_content);
chmod("{$bin_dir}/zig-c++", 0755);
}
public static function getEnvironment(): array
{
$arch = arch2gnu(php_uname('m'));
$os = match (PHP_OS_FAMILY) {
'Linux' => 'linux',
'Windows' => 'win',
'Darwin' => 'macos',
'BSD' => 'freebsd',
default => 'linux',
};
$packageName = "zig-{$arch}-{$os}";
$path = PKG_ROOT_PATH . "/{$packageName}";
return [
'PATH' => $path
];
}
}