don't request configurearg if it's not used (ease debugging)

This commit is contained in:
DubbleClick 2025-08-25 12:36:10 +07:00
parent 7e0e9091be
commit 448941f741
5 changed files with 19 additions and 11 deletions

View File

@ -842,11 +842,15 @@
"nghttp2",
"zlib"
],
"lib-suggests": [
"zstd"
],
"ext-depends": [
"openssl",
"curl"
],
"ext-suggests": [
"sockets",
"swoole-hook-pgsql",
"swoole-hook-mysql",
"swoole-hook-sqlite"

View File

@ -268,11 +268,11 @@ abstract class BuilderBase
{
$ret = [];
foreach ($this->getExts() as $ext) {
$arg = $ext->getConfigureArg();
$arg = null;
if ($ext->isBuildShared() && !$ext->isBuildStatic()) {
if (
(Config::getExt($ext->getName(), 'type') === 'builtin' &&
!file_exists(SOURCE_PATH . '/php-src/ext/' . $ext->getName() . '/config.m4')) ||
!file_exists(SOURCE_PATH . '/php-src/ext/' . $ext->getName() . '/config.m4')) ||
Config::getExt($ext->getName(), 'build-with-php') === true
) {
$arg = $ext->getConfigureArg(true);
@ -280,6 +280,7 @@ abstract class BuilderBase
continue;
}
}
$arg ??= $ext->getConfigureArg();
logger()->info($ext->getName() . ' is using ' . $arg);
$ret[] = trim($arg);
}

View File

@ -43,14 +43,16 @@ class swoole extends Extension
public function getUnixConfigureArg(bool $shared = false): string
{
// enable swoole
$arg = '--enable-swoole';
$arg = '--enable-swoole' . ($shared ? '=shared' : '');
// commonly-used feature: coroutine-time, disable-thread-context
$arg .= ' --enable-swoole-coro-time --disable-thread-context';
// commonly-used feature: coroutine-time
$arg .= ' --enable-swoole-coro-time --with-pic';
$arg .= $this->builder->getOption('enable-zts') ? ' --enable-thread-context' : ' --disable-thread-context';
// required feature: curl, openssl (but curl hook is buggy for php 8.0)
$arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
$arg .= ' --enable-openssl';
$arg .= ' --enable-openssl'; // we depend on openssl so it's always enabled
// additional feature: c-ares, brotli, nghttp2 (can be disabled, but we enable it by default in config to support full network feature)
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
@ -58,13 +60,16 @@ class swoole extends Extension
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
}
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
$arg .= $this->builder->getLib('iouring') ? ' --enable-iouring' : '';
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
// additional feature: swoole-pgsql, it should depend on lib [postgresql], but it will lack of CFLAGS etc.
// so this is a tricky way (enable ext [pgsql,pdo] to add postgresql hook and pdo_pgsql support)
$arg .= $this->builder->getExt('swoole-hook-pgsql') ? ' --enable-swoole-pgsql' : ' --disable-swoole-pgsql';
// additional feature: swoole-mysql
$arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-swoole-mysql' : ' --disable-swoole-mysql';
$arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd';
// enable this feature , need remove pdo_sqlite
// more info : https://wenda.swoole.com/detail/109023

View File

@ -27,8 +27,7 @@ class swoole_hook_pgsql extends Extension
public function getUnixConfigureArg(bool $shared = false): string
{
// enable swoole pgsql hook
return '--enable-swoole-pgsql';
return ''; // enabled in swoole.php
}
public function runCliCheckUnix(): void

View File

@ -27,8 +27,7 @@ class swoole_hook_sqlite extends Extension
public function getUnixConfigureArg(bool $shared = false): string
{
// enable swoole pgsql hook
return '--enable-swoole-sqlite';
return ''; // enabled in swoole.php
}
public function runCliCheckUnix(): void