Skip to content

Commit f6c6011

Browse files
committed
err, we need to install zig of course
1 parent 408b3b4 commit f6c6011

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/SPC/builder/unix/library/libaom.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use SPC\exception\FileSystemException;
88
use SPC\exception\RuntimeException;
9+
use SPC\toolchain\ToolchainManager;
10+
use SPC\toolchain\ZigToolchain;
911
use SPC\util\executor\UnixCMakeExecutor;
1012

1113
trait libaom
@@ -16,8 +18,8 @@ trait libaom
1618
*/
1719
protected function build(): void
1820
{
19-
if (getenv('SPC_LIBC') === 'musl' && str_contains(getenv('CC'), 'zig')) {
20-
f_putenv('COMPILER_EXTRA=-D_POSIX_SOURCE');
21+
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
22+
f_putenv('COMPILER_EXTRA=-D_GNU_SOURCE');
2123
}
2224
UnixCMakeExecutor::create($this)
2325
->setBuildDir("{$this->source_dir}/builddir")

src/SPC/command/CraftCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
namespace SPC\command;
66

77
use SPC\exception\ValidationException;
8+
use SPC\toolchain\ToolchainManager;
9+
use SPC\toolchain\ZigToolchain;
810
use SPC\util\ConfigValidator;
911
use Symfony\Component\Console\Attribute\AsCommand;
1012
use Symfony\Component\Process\Process;
@@ -76,7 +78,7 @@ public function handle(): int
7678
}
7779
}
7880
// install zig if requested
79-
if (str_contains(getenv('CC'), 'zig')) {
81+
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
8082
$retcode = $this->runCommand('install-pkg', 'zig');
8183
if ($retcode !== 0) {
8284
$this->output->writeln('<error>craft zig failed</error>');

src/SPC/doctor/item/ZigCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function fixMuslCrossMake(): bool
4747
'BSD' => 'freebsd',
4848
default => 'linux',
4949
};
50-
PackageManager::installPackage("musl-toolchain-{$arch}-{$os}");
50+
PackageManager::installPackage("zig-{$arch}-{$os}");
5151
return Zig::isInstalled();
5252
}
5353
}

0 commit comments

Comments
 (0)