Skip to content

Commit fda637b

Browse files
committed
suggestions
1 parent 76d17eb commit fda637b

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/SPC/builder/extension/readline.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ public function patchBeforeConfigure(): bool
2727

2828
public function getUnixConfigureArg(bool $shared = false): string
2929
{
30-
return '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
30+
$enable = '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
31+
if ($this->builder->getPHPVersionID() < 84000) {
32+
// the check uses `char rl_pending_input()` instead of `extern int rl_pending_input`, which makes LTO fail
33+
$enable .= ' ac_cv_lib_readline_rl_pending_input=yes';
34+
}
35+
return $enable;
3136
}
3237

3338
public function buildUnixShared(): void

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
104104
);
105105
}
106106

107-
$extra = '';
108-
if ($this->getPHPVersionID() < 84000 && $this->getExt('readline') && $this->getLib('libreadline') !== null) {
109-
$extra = 'ac_cv_lib_readline_rl_pending_input=yes';
110-
}
111107
shell()->cd(SOURCE_PATH . '/php-src')
112108
->exec(
113109
$php_configure_env . ' ' .
@@ -122,8 +118,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
122118
$json_74 .
123119
$zts .
124120
$maxExecutionTimers .
125-
$this->makeStaticExtensionArgs() . ' ' .
126-
$extra
121+
$this->makeStaticExtensionArgs() . ' '
127122
);
128123

129124
$this->emitPatchPoint('before-php-make');

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

1212
trait librdkafka
1313
{
14-
/**
15-
* @throws FileSystemException
16-
* @throws RuntimeException
17-
*/
18-
protected function build(): void
14+
public function patchBeforeBuild(): bool
1915
{
2016
FileSystem::replaceFileStr(
2117
$this->source_dir . '/lds-gen.py',
@@ -27,6 +23,15 @@ protected function build(): void
2723
'#error "IOV_MAX not defined"',
2824
"#define IOV_MAX 1024\n#define __GNU__"
2925
);
26+
return true;
27+
}
28+
29+
/**
30+
* @throws FileSystemException
31+
* @throws RuntimeException
32+
*/
33+
protected function build(): void
34+
{
3035
UnixAutoconfExecutor::create($this)
3136
->appendEnv(['CFLAGS' => '-Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-variable'])
3237
->optionalLib(

src/SPC/toolchain/ToolchainManager.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace SPC\toolchain;
66

77
use SPC\builder\linux\SystemUtil;
8-
use SPC\exception\RuntimeException;
98
use SPC\exception\WrongUsageException;
109
use SPC\util\GlobalEnvManager;
1110
use SPC\util\SPCTarget;
@@ -55,10 +54,10 @@ public static function afterInitToolchain(): void
5554
}
5655
$musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m'));
5756
if (SPCTarget::getLibc() === 'musl' && !SPCTarget::isStatic() && !file_exists($musl_wrapper_lib)) {
58-
throw new RuntimeException('You are linking against musl libc dynamically, but musl libc is not installed. Please install it with `sudo dnf install musl-libc` or `sudo apt install musl`');
57+
throw new WrongUsageException('You are linking against musl libc dynamically, but musl libc is not installed. Please use `bin/spc doctor` to install it.');
5958
}
6059
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
61-
throw new RuntimeException('You are linking against glibc dynamically, which is only supported on musl distros.');
60+
throw new WrongUsageException('You are linking against glibc dynamically, which is only supported on glibc distros.');
6261
}
6362
$toolchain = getenv('SPC_TOOLCHAIN');
6463
/* @var ToolchainInterface $toolchain */

0 commit comments

Comments
 (0)