mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-19 23:05:36 +08:00
Apply ncurses patch changes in feat/pgo-v3
This commit is contained in:
@@ -6,6 +6,8 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
@@ -16,6 +18,24 @@ use StaticPHP\Util\FileSystem;
|
|||||||
#[Library('ncursesw')]
|
#[Library('ncursesw')]
|
||||||
class ncurses
|
class ncurses
|
||||||
{
|
{
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
#[PatchDescription('Filter clang/zig "N warning(s) generated." line out of MKlib_gen.sh preprocessor pipe')]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
// MKlib_gen.sh feeds the C preprocessor's stdout through a sed/awk
|
||||||
|
// pipeline into lib_gen.c. zig-cc/clang emits "N warning(s) generated."
|
||||||
|
// on stdout (not stderr), and that line ends up as invalid C in the
|
||||||
|
// generated source. Filter it out of the pipe before sed sees it.
|
||||||
|
$mklibGen = $lib->getSourceDir() . '/ncurses/base/MKlib_gen.sh';
|
||||||
|
if (is_file($mklibGen) && !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\\.\$' \\",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function build(LibraryPackage $package, ToolchainInterface $toolchain): void
|
public function build(LibraryPackage $package, ToolchainInterface $toolchain): void
|
||||||
@@ -45,6 +65,7 @@ class ncurses
|
|||||||
'--without-tests',
|
'--without-tests',
|
||||||
'--without-dlsym',
|
'--without-dlsym',
|
||||||
'--without-debug',
|
'--without-debug',
|
||||||
|
'--disable-stripping',
|
||||||
'--enable-symlinks',
|
'--enable-symlinks',
|
||||||
"--with-terminfo-dirs={$terminfo_dirs}",
|
"--with-terminfo-dirs={$terminfo_dirs}",
|
||||||
"--bindir={$package->getBinDir()}",
|
"--bindir={$package->getBinDir()}",
|
||||||
|
|||||||
Reference in New Issue
Block a user