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