mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
suggestions
This commit is contained in:
parent
76d17ebef0
commit
fda637bb03
@ -27,7 +27,12 @@ class readline extends Extension
|
|||||||
|
|
||||||
public function getUnixConfigureArg(bool $shared = false): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
|
$enable = '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
|
||||||
|
if ($this->builder->getPHPVersionID() < 84000) {
|
||||||
|
// the check uses `char rl_pending_input()` instead of `extern int rl_pending_input`, which makes LTO fail
|
||||||
|
$enable .= ' ac_cv_lib_readline_rl_pending_input=yes';
|
||||||
|
}
|
||||||
|
return $enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildUnixShared(): void
|
public function buildUnixShared(): void
|
||||||
|
|||||||
@ -104,10 +104,6 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra = '';
|
|
||||||
if ($this->getPHPVersionID() < 84000 && $this->getExt('readline') && $this->getLib('libreadline') !== null) {
|
|
||||||
$extra = 'ac_cv_lib_readline_rl_pending_input=yes';
|
|
||||||
}
|
|
||||||
shell()->cd(SOURCE_PATH . '/php-src')
|
shell()->cd(SOURCE_PATH . '/php-src')
|
||||||
->exec(
|
->exec(
|
||||||
$php_configure_env . ' ' .
|
$php_configure_env . ' ' .
|
||||||
@ -122,8 +118,7 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
$json_74 .
|
$json_74 .
|
||||||
$zts .
|
$zts .
|
||||||
$maxExecutionTimers .
|
$maxExecutionTimers .
|
||||||
$this->makeStaticExtensionArgs() . ' ' .
|
$this->makeStaticExtensionArgs() . ' '
|
||||||
$extra
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->emitPatchPoint('before-php-make');
|
$this->emitPatchPoint('before-php-make');
|
||||||
|
|||||||
@ -11,11 +11,7 @@ use SPC\util\executor\UnixAutoconfExecutor;
|
|||||||
|
|
||||||
trait librdkafka
|
trait librdkafka
|
||||||
{
|
{
|
||||||
/**
|
public function patchBeforeBuild(): bool
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function build(): void
|
|
||||||
{
|
{
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
$this->source_dir . '/lds-gen.py',
|
$this->source_dir . '/lds-gen.py',
|
||||||
@ -27,6 +23,15 @@ trait librdkafka
|
|||||||
'#error "IOV_MAX not defined"',
|
'#error "IOV_MAX not defined"',
|
||||||
"#define IOV_MAX 1024\n#define __GNU__"
|
"#define IOV_MAX 1024\n#define __GNU__"
|
||||||
);
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
UnixAutoconfExecutor::create($this)
|
UnixAutoconfExecutor::create($this)
|
||||||
->appendEnv(['CFLAGS' => '-Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-variable'])
|
->appendEnv(['CFLAGS' => '-Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-variable'])
|
||||||
->optionalLib(
|
->optionalLib(
|
||||||
|
|||||||
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace SPC\toolchain;
|
namespace SPC\toolchain;
|
||||||
|
|
||||||
use SPC\builder\linux\SystemUtil;
|
use SPC\builder\linux\SystemUtil;
|
||||||
use SPC\exception\RuntimeException;
|
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\util\GlobalEnvManager;
|
use SPC\util\GlobalEnvManager;
|
||||||
use SPC\util\SPCTarget;
|
use SPC\util\SPCTarget;
|
||||||
@ -55,10 +54,10 @@ class ToolchainManager
|
|||||||
}
|
}
|
||||||
$musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m'));
|
$musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m'));
|
||||||
if (SPCTarget::getLibc() === 'musl' && !SPCTarget::isStatic() && !file_exists($musl_wrapper_lib)) {
|
if (SPCTarget::getLibc() === 'musl' && !SPCTarget::isStatic() && !file_exists($musl_wrapper_lib)) {
|
||||||
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`');
|
throw new WrongUsageException('You are linking against musl libc dynamically, but musl libc is not installed. Please use `bin/spc doctor` to install it.');
|
||||||
}
|
}
|
||||||
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
|
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
|
||||||
throw new RuntimeException('You are linking against glibc dynamically, which is only supported on musl distros.');
|
throw new WrongUsageException('You are linking against glibc dynamically, which is only supported on glibc distros.');
|
||||||
}
|
}
|
||||||
$toolchain = getenv('SPC_TOOLCHAIN');
|
$toolchain = getenv('SPC_TOOLCHAIN');
|
||||||
/* @var ToolchainInterface $toolchain */
|
/* @var ToolchainInterface $toolchain */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user