change extension_dir, the env variable only has an effect during compilation

This commit is contained in:
DubbleClick 2025-05-31 21:01:22 +07:00
parent ad3860981a
commit 3052b1cca5
5 changed files with 5 additions and 6 deletions

View File

@ -243,6 +243,10 @@ class Extension
}
}
if ($ret !== '') {
$ret = ' -d "extension_dir=' . BUILD_MODULES_PATH . '"' . $ret;
}
return $ret;
}
@ -255,7 +259,6 @@ class Extension
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
// If check failed, throw RuntimeException
$sharedExtensions = $this->getSharedExtensionLoadString();
putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH);
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);

View File

@ -26,8 +26,7 @@ class mbregex extends Extension
*/
public function runCliCheckUnix(): void
{
$sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=mbstring"' : '';
putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH);
$sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? '-d "extension_dir=' . BUILD_MODULES_PATH . '" -d "extension=mbstring"' : '';
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');

View File

@ -29,7 +29,6 @@ class swoole_hook_mysql extends Extension
if ($this->builder->getExt('swoole') === null) {
return;
}
putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH);
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false);
$out = implode('', $out);
if ($ret !== 0) {

View File

@ -38,7 +38,6 @@ class swoole_hook_pgsql extends Extension
return;
}
$sharedExtensions = $this->getSharedExtensionLoadString();
putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH);
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
$out = implode('', $out);
if ($ret !== 0) {

View File

@ -38,7 +38,6 @@ class swoole_hook_sqlite extends Extension
return;
}
$sharedExtensions = $this->getSharedExtensionLoadString();
putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH);
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
$out = implode('', $out);
if ($ret !== 0) {