mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add ext-mongodb
This commit is contained in:
parent
e523fff0ab
commit
91ee94f349
21
config/pkg/ext/ext-mongodb.yml
Normal file
21
config/pkg/ext/ext-mongodb.yml
Normal file
@ -0,0 +1,21 @@
|
||||
ext-mongodb:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghrel
|
||||
repo: mongodb/mongo-php-driver
|
||||
match: mongodb.+\.tgz
|
||||
extract: php-src/ext/mongodb
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
suggests:
|
||||
- icu
|
||||
- openssl
|
||||
- zstd
|
||||
- zlib
|
||||
frameworks:
|
||||
- CoreFoundation
|
||||
- Security
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
38
src/Package/Extension/mongodb.php
Normal file
38
src/Package/Extension/mongodb.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('mongodb')]
|
||||
class mongodb extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';
|
||||
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
||||
$arg .= ' --with-mongodb-sasl=no ';
|
||||
if ($installer->getLibraryPackage('openssl')) {
|
||||
$arg .= '--with-mongodb-ssl=openssl';
|
||||
}
|
||||
$arg .= $installer->getLibraryPackage('icu') ? ' --with-mongodb-icu=yes ' : ' --with-mongodb-icu=no ';
|
||||
$arg .= $installer->getLibraryPackage('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
||||
// $arg .= $installer->getLibraryPackage('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
||||
$arg .= $installer->getLibraryPackage('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
||||
return clean_spaces($arg);
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$parent = parent::getSharedExtensionEnv();
|
||||
$parent['CFLAGS'] .= ' -std=c17';
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user