Use system cc instead

This commit is contained in:
crazywhalecc
2026-05-10 16:27:25 +08:00
parent 36e738f849
commit c186038dca

View File

@@ -168,7 +168,7 @@ trait unix
#[BeforeStage('php', [self::class, 'makeForUnix'], 'php')] #[BeforeStage('php', [self::class, 'makeForUnix'], 'php')]
#[PatchDescription('Patch Makefile to fix //lib path for Linux builds')] #[PatchDescription('Patch Makefile to fix //lib path for Linux builds')]
#[PatchDescription('Patch BUILD_CC to disable auto-vectorization when zig-cc is used (prevents minilua segfault)')] #[PatchDescription('Patch BUILD_CC to use system cc instead of zig-cc (prevents minilua crash)')]
public function tryPatchMakefileUnix(TargetPackage $package, ToolchainInterface $toolchain): void public function tryPatchMakefileUnix(TargetPackage $package, ToolchainInterface $toolchain): void
{ {
if (SystemTarget::getTargetOS() !== 'Linux') { if (SystemTarget::getTargetOS() !== 'Linux') {
@@ -178,10 +178,9 @@ trait unix
// replace //lib with /lib in Makefile // replace //lib with /lib in Makefile
shell()->cd($package->getSourceDir())->exec('sed -i "s|//lib|/lib|g" Makefile'); shell()->cd($package->getSourceDir())->exec('sed -i "s|//lib|/lib|g" Makefile');
// try to fix minilua with zig-cc, disable vectorize for some edge cases
if ($toolchain instanceof ZigToolchain) { if ($toolchain instanceof ZigToolchain) {
$makefile = "{$package->getSourceDir()}/Makefile"; $makefile = "{$package->getSourceDir()}/Makefile";
FileSystem::replaceFileRegex($makefile, '/^(BUILD_CC\s*=\s*zig-cc)\s*$/m', '$1 -fno-vectorize -fno-slp-vectorize'); FileSystem::replaceFileRegex($makefile, '/^BUILD_CC\s*=\s*zig-cc\s*$/m', 'BUILD_CC = cc');
} }
} }