mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
add zts support
This commit is contained in:
parent
6d638f3721
commit
1b6d0e35ea
@ -31,11 +31,13 @@ class BuilderProvider
|
||||
cc: $input->getOption('cc'),
|
||||
cxx: $input->getOption('cxx'),
|
||||
arch: $input->getOption('arch'),
|
||||
zts: $input->getOption('enable-zts'),
|
||||
),
|
||||
'Linux' => new LinuxBuilder(
|
||||
cc: $input->getOption('cc'),
|
||||
cxx: $input->getOption('cxx'),
|
||||
arch: $input->getOption('arch'),
|
||||
zts: $input->getOption('enable-zts'),
|
||||
),
|
||||
default => throw new WrongUsageException('Current OS "' . PHP_OS_FAMILY . '" is not supported yet'),
|
||||
};
|
||||
|
||||
@ -43,7 +43,7 @@ class LinuxBuilder extends BuilderBase
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null)
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null, bool $zts = false)
|
||||
{
|
||||
// 初始化一些默认参数
|
||||
$this->cc = $cc ?? match (SystemUtil::getOSRelease()['dist']) {
|
||||
@ -53,6 +53,7 @@ class LinuxBuilder extends BuilderBase
|
||||
$this->cxx = $cxx ?? 'g++';
|
||||
$this->arch = $arch ?? php_uname('m');
|
||||
$this->gnu_arch = arch2gnu($this->arch);
|
||||
$this->zts = $zts;
|
||||
$this->libc = 'musl'; // SystemUtil::selectLibc($this->cc);
|
||||
|
||||
// 根据 CPU 线程数设置编译进程数
|
||||
|
||||
@ -31,7 +31,7 @@ class MacOSBuilder extends BuilderBase
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null)
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null, bool $zts = false)
|
||||
{
|
||||
// 如果是 Debug 模式,才使用 set -x 显示每条执行的命令
|
||||
$this->set_x = defined('DEBUG_MODE') ? 'set -x' : 'true';
|
||||
@ -40,6 +40,7 @@ class MacOSBuilder extends BuilderBase
|
||||
$this->cxx = $cxx ?? 'clang++';
|
||||
$this->arch = $arch ?? php_uname('m');
|
||||
$this->gnu_arch = arch2gnu($this->arch);
|
||||
$this->zts = $zts;
|
||||
// 根据 CPU 线程数设置编译进程数
|
||||
$this->concurrency = SystemUtil::getCpuCount();
|
||||
// 设置 cflags
|
||||
|
||||
@ -26,6 +26,7 @@ class BuildCliCommand extends BuildCommand
|
||||
$this->addOption('build-fpm', null, null, 'build fpm');
|
||||
$this->addOption('build-all', null, null, 'build cli, micro, fpm');
|
||||
$this->addOption('no-strip', null, null, 'build without strip, in order to debug and load external extensions');
|
||||
$this->addOption('enable-zts', null, null, 'enable ZTS support');
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user