2023-04-29 18:59:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
2023-12-15 01:31:01 +08:00
|
|
|
use SPC\store\FileSystem;
|
2023-04-29 18:59:47 +08:00
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('mongodb')]
|
|
|
|
|
class mongodb extends Extension
|
|
|
|
|
{
|
2023-12-15 01:31:01 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-29 18:59:47 +08:00
|
|
|
public function getUnixConfigureArg(): string
|
|
|
|
|
{
|
2023-05-24 03:48:40 +08:00
|
|
|
$arg = ' --enable-mongodb ';
|
2023-06-27 00:59:10 +08:00
|
|
|
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
2023-05-24 03:48:40 +08:00
|
|
|
$arg .= ' --with-mongodb-sasl=no ';
|
2023-05-08 11:44:44 +08:00
|
|
|
if ($this->builder->getLib('openssl')) {
|
2023-05-24 03:48:40 +08:00
|
|
|
$arg .= '--with-mongodb-ssl=openssl';
|
2023-05-08 11:44:44 +08:00
|
|
|
}
|
2023-06-27 00:59:10 +08:00
|
|
|
$arg .= $this->builder->getLib('icu') ? ' --with-mongodb-icu=yes ' : ' --with-mongodb-icu=no ';
|
|
|
|
|
$arg .= $this->builder->getLib('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
|
|
|
|
// $arg .= $this->builder->getLib('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
|
|
|
|
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
2023-05-08 11:44:44 +08:00
|
|
|
return $arg;
|
2023-04-29 18:59:47 +08:00
|
|
|
}
|
|
|
|
|
}
|