mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
adjust craft command for zig
This commit is contained in:
parent
9e9474a026
commit
02f2837f86
@ -71,7 +71,16 @@ class CraftCommand extends BaseCommand
|
|||||||
$retcode = $this->runCommand('install-pkg', 'go-xcaddy');
|
$retcode = $this->runCommand('install-pkg', 'go-xcaddy');
|
||||||
if ($retcode !== 0) {
|
if ($retcode !== 0) {
|
||||||
$this->output->writeln('<error>craft go-xcaddy failed</error>');
|
$this->output->writeln('<error>craft go-xcaddy failed</error>');
|
||||||
$this->log("craft go-xcaddy failed with code: {$retcode}", true);
|
$this->log("craft: spc install-pkg go-xcaddy failed with code: {$retcode}", true);
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// install zig if requested
|
||||||
|
if (str_contains(getenv('CC'), 'zig')) {
|
||||||
|
$retcode = $this->runCommand('install-pkg', 'zig');
|
||||||
|
if ($retcode !== 0) {
|
||||||
|
$this->output->writeln('<error>craft zig failed</error>');
|
||||||
|
$this->log("craft: spc install-pkg zig failed with code: {$retcode}", true);
|
||||||
return static::FAILURE;
|
return static::FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,11 @@ class Zig extends CustomPackage
|
|||||||
default => "{$pkgroot}/{$name}/bin/zig",
|
default => "{$pkgroot}/{$name}/bin/zig",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (file_exists($zig_exec) && !$force) {
|
if ($force) {
|
||||||
|
FileSystem::removeDir($pkgroot . '/' . $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($zig_exec)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +77,13 @@ class Zig extends CustomPackage
|
|||||||
$url = $download_info['tarball'];
|
$url = $download_info['tarball'];
|
||||||
$filename = basename($url);
|
$filename = basename($url);
|
||||||
|
|
||||||
$config = [
|
$pkg = [
|
||||||
'type' => 'url',
|
'type' => 'url',
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'filename' => $filename,
|
'filename' => $filename,
|
||||||
];
|
];
|
||||||
|
|
||||||
Downloader::downloadPackage($name, $config, $force);
|
Downloader::downloadPackage($name, $pkg, $force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extract(string $name): void
|
public function extract(string $name): void
|
||||||
@ -91,11 +95,7 @@ class Zig extends CustomPackage
|
|||||||
default => "{$zig_bin_dir}/zig",
|
default => "{$zig_bin_dir}/zig",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (file_exists($zig_exec)) {
|
if (file_exists($zig_exec) && file_exists("{$zig_bin_dir}/zig-cc")) {
|
||||||
if (!file_exists("{$zig_bin_dir}/zig-cc")) {
|
|
||||||
$this->createZigCcScript($zig_bin_dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user