mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
fixes for more configure args
This commit is contained in:
parent
495e868a71
commit
7698ceb108
@ -77,12 +77,6 @@
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
],
|
||||
"shared-ext-depends": [
|
||||
"libxml",
|
||||
"xmlreader",
|
||||
"xmlwriter",
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"ds": {
|
||||
@ -331,13 +325,16 @@
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "none",
|
||||
"ext-depends": [
|
||||
"xml"
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
},
|
||||
"mbregex": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"target": [
|
||||
"static"
|
||||
],
|
||||
"ext-depends": [
|
||||
"mbstring"
|
||||
],
|
||||
@ -1083,6 +1080,9 @@
|
||||
"arg-type-windows": "enable",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
|
||||
@ -80,7 +80,7 @@ class Extension
|
||||
{
|
||||
$_name = str_replace('_', '-', $this->name);
|
||||
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-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ',
|
||||
'none', 'custom' => '',
|
||||
|
||||
@ -13,7 +13,7 @@ class dba extends Extension
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$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
|
||||
|
||||
@ -18,9 +18,7 @@ class dom extends Extension
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-dom' . ($shared ? '=shared' : '');
|
||||
if (!$shared) {
|
||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||
return $arg;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class mbstring extends Extension
|
||||
{
|
||||
public function getConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-mbstring';
|
||||
$arg = '--enable-mbstring' . ($shared ? '=shared' : '');
|
||||
if ($this->builder->getExt('mbregex') === null) {
|
||||
$arg .= ' --disable-mbregex';
|
||||
} else {
|
||||
|
||||
@ -12,6 +12,6 @@ class odbc extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-unixODBC=' . BUILD_ROOT_PATH;
|
||||
return '--with-unixODBC=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ class pdo_odbc extends Extension
|
||||
|
||||
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
|
||||
|
||||
@ -36,9 +36,9 @@ class pgsql extends Extension
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -27,7 +27,7 @@ class readline extends Extension
|
||||
|
||||
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
|
||||
|
||||
@ -7,6 +7,7 @@ namespace SPC\builder\extension;
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
|
||||
#[CustomExt('sqlsrv')]
|
||||
class sqlsrv extends Extension
|
||||
@ -33,4 +34,35 @@ class sqlsrv extends Extension
|
||||
}
|
||||
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();
|
||||
} }
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ namespace SPC\builder\extension;
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
|
||||
#[CustomExt('xhprof')]
|
||||
class xhprof extends Extension
|
||||
@ -30,4 +31,35 @@ class xhprof extends Extension
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,7 +249,11 @@ class BuildPHPCommand extends BuildCommand
|
||||
if (!empty($shared_extensions)) {
|
||||
foreach ($shared_extensions as $ext) {
|
||||
$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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user