Fix static linux cli -a not working issue

This commit is contained in:
crazywhalecc 2025-09-07 14:10:28 +08:00
parent 4bc30b0b6f
commit bd815d4ea2
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
3 changed files with 34 additions and 1 deletions

View File

@ -38,7 +38,7 @@ trait ncurses
->make();
$final = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true);
// Remove the new files
$new_files = array_diff($final, $filelist);
$new_files = array_diff($final, $filelist ?: []);
foreach ($new_files as $file) {
@unlink(BUILD_BIN_PATH . '/' . $file);
}

View File

@ -23,6 +23,7 @@ class SourcePatcher
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchPhpLibxml212']);
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchGDWin32']);
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']);
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchStaticReadline']);
FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']);
@ -500,6 +501,12 @@ class SourcePatcher
return true;
}
public static function patchStaticReadline(): bool
{
self::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
return true;
}
public static function patchPkgConfigForGcc15(): bool
{
self::patchFile('pkg-config_gcc15.patch', SOURCE_PATH . '/pkg-config');

View File

@ -0,0 +1,26 @@
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 31212999..d80a21c3 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -739,8 +739,8 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
} while(0)
#else
-/*
#ifdef COMPILE_DL_READLINE
+/*
This dlsym() is always used as even the CGI SAPI is linked against "CLI"-only
extensions. If that is being changed dlsym() should only be used when building
this extension sharedto offer compatibility.
@@ -754,9 +754,9 @@ this extension sharedto offer compatibility.
(cb) = get_callbacks(); \
} \
} while(0)
-/*#else
+#else
#define GET_SHELL_CB(cb) (cb) = php_cli_get_shell_callbacks()
-#endif*/
+#endif
#endif
PHP_MINIT_FUNCTION(cli_readline)