app-metrics/prometheus: add 3.1.0
[gentoo/gentoo.git] / dev-php / pecl-mongodb / pecl-mongodb-1.16.2.ebuild
blob991299c1e00eec815b25e50224f02cba959bca2a
1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 PHP_EXT_NAME="mongodb"
7 USE_PHP="php8-1 php8-2"
9 inherit php-ext-pecl-r3
11 DESCRIPTION="MongoDB database driver for PHP"
13 LICENSE="Apache-2.0"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="sasl test"
18 PHP_DEPEND="
19         php_targets_php8-1? ( dev-lang/php:8.1[ssl,zlib] )
20         php_targets_php8-2? ( dev-lang/php:8.2[ssl,zlib] )"
21 COMMON_DEPEND="${PHP_DEPEND}
22         >=dev-libs/libbson-1.18.0
23         >=dev-libs/mongo-c-driver-1.18.0[sasl?,ssl]
24         dev-libs/openssl:=
25         sasl? ( dev-libs/cyrus-sasl )"
26 DEPEND="${COMMON_DEPEND}
27         test? ( dev-db/mongodb )"
28 RDEPEND="${COMMON_DEPEND}"
29 BDEPEND="${PHP_DEPEND}
30         virtual/pkgconfig"
32 # No tests on x86 because tests require dev-db/mongodb which don't support
33 # x86 anymore (bug #645994)
34 RESTRICT="x86? ( test )
35         !test? ( test )"
37 src_configure() {
38         local PHP_EXT_ECONF_ARGS=(
39                 --enable-mongodb
40                 --with-libbson
41                 --with-libmongoc
42                 --with-mongodb-sasl=$(usex sasl)
43         )
44         php-ext-source-r3_src_configure
47 src_test() {
48         local PORT=27017
49         mongod --port ${PORT} --bind_ip 127.0.0.1 --nounixsocket --fork \
50                 --dbpath="${T}" --logpath="${T}/mongod.log" || die
51         php-ext-pecl-r3_src_test
52         kill $(<"${T}/mongod.lock")