fixes for more configure args

This commit is contained in:
DubbleClick 2025-05-21 14:10:56 +07:00
parent 495e868a71
commit 7698ceb108
12 changed files with 86 additions and 20 deletions

View File

@ -77,12 +77,6 @@
], ],
"ext-depends-windows": [ "ext-depends-windows": [
"xml" "xml"
],
"shared-ext-depends": [
"libxml",
"xmlreader",
"xmlwriter",
"xml"
] ]
}, },
"ds": { "ds": {
@ -331,13 +325,16 @@
}, },
"type": "builtin", "type": "builtin",
"arg-type": "none", "arg-type": "none",
"ext-depends": [ "target": [
"xml" "static"
] ]
}, },
"mbregex": { "mbregex": {
"type": "builtin", "type": "builtin",
"arg-type": "custom", "arg-type": "custom",
"target": [
"static"
],
"ext-depends": [ "ext-depends": [
"mbstring" "mbstring"
], ],
@ -1083,6 +1080,9 @@
"arg-type-windows": "enable", "arg-type-windows": "enable",
"lib-depends": [ "lib-depends": [
"zlib" "zlib"
],
"target": [
"static"
] ]
}, },
"zstd": { "zstd": {

View File

@ -80,7 +80,7 @@ class Extension
{ {
$_name = str_replace('_', '-', $this->name); $_name = str_replace('_', '-', $this->name);
return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
'enable' => '--enable-' . $_name . ' ', 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ',
'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ',
'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ', 'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ',
'none', 'custom' => '', 'none', 'custom' => '',

View File

@ -13,7 +13,7 @@ class dba extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : ''; $qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : '';
return '--enable-dba' . $qdbm; return '--enable-dba' . ($shared ? '=shared' : '') . $qdbm;
} }
public function getWindowsConfigureArg(bool $shared = false): string public function getWindowsConfigureArg(bool $shared = false): string

View File

@ -18,9 +18,7 @@ class dom extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$arg = '--enable-dom' . ($shared ? '=shared' : ''); $arg = '--enable-dom' . ($shared ? '=shared' : '');
if (!$shared) { $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
}
return $arg; return $arg;
} }

View File

@ -12,7 +12,7 @@ class mbstring extends Extension
{ {
public function getConfigureArg(bool $shared = false): string public function getConfigureArg(bool $shared = false): string
{ {
$arg = '--enable-mbstring'; $arg = '--enable-mbstring' . ($shared ? '=shared' : '');
if ($this->builder->getExt('mbregex') === null) { if ($this->builder->getExt('mbregex') === null) {
$arg .= ' --disable-mbregex'; $arg .= ' --disable-mbregex';
} else { } else {

View File

@ -12,6 +12,6 @@ class odbc extends Extension
{ {
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
return '--with-unixODBC=' . BUILD_ROOT_PATH; return '--with-unixODBC=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
} }
} }

View File

@ -19,7 +19,7 @@ class pdo_odbc extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
return '--with-pdo-odbc=unixODBC,' . BUILD_ROOT_PATH; return '--with-pdo-odbc=' . ($shared ? 'shared,' : '') . 'unixODBC,' . BUILD_ROOT_PATH;
} }
public function getWindowsConfigureArg(bool $shared = false): string public function getWindowsConfigureArg(bool $shared = false): string

View File

@ -36,9 +36,9 @@ class pgsql extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
if ($this->builder->getPHPVersionID() >= 80400) { if ($this->builder->getPHPVersionID() >= 80400) {
return '--with-pgsql PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"'; return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"';
} }
return '--with-pgsql=' . BUILD_ROOT_PATH; return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
} }
/** /**

View File

@ -27,7 +27,7 @@ class readline extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; return '--without-libedit --with-readline=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
} }
public function buildUnixShared(): void public function buildUnixShared(): void

View File

@ -7,6 +7,7 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
use SPC\util\SPCConfigUtil;
#[CustomExt('sqlsrv')] #[CustomExt('sqlsrv')]
class sqlsrv extends Extension class sqlsrv extends Extension
@ -33,4 +34,35 @@ class sqlsrv extends Extension
} }
return false; return false;
} }
public function buildUnixShared(): void
{
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
$env = [
'CFLAGS' => $config['cflags'],
'CXXFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'LIBS' => $config['libs'],
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
// prepare configure args
shell()->cd($this->source_dir)
->setEnv($env)
->execWithEnv(BUILD_BIN_PATH . '/phpize');
if ($this->patchBeforeSharedConfigure()) {
logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure');
}
shell()->cd($this->source_dir)
->setEnv($env)
->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic')
->execWithEnv('make clean')
->execWithEnv('make -j' . $this->builder->concurrency)
->execWithEnv('make install');
// check shared extension with php-cli
if (file_exists(BUILD_BIN_PATH . '/php')) {
$this->runSharedExtensionCheckUnix();
} }
} }

View File

@ -7,6 +7,7 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
use SPC\util\SPCConfigUtil;
#[CustomExt('xhprof')] #[CustomExt('xhprof')]
class xhprof extends Extension class xhprof extends Extension
@ -30,4 +31,35 @@ class xhprof extends Extension
} }
return false; return false;
} }
public function buildUnixShared(): void
{
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
$env = [
'CFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'LIBS' => $config['libs'],
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
// prepare configure args
shell()->cd($this->source_dir . '/extension')
->setEnv($env)
->execWithEnv(BUILD_BIN_PATH . '/phpize');
if ($this->patchBeforeSharedConfigure()) {
logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure');
}
shell()->cd($this->source_dir . '/extension')
->setEnv($env)
->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic')
->execWithEnv('make clean')
->execWithEnv('make -j' . $this->builder->concurrency)
->execWithEnv('make install');
// check shared extension with php-cli
if (file_exists(BUILD_BIN_PATH . '/php')) {
$this->runSharedExtensionCheckUnix();
}
}
} }

View File

@ -249,7 +249,11 @@ class BuildPHPCommand extends BuildCommand
if (!empty($shared_extensions)) { if (!empty($shared_extensions)) {
foreach ($shared_extensions as $ext) { foreach ($shared_extensions as $ext) {
$path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so"); $path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so");
logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}"); if (file_exists("{$build_root_path}/modules/{$ext}.so")) {
logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}");
} else {
logger()->warning("Shared extension [{$ext}] not found, please check!");
}
} }
} }