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