Patch only when building cli

This commit is contained in:
crazywhalecc 2025-09-07 16:10:50 +08:00
parent e621e4a5a1
commit be7c002869
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 7 additions and 7 deletions

View File

@ -170,12 +170,19 @@ class LinuxBuilder extends UnixBuilderBase
*/
protected function buildCli(): void
{
if ($this->getExt('readline')) {
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
}
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
shell()->cd(SOURCE_PATH . '/php-src')
->exec('sed -i "s|//lib|/lib|g" Makefile')
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli");
if ($this->getExt('readline')) {
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src', true);
}
if (!$this->getOption('no-strip', false)) {
shell()->cd(SOURCE_PATH . '/php-src/sapi/cli')->exec('strip --strip-unneeded php');
}

View File

@ -23,7 +23,6 @@ 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']);
@ -501,12 +500,6 @@ 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');