2 # - ix86/x32 (php -m) prints::
3 # src/mongoc/mongoc-handshake.c:478 _append_and_truncate(): precondition failed: space_for_suffix >= 0
7 %bcond_without tests # build without tests
8 %bcond_without sasl # Include Cyrus SASL support
10 %define php_name php%{?php_suffix}
11 %define modname mongodb
12 Summary: MongoDB driver for PHP
13 Name: %{php_name}-pecl-%{modname}
17 Group: Development/Languages/PHP
18 Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
19 # Source0-md5: c3b36a24b7e47e3b4148cd9bc4d163b2
22 URL: https://pecl.php.net/package/mongodb
23 BuildRequires: %{php_name}-cli
24 BuildRequires: %{php_name}-devel >= 4:5.4.0
25 BuildRequires: %{php_name}-json
26 BuildRequires: %{php_name}-pcre
27 BuildRequires: %{php_name}-spl
28 %{?with_sasl:BuildRequires: cyrus-sasl-devel}
29 BuildRequires: libbson-devel >= 1.5.0
30 BuildRequires: mongo-c-driver-devel >= 1.5.0
31 BuildRequires: openssl-devel
32 BuildRequires: rpmbuild(macros) >= 1.666
33 Requires: %{php_name}-json
34 Requires: %{php_name}-pcre
35 Requires: %{php_name}-spl
36 %{?requires_php_extension}
37 Provides: php(%{modname}) = %{version}
38 ExcludeArch: %{ix86} x32
39 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42 The purpose of this driver is to provide exceptionally thin glue
43 between MongoDB and PHP, implementing only fundemental and
44 performance-critical components necessary to build a fully-functional
49 mv %{modname}-%{version}/* .
52 # Ensure we use system library
53 # remove only C sources, m4 resources needed for phpize via m4_include
57 -name '*.[ch]' | xargs %{__rm} -v
60 # Sanity check, really often broken
61 extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h)
62 if test "x${extver}" != "x%{version}"; then
63 : Error: Upstream extension version is ${extver}, expecting %{version}.
72 --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \
77 # simple module load test, always enabled
79 -d extension_dir=modules \
80 -d extension=%{php_extensiondir}/pcre.so \
81 -d extension=%{php_extensiondir}/spl.so \
82 -d extension=%{php_extensiondir}/json.so \
83 -d extension=%{modname}.so \
85 grep %{modname} modules.log
88 cat <<'EOF' > run-tests.sh
90 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
92 PHP_EXECUTABLE=%{__php} \
93 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
94 RUN_TESTS_SETTINGS="-q $*"
102 rm -rf $RPM_BUILD_ROOT
104 EXTENSION_DIR=%{php_extensiondir} \
105 INSTALL_ROOT=$RPM_BUILD_ROOT
107 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
108 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
111 rm -rf $RPM_BUILD_ROOT
114 %defattr(644,root,root,755)
115 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
116 %attr(755,root,root) %{php_extensiondir}/%{modname}.so