3 %bcond_without tests # build without tests
5 %define php_name php%{?php_suffix}
6 %define modname mongodb
7 Summary: MongoDB driver for PHP
8 Name: %{php_name}-pecl-%{modname}
12 Group: Development/Languages/PHP
13 Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
14 # Source0-md5: c3b36a24b7e47e3b4148cd9bc4d163b2
17 URL: https://pecl.php.net/package/mongodb
18 BuildRequires: %{php_name}-cli
19 BuildRequires: %{php_name}-devel >= 4:5.4.0
20 BuildRequires: %{php_name}-json
21 BuildRequires: %{php_name}-pcre
22 BuildRequires: %{php_name}-spl
23 BuildRequires: cyrus-sasl-devel
24 BuildRequires: libbson-devel >= 1.5
25 BuildRequires: mongo-c-driver-devel >= 1.5
26 BuildRequires: openssl-devel
27 BuildRequires: rpmbuild(macros) >= 1.666
28 Requires: %{php_name}-json
29 Requires: %{php_name}-pcre
30 Requires: %{php_name}-spl
31 %{?requires_php_extension}
32 Provides: php(%{modname}) = %{version}
33 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36 The purpose of this driver is to provide exceptionally thin glue
37 between MongoDB and PHP, implementing only fundemental and
38 performance-critical components necessary to build a fully-functional
43 mv %{modname}-%{version}/* .
47 # Sanity check, really often broken
48 extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h)
49 if test "x${extver}" != "x%{version}"; then
50 : Error: Upstream extension version is ${extver}, expecting %{version}.
55 # Ensure we use system library
56 # Need to be removed only after phpize because of m4_include
57 %{__rm} -r src/libbson
58 %{__rm} -r src/libmongoc
67 # simple module load test, always enabled
69 -d extension_dir=modules \
70 -d extension=%{php_extensiondir}/pcre.so \
71 -d extension=%{php_extensiondir}/spl.so \
72 -d extension=%{php_extensiondir}/json.so \
73 -d extension=%{modname}.so \
75 grep %{modname} modules.log
78 cat <<'EOF' > run-tests.sh
80 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
82 PHP_EXECUTABLE=%{__php} \
83 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
84 RUN_TESTS_SETTINGS="-q $*"
92 rm -rf $RPM_BUILD_ROOT
94 EXTENSION_DIR=%{php_extensiondir} \
95 INSTALL_ROOT=$RPM_BUILD_ROOT
97 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
98 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
101 rm -rf $RPM_BUILD_ROOT
104 %defattr(644,root,root,755)
105 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
106 %attr(755,root,root) %{php_extensiondir}/%{modname}.so