Skip to content

Commit be7c002

Browse files
committed
Patch only when building cli
1 parent e621e4a commit be7c002

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,19 @@ public function testPHP(int $build_target = BUILD_TARGET_NONE)
170170
*/
171171
protected function buildCli(): void
172172
{
173+
if ($this->getExt('readline')) {
174+
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
175+
}
173176
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
174177
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
175178
shell()->cd(SOURCE_PATH . '/php-src')
176179
->exec('sed -i "s|//lib|/lib|g" Makefile')
177180
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli");
178181

182+
if ($this->getExt('readline')) {
183+
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src', true);
184+
}
185+
179186
if (!$this->getOption('no-strip', false)) {
180187
shell()->cd(SOURCE_PATH . '/php-src/sapi/cli')->exec('strip --strip-unneeded php');
181188
}

src/SPC/store/SourcePatcher.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ 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']);
2726
FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
2827
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
2928
FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']);
@@ -501,12 +500,6 @@ public static function patchFfiCentos7FixO3strncmp(): bool
501500
return true;
502501
}
503502

504-
public static function patchStaticReadline(): bool
505-
{
506-
self::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
507-
return true;
508-
}
509-
510503
public static function patchPkgConfigForGcc15(): bool
511504
{
512505
self::patchFile('pkg-config_gcc15.patch', SOURCE_PATH . '/pkg-config');

0 commit comments

Comments
 (0)