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_with sasl # Include Cyrus SASL support (for bundled only)
9 %bcond_without ssl # Enable TLS connections and SCRAM-SHA-1 authentication (for bundled only)
10 %bcond_with bundled # Use bundled libbson, libmongoc
12 %define php_name php%{?php_suffix}
13 %define modname mongodb
14 Summary: MongoDB driver for PHP
15 Name: %{php_name}-pecl-%{modname}
19 Group: Development/Languages/PHP
20 Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
21 # Source0-md5: 3569a12839c9908a25dac15df1ae9d18
23 URL: https://pecl.php.net/package/mongodb
24 BuildRequires: %{php_name}-cli
25 BuildRequires: %{php_name}-devel >= 4:5.5.0
26 BuildRequires: %{php_name}-json
27 BuildRequires: %{php_name}-pcre
28 BuildRequires: %{php_name}-spl
29 %{?with_sasl:BuildRequires: cyrus-sasl-devel}
30 %if %{without bundled}
31 BuildRequires: libbson-devel >= 1.11.0
32 BuildRequires: mongo-c-driver-devel >= 1.9
34 BuildRequires: openssl-devel
35 BuildRequires: rpmbuild(macros) >= 1.666
36 Requires: %{php_name}-json
37 Requires: mongo-c-driver-libs >= 1.9.3-2
38 Requires: %{php_name}-pcre
39 Requires: %{php_name}-spl
40 %{?requires_php_extension}
41 Provides: php(%{modname}) = %{version}
42 ExcludeArch: %{ix86} x32
43 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
46 The purpose of this driver is to provide exceptionally thin glue
47 between MongoDB and PHP, implementing only fundemental and
48 performance-critical components necessary to build a fully-functional
53 mv %{modname}-%{version}/* .
55 %if %{without bundled}
56 # Ensure we use system library
57 # remove only C sources, m4 resources needed for phpize via m4_include
61 -name '*.[ch]' | xargs %{__rm} -v
66 local define="$1" filename="$2"
67 awk -vdefine="$define" '/#define/ && $2 == define {print $3}' "$filename" | xargs
69 # Sanity check, really often broken
70 extver=$(get_version PHP_MONGODB_VERSION phongo_version.h)
71 if test "x${extver}" != "x%{version}"; then
72 : Error: Upstream extension version is ${extver}, expecting %{version}.
79 --with-libbson=%{?with_bundled:no}%{!?with_bundled:yes} \
80 --with-libmongoc=%{?with_bundled:no}%{!?with_bundled:yes} \
81 --with-mongodb-ssl=%{!?with_ssl:no}%{?with_ssl:openssl} \
82 --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \
87 # simple module load test, always enabled
89 -d extension_dir=modules \
90 -d extension=%{php_extensiondir}/pcre.so \
91 -d extension=%{php_extensiondir}/spl.so \
92 -d extension=%{php_extensiondir}/json.so \
93 -d extension=%{modname}.so \
95 grep %{modname} modules.log
98 cat <<'EOF' > run-tests.sh
100 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
101 exec %{__make} test \
102 PHP_EXECUTABLE=%{__php} \
103 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
104 RUN_TESTS_SETTINGS="-q $*"
106 chmod +x run-tests.sh
112 rm -rf $RPM_BUILD_ROOT
114 EXTENSION_DIR=%{php_extensiondir} \
115 INSTALL_ROOT=$RPM_BUILD_ROOT
117 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
118 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
121 rm -rf $RPM_BUILD_ROOT
124 %defattr(644,root,root,755)
125 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
126 %attr(755,root,root) %{php_extensiondir}/%{modname}.so