]>
Commit | Line | Data |
---|---|---|
e6a2fe32 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define php_name php%{?php_suffix} | |
6 | %define modname mongodb | |
7 | Summary: MongoDB driver for PHP | |
8 | Name: php-pecl-%{modname} | |
9 | Version: 1.2.8 | |
10 | Release: 0.1 | |
11 | License: Apache v2.0 | |
12 | Group: Development/Languages/PHP | |
13 | Source0: http://pecl.php.net/get/%{modname}-%{version}.tgz | |
14 | # Source0-md5: 7c871c22fe7c8afdbe055e24075e95cf | |
15 | URL: https://pecl.php.net/package/mongodb | |
16 | BuildRequires: %{php_name}-devel | |
17 | BuildRequires: rpmbuild(macros) >= 1.666 | |
18 | %if %{with tests} | |
19 | BuildRequires: %{php_name}-json | |
20 | %endif | |
21 | BuildRequires: cyrus-sasl-devel | |
22 | BuildRequires: openssl-devel | |
23 | BuildRequires: pkgconfig(libbson-1.0) >= 1.5 | |
24 | BuildRequires: pkgconfig(libmongoc-1.0) >= 1.5 | |
25 | Requires: %{php_name}-json | |
26 | %{?requires_php_extension} | |
27 | Provides: php(%{modname}) = %{version} | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
31 | The purpose of this driver is to provide exceptionally thin glue | |
32 | between MongoDB and PHP, implementing only fundemental and | |
33 | performance-critical components necessary to build a fully-functional | |
34 | MongoDB driver. | |
35 | ||
36 | %prep | |
37 | %setup -qc | |
38 | mv %{modname}-%{version}/* . | |
39 | ||
40 | # Create configuration file | |
41 | cat << 'EOF' > %{modname}.ini | |
42 | ; Enable %{summary} extension module | |
43 | extension=%{modname}.so | |
44 | ||
45 | ; Configuration | |
46 | ;mongodb.debug='' | |
47 | EOF | |
48 | ||
49 | %build | |
50 | # Sanity check, really often broken | |
51 | extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h) | |
52 | if test "x${extver}" != "x%{version}"; then | |
53 | : Error: Upstream extension version is ${extver}, expecting %{version}. | |
54 | exit 1 | |
55 | fi | |
56 | ||
57 | phpize | |
58 | # Ensure we use system library | |
59 | # Need to be removed only after phpize because of m4_include | |
60 | %{__rm} -r src/libbson | |
61 | %{__rm} -r src/libmongoc | |
62 | ||
63 | %configure \ | |
64 | --with-libbson \ | |
65 | --with-libmongoc \ | |
66 | --enable-mongodb | |
67 | ||
68 | %{__make} | |
69 | ||
70 | %if %{with tests} | |
71 | # simple module load test | |
72 | %{__php} -n -q \ | |
73 | -d extension_dir=modules \ | |
74 | -d extension=%{php_extensiondir}/json.so \ | |
75 | -d extension=%{modname}.so \ | |
76 | -m > modules.log | |
77 | grep %{modname} modules.log | |
78 | ||
79 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
80 | %{__make} test \ | |
81 | PHP_EXECUTABLE=%{__php} \ | |
82 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="json" | |
83 | %endif | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | %{__make} install \ | |
88 | EXTENSION_DIR=%{php_extensiondir} \ | |
89 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
90 | ||
91 | cp -p %{modname}.ini $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
92 | ||
93 | %clean | |
94 | rm -rf $RPM_BUILD_ROOT | |
95 | ||
96 | %files | |
97 | %defattr(644,root,root,755) | |
98 | %doc LICENSE | |
99 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini | |
100 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so |