2023-04-15 18:45:11 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
|
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('swoole')]
|
|
|
|
|
class swoole extends Extension
|
|
|
|
|
{
|
|
|
|
|
public function getUnixConfigureArg(): string
|
|
|
|
|
{
|
2023-08-21 18:30:26 +08:00
|
|
|
$arg = '--enable-swoole';
|
2023-11-29 22:19:20 +08:00
|
|
|
|
|
|
|
|
$options = '';
|
|
|
|
|
if ($this->builder->getLib('postgresql')) {
|
|
|
|
|
if (!$this->builder->getExt('pdo_pgsql')) {
|
|
|
|
|
$options .= '--enable-swoole-pgsql';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$options .= '--disable-swoole-pgsql';
|
|
|
|
|
}
|
|
|
|
|
$arg .= $options;
|
2023-04-30 12:42:19 +08:00
|
|
|
$arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl';
|
2023-11-29 22:19:20 +08:00
|
|
|
$arg .= $this->builder->getLib(
|
|
|
|
|
'brotli'
|
|
|
|
|
) ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli';
|
2023-11-29 20:31:53 +08:00
|
|
|
// swoole curl hook is buggy for php 8.0
|
2023-11-29 22:19:20 +08:00
|
|
|
$arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID(
|
|
|
|
|
) >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
2023-04-15 18:45:11 +08:00
|
|
|
return $arg;
|
|
|
|
|
}
|
|
|
|
|
}
|