mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
err, we need to install zig of course
This commit is contained in:
parent
408b3b4060
commit
f6c6011061
@ -6,6 +6,8 @@ namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\executor\UnixCMakeExecutor;
|
||||
|
||||
trait libaom
|
||||
@ -16,8 +18,8 @@ trait libaom
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
if (getenv('SPC_LIBC') === 'musl' && str_contains(getenv('CC'), 'zig')) {
|
||||
f_putenv('COMPILER_EXTRA=-D_POSIX_SOURCE');
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
f_putenv('COMPILER_EXTRA=-D_GNU_SOURCE');
|
||||
}
|
||||
UnixCMakeExecutor::create($this)
|
||||
->setBuildDir("{$this->source_dir}/builddir")
|
||||
|
||||
@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace SPC\command;
|
||||
|
||||
use SPC\exception\ValidationException;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\ConfigValidator;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Process\Process;
|
||||
@ -76,7 +78,7 @@ class CraftCommand extends BuildCommand
|
||||
}
|
||||
}
|
||||
// install zig if requested
|
||||
if (str_contains(getenv('CC'), 'zig')) {
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$retcode = $this->runCommand('install-pkg', 'zig');
|
||||
if ($retcode !== 0) {
|
||||
$this->output->writeln('<error>craft zig failed</error>');
|
||||
|
||||
@ -47,7 +47,7 @@ class ZigCheck
|
||||
'BSD' => 'freebsd',
|
||||
default => 'linux',
|
||||
};
|
||||
PackageManager::installPackage("musl-toolchain-{$arch}-{$os}");
|
||||
PackageManager::installPackage("zig-{$arch}-{$os}");
|
||||
return Zig::isInstalled();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user