diff --git a/src/SPC/builder/unix/library/bzip2.php b/src/SPC/builder/unix/library/bzip2.php index 4ed3b46a..875fd54c 100644 --- a/src/SPC/builder/unix/library/bzip2.php +++ b/src/SPC/builder/unix/library/bzip2.php @@ -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; } diff --git a/src/SPC/builder/unix/library/jbig.php b/src/SPC/builder/unix/library/jbig.php index 27cb6141..7798758d 100644 --- a/src/SPC/builder/unix/library/jbig.php +++ b/src/SPC/builder/unix/library/jbig.php @@ -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; } diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index 5e1de86f..6ea6d6fb 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -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; } diff --git a/src/SPC/command/BuildLibsCommand.php b/src/SPC/command/BuildLibsCommand.php index de1f1bba..82a0ca97 100644 --- a/src/SPC/command/BuildLibsCommand.php +++ b/src/SPC/command/BuildLibsCommand.php @@ -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