From 324ba0d3dc07ca9259bc3874f8cb128d8fd1a076 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 25 Aug 2025 12:57:49 +0700 Subject: [PATCH] use type=addon and arg-type=none --- config/ext.json | 9 +++++---- src/SPC/builder/Extension.php | 6 ++++++ .../builder/extension/swoole_hook_mysql.php | 20 +------------------ .../builder/extension/swoole_hook_pgsql.php | 16 --------------- .../builder/extension/swoole_hook_sqlite.php | 16 --------------- 5 files changed, 12 insertions(+), 55 deletions(-) diff --git a/config/ext.json b/config/ext.json index d1c8878e..852d1da3 100644 --- a/config/ext.json +++ b/config/ext.json @@ -843,7 +843,8 @@ "zlib" ], "lib-suggests": [ - "zstd" + "zstd", + "unixodbc" ], "ext-depends": [ "openssl", @@ -863,7 +864,7 @@ }, "notes": true, "type": "addon", - "arg-type": "custom", + "arg-type": "none", "ext-depends": [ "mysqlnd", "pdo", @@ -882,7 +883,7 @@ }, "notes": true, "type": "addon", - "arg-type": "custom", + "arg-type": "none", "ext-depends": [ "pgsql", "pdo", @@ -896,7 +897,7 @@ }, "notes": true, "type": "addon", - "arg-type": "custom", + "arg-type": "none", "ext-depends": [ "sqlite3", "pdo", diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 75a008c1..faae465c 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -269,6 +269,9 @@ class Extension $ret = ''; foreach ($order as $ext) { if ($ext instanceof self && $ext->isBuildShared()) { + if (Config::getExt($ext->getName(), 'type', false) === 'addon') { + continue; + } if (Config::getExt($ext->getName(), 'zend-extension', false) === true) { $ret .= " -d \"zend_extension={$ext->getName()}\""; } else { @@ -352,6 +355,9 @@ class Extension */ public function buildShared(): void { + if (Config::getExt($this->getName(), 'type') === 'addon') { + return; + } try { if (Config::getExt($this->getName(), 'type') === 'builtin' || Config::getExt($this->getName(), 'build-with-php') === true) { if (file_exists(BUILD_MODULES_PATH . '/' . $this->getName() . '.so')) { diff --git a/src/SPC/builder/extension/swoole_hook_mysql.php b/src/SPC/builder/extension/swoole_hook_mysql.php index ee942142..0c005aee 100644 --- a/src/SPC/builder/extension/swoole_hook_mysql.php +++ b/src/SPC/builder/extension/swoole_hook_mysql.php @@ -16,20 +16,13 @@ class swoole_hook_mysql extends Extension return 'swoole'; } - public function getUnixConfigureArg(bool $shared = false): string - { - // pdo_mysql doesn't need to be disabled - // enable swoole-hook-mysql will enable mysqli, pdo, pdo_mysql, we don't need to add any additional options - return ''; - } - public function runCliCheckUnix(): void { // skip if not enable swoole if ($this->builder->getExt('swoole') === null) { return; } - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false); + [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"'); $out = implode('', $out); if ($ret !== 0) { throw new ValidationException("extension {$this->getName()} failed compile check: php-cli returned {$ret}", validation_module: 'extension swoole_hook_mysql sanity check'); @@ -38,15 +31,4 @@ class swoole_hook_mysql extends Extension throw new ValidationException('swoole mysql hook is not enabled correctly.', validation_module: 'Extension swoole mysql hook availability check'); } } - - public function getSharedExtensionLoadString(): string - { - $ret = parent::getSharedExtensionLoadString(); - return str_replace(' -d "extension=' . $this->name . '"', '', $ret); - } - - public function buildShared(): void - { - // nothing to do, it's built into swoole - } } diff --git a/src/SPC/builder/extension/swoole_hook_pgsql.php b/src/SPC/builder/extension/swoole_hook_pgsql.php index 18f85fac..7bbc1a1f 100644 --- a/src/SPC/builder/extension/swoole_hook_pgsql.php +++ b/src/SPC/builder/extension/swoole_hook_pgsql.php @@ -25,11 +25,6 @@ class swoole_hook_pgsql extends Extension } } - public function getUnixConfigureArg(bool $shared = false): string - { - return ''; // enabled in swoole.php - } - public function runCliCheckUnix(): void { // skip if not enable swoole @@ -52,15 +47,4 @@ class swoole_hook_pgsql extends Extension ); } } - - public function getSharedExtensionLoadString(): string - { - $ret = parent::getSharedExtensionLoadString(); - return str_replace(' -d "extension=' . $this->name . '"', '', $ret); - } - - public function buildShared(): void - { - // nothing to do, it's built into swoole - } } diff --git a/src/SPC/builder/extension/swoole_hook_sqlite.php b/src/SPC/builder/extension/swoole_hook_sqlite.php index 4360c946..4985bd5c 100644 --- a/src/SPC/builder/extension/swoole_hook_sqlite.php +++ b/src/SPC/builder/extension/swoole_hook_sqlite.php @@ -25,11 +25,6 @@ class swoole_hook_sqlite extends Extension } } - public function getUnixConfigureArg(bool $shared = false): string - { - return ''; // enabled in swoole.php - } - public function runCliCheckUnix(): void { // skip if not enable swoole @@ -46,15 +41,4 @@ class swoole_hook_sqlite extends Extension throw new ValidationException('swoole sqlite hook is not enabled correctly.', validation_module: 'Extension swoole sqlite hook availability check'); } } - - public function getSharedExtensionLoadString(): string - { - $ret = parent::getSharedExtensionLoadString(); - return str_replace(' -d "extension=' . $this->name . '"', '', $ret); - } - - public function buildShared(): void - { - // nothing to do, it's built into swoole - } }