mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 22:35:43 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d80406b8e0 | ||
|
|
db9645641f | ||
|
|
b3018af61c | ||
|
|
7e6c2b4432 |
@@ -347,11 +347,9 @@
|
||||
},
|
||||
"mongodb": {
|
||||
"support": {
|
||||
"Darwin": "no",
|
||||
"BSD": "wip",
|
||||
"Windows": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "mongodb",
|
||||
"arg-type": "custom",
|
||||
@@ -853,6 +851,9 @@
|
||||
"ext-depends": [
|
||||
"zlib",
|
||||
"zip"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"xml": {
|
||||
|
||||
@@ -25,7 +25,7 @@ use Symfony\Component\Console\Application;
|
||||
*/
|
||||
final class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION = '2.2.2';
|
||||
public const VERSION = '2.2.3';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -5,20 +5,11 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mongodb')]
|
||||
class mongodb extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'if test -z "$PHP_CONFIG"; then', 'if false; then');
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`', 'PHP_MONGODB_PHP_VERSION=' . $this->builder->getPHPVersion());
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`', 'PHP_MONGODB_PHP_VERSION_ID=' . $this->builder->getPHPVersionID());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = ' --enable-mongodb ';
|
||||
|
||||
@@ -12,6 +12,10 @@ class xlswriter extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-xlswriter --enable-reader';
|
||||
$arg = '--with-xlswriter --enable-reader';
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= ' --with-openssl=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,4 +144,24 @@ abstract class BaseCommand extends Command
|
||||
logger()->error($fail_msg);
|
||||
return static::FAILURE;
|
||||
}
|
||||
|
||||
protected function parseExtensionList(string $ext_list): array
|
||||
{
|
||||
$a = array_map('trim', explode(',', $ext_list));
|
||||
return array_values(array_filter($a, function ($x) {
|
||||
$filter_internals = [
|
||||
'core',
|
||||
'hash',
|
||||
'json',
|
||||
'reflection',
|
||||
'spl',
|
||||
'standard',
|
||||
];
|
||||
if (in_array(strtolower($x), $filter_internals)) {
|
||||
logger()->warning("Extension [{$x}] is an builtin extension, it will be ignored.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class BuildCliCommand extends BuildCommand
|
||||
// transform string to array
|
||||
$libraries = array_map('trim', array_filter(explode(',', $this->getOption('with-libs'))));
|
||||
// transform string to array
|
||||
$extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions'))));
|
||||
$extensions = $this->parseExtensionList($this->getArgument('extensions'));
|
||||
|
||||
// parse rule with options
|
||||
$rule = $this->parseRules();
|
||||
|
||||
@@ -68,7 +68,7 @@ class DownloadCommand extends BaseCommand
|
||||
}
|
||||
// mode: --for-extensions
|
||||
if ($for_ext = $input->getOption('for-extensions')) {
|
||||
$ext = array_map('trim', array_filter(explode(',', $for_ext)));
|
||||
$ext = $this->parseExtensionList($for_ext);
|
||||
$sources = $this->calculateSourcesByExt($ext, !$input->getOption('without-suggestions'));
|
||||
if (PHP_OS_FAMILY !== 'Windows') {
|
||||
array_unshift($sources, 'pkg-config');
|
||||
|
||||
@@ -37,7 +37,7 @@ class DumpLicenseCommand extends BaseCommand
|
||||
$dumper = new LicenseDumper();
|
||||
if ($this->getOption('for-extensions') !== null) {
|
||||
// 从参数中获取要编译的 extensions,并转换为数组
|
||||
$extensions = array_map('trim', array_filter(explode(',', $this->getOption('for-extensions'))));
|
||||
$extensions = $this->parseExtensionList($this->getOption('for-extensions'));
|
||||
// 根据提供的扩展列表获取依赖库列表并编译
|
||||
[$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions);
|
||||
$dumper->addExts($extensions);
|
||||
|
||||
@@ -19,8 +19,8 @@ $upx = true;
|
||||
|
||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||
$extensions = match (PHP_OS_FAMILY) {
|
||||
'Linux', 'Darwin' => 'libxml,swoole',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,libxml',
|
||||
'Linux', 'Darwin' => 'libxml,xlswriter,openssl,core,hash,json,standard,SPL,HASH,REFLECTION',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex',
|
||||
};
|
||||
|
||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||
|
||||
Reference in New Issue
Block a user