Skip to content

Commit bd815d4

Browse files
committed
Fix static linux cli -a not working issue
1 parent 4bc30b0 commit bd815d4

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

src/SPC/builder/unix/library/ncurses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function build(): void
3838
->make();
3939
$final = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true);
4040
// Remove the new files
41-
$new_files = array_diff($final, $filelist);
41+
$new_files = array_diff($final, $filelist ?: []);
4242
foreach ($new_files as $file) {
4343
@unlink(BUILD_BIN_PATH . '/' . $file);
4444
}

src/SPC/store/SourcePatcher.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static function init(): void
2323
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchPhpLibxml212']);
2424
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchGDWin32']);
2525
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']);
26+
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchStaticReadline']);
2627
FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
2728
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
2829
FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']);
@@ -500,6 +501,12 @@ public static function patchFfiCentos7FixO3strncmp(): bool
500501
return true;
501502
}
502503

504+
public static function patchStaticReadline(): bool
505+
{
506+
self::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
507+
return true;
508+
}
509+
503510
public static function patchPkgConfigForGcc15(): bool
504511
{
505512
self::patchFile('pkg-config_gcc15.patch', SOURCE_PATH . '/pkg-config');
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
2+
index 31212999..d80a21c3 100644
3+
--- a/ext/readline/readline_cli.c
4+
+++ b/ext/readline/readline_cli.c
5+
@@ -739,8 +739,8 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
6+
} while(0)
7+
8+
#else
9+
-/*
10+
#ifdef COMPILE_DL_READLINE
11+
+/*
12+
This dlsym() is always used as even the CGI SAPI is linked against "CLI"-only
13+
extensions. If that is being changed dlsym() should only be used when building
14+
this extension sharedto offer compatibility.
15+
@@ -754,9 +754,9 @@ this extension sharedto offer compatibility.
16+
(cb) = get_callbacks(); \
17+
} \
18+
} while(0)
19+
-/*#else
20+
+#else
21+
#define GET_SHELL_CB(cb) (cb) = php_cli_get_shell_callbacks()
22+
-#endif*/
23+
+#endif
24+
#endif
25+
26+
PHP_MINIT_FUNCTION(cli_readline)

0 commit comments

Comments
 (0)