This commit is contained in:
henderkes
2026-05-06 17:49:01 +07:00
parent f553ee9e24
commit 33141775c0
4 changed files with 11 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ trait bzip2
public function patchBeforeBuild(): bool
{
$extra = trim((string) getenv('SPC_DEFAULT_C_FLAGS'));
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS=-Wall', "CFLAGS=-Wall {$extra}");
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS=-Wall', "CFLAGS={$extra} -Wall");
return true;
}

View File

@@ -11,7 +11,7 @@ trait jbig
public function patchBeforeBuild(): bool
{
$extra = trim((string) getenv('SPC_DEFAULT_C_FLAGS'));
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', "CFLAGS = -W -Wno-unused-result {$extra}");
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', "CFLAGS = {$extra} -W -Wno-unused-result");
return true;
}

View File

@@ -15,11 +15,14 @@ trait ncurses
// MKlib_gen.sh feeds preprocessor stdout through a sed/awk pipeline into lib_gen.c.
// zig-cc/clang leaks the "N warning(s) generated." summary onto stdout (not stderr),
// and that line ends up as invalid C in the generated source. Filter it out of the pipe.
FileSystem::replaceFileStr(
$this->source_dir . '/ncurses/base/MKlib_gen.sh',
'$preprocessor $TMP 2>/dev/null \\',
"\$preprocessor \$TMP 2>/dev/null \\\n| grep -v ' generated\\.\$' \\",
);
$mklibGen = $this->source_dir . '/ncurses/base/MKlib_gen.sh';
if (!str_contains((string) file_get_contents($mklibGen), "| grep -v ' generated")) {
FileSystem::replaceFileStr(
$mklibGen,
'$preprocessor $TMP 2>/dev/null \\',
"\$preprocessor \$TMP 2>/dev/null \\\n| grep -v ' generated\\.\$' \\",
);
}
return true;
}

View File

@@ -19,7 +19,7 @@ class BuildLibsCommand extends BuildCommand
{
$this->addArgument('libraries', InputArgument::REQUIRED, 'The libraries will be compiled, comma separated');
$this->addOption('clean', null, null, 'Clean old download cache and source before fetch');
$this->addOption('all', 'A', null, 'Build all libs that static-php-cli needed');
$this->addOption('all', 'A', null, 'Build all libs that static-php-cli has');
}
public function initialize(InputInterface $input, OutputInterface $output): void