From 91ee94f3497c8c2546631823d5680b239e5130ba Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Mar 2026 14:19:38 +0800 Subject: [PATCH] Add ext-mongodb --- config/pkg/ext/ext-mongodb.yml | 21 +++++++++++++++++ src/Package/Extension/mongodb.php | 38 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 config/pkg/ext/ext-mongodb.yml create mode 100644 src/Package/Extension/mongodb.php diff --git a/config/pkg/ext/ext-mongodb.yml b/config/pkg/ext/ext-mongodb.yml new file mode 100644 index 00000000..7cbdbb14 --- /dev/null +++ b/config/pkg/ext/ext-mongodb.yml @@ -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 diff --git a/src/Package/Extension/mongodb.php b/src/Package/Extension/mongodb.php new file mode 100644 index 00000000..3434491d --- /dev/null +++ b/src/Package/Extension/mongodb.php @@ -0,0 +1,38 @@ +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; + } +}