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: 6472d7fbfbbbd7e6efd0fc1011e4b7b5
21 URL: https://pecl.php.net/package/mongodb
22 BuildRequires: %{php_name}-cli
23 BuildRequires: %{php_name}-devel >= 4:5.4.0
24 BuildRequires: %{php_name}-json
25 BuildRequires: %{php_name}-pcre
26 BuildRequires: %{php_name}-spl
27 %{?with_sasl:BuildRequires: cyrus-sasl-devel}
28 BuildRequires: libbson-devel >= 1.8.0
29 BuildRequires: mongo-c-driver-devel >= 1.8.0
30 BuildRequires: openssl-devel
31 BuildRequires: rpmbuild(macros) >= 1.666
32 Requires: %{php_name}-json
33 Requires: %{php_name}-pcre
34 Requires: %{php_name}-spl
35 %{?requires_php_extension}
36 Provides: php(%{modname}) = %{version}
37 ExcludeArch: %{ix86} x32
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 The purpose of this driver is to provide exceptionally thin glue
42 between MongoDB and PHP, implementing only fundemental and
43 performance-critical components necessary to build a fully-functional
48 mv %{modname}-%{version}/* .
50 # Ensure we use system library
51 # remove only C sources, m4 resources needed for phpize via m4_include
55 -name '*.[ch]' | xargs %{__rm} -v
58 # Sanity check, really often broken
59 extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h)
60 if test "x${extver}" != "x%{version}"; then
61 : Error: Upstream extension version is ${extver}, expecting %{version}.
70 --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \
75 # simple module load test, always enabled
77 -d extension_dir=modules \
78 -d extension=%{php_extensiondir}/pcre.so \
79 -d extension=%{php_extensiondir}/spl.so \
80 -d extension=%{php_extensiondir}/json.so \
81 -d extension=%{modname}.so \
83 grep %{modname} modules.log
86 cat <<'EOF' > run-tests.sh
88 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
90 PHP_EXECUTABLE=%{__php} \
91 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
92 RUN_TESTS_SETTINGS="-q $*"
100 rm -rf $RPM_BUILD_ROOT
102 EXTENSION_DIR=%{php_extensiondir} \
103 INSTALL_ROOT=$RPM_BUILD_ROOT
105 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
106 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
109 rm -rf $RPM_BUILD_ROOT
112 %defattr(644,root,root,755)
113 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
114 %attr(755,root,root) %{php_extensiondir}/%{modname}.so