]>
Commit | Line | Data |
---|---|---|
72c237bb | 1 | # TODO |
3513b6f0 | 2 | # - libmongocrypt |
72c237bb ER |
3 | # - ix86/x32 (php -m) prints:: |
4 | # src/mongoc/mongoc-handshake.c:478 _append_and_truncate(): precondition failed: space_for_suffix >= 0 | |
5 | # Aborted | |
e6a2fe32 ER |
6 | # |
7 | # Conditional build: | |
8 | %bcond_without tests # build without tests | |
3cfe18c3 | 9 | %bcond_with sasl # Include Cyrus SASL support (for bundled only) |
3bff6cd8 | 10 | %bcond_without ssl # Enable TLS connections and SCRAM-SHA-1 authentication (for bundled only) |
efb59f9a | 11 | %bcond_with bundled # Use bundled libmongoc |
e6a2fe32 ER |
12 | |
13 | %define php_name php%{?php_suffix} | |
14 | %define modname mongodb | |
15 | Summary: MongoDB driver for PHP | |
78f25fe6 | 16 | Name: %{php_name}-pecl-%{modname} |
7023ba7d | 17 | Version: 1.9.0 |
512f9152 | 18 | Release: 1 |
e6a2fe32 ER |
19 | License: Apache v2.0 |
20 | Group: Development/Languages/PHP | |
78f25fe6 | 21 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz |
7023ba7d | 22 | # Source0-md5: 780f206f6a9399b5a4cabfd304f6ecff |
29b44cd3 | 23 | Source1: mongodb.ini |
e6a2fe32 | 24 | URL: https://pecl.php.net/package/mongodb |
2782ab30 | 25 | BuildRequires: %{php_name}-cli |
3513b6f0 | 26 | BuildRequires: %{php_name}-devel >= 4:7.0 |
e6a2fe32 | 27 | BuildRequires: %{php_name}-json |
7ac97c34 | 28 | BuildRequires: %{php_name}-pcre |
4b7a708c | 29 | BuildRequires: %{php_name}-spl |
bc94cadc | 30 | %{?with_sasl:BuildRequires: cyrus-sasl-devel} |
3cfe18c3 | 31 | %if %{without bundled} |
3513b6f0 ER |
32 | BuildRequires: libbson-devel >= 1.17.0 |
33 | BuildRequires: mongo-c-driver-devel >= 1.17.0 | |
3cfe18c3 | 34 | %endif |
e6a2fe32 | 35 | BuildRequires: openssl-devel |
a88e3999 | 36 | BuildRequires: rpmbuild(macros) >= 1.666 |
e6a2fe32 | 37 | Requires: %{php_name}-json |
8808cfb4 | 38 | %if %{without bundled} |
5b8b96e8 | 39 | Requires: mongo-c-driver-libs >= 1.15.2 |
8808cfb4 | 40 | %endif |
9d61e514 ER |
41 | Requires: %{php_name}-pcre |
42 | Requires: %{php_name}-spl | |
e6a2fe32 ER |
43 | %{?requires_php_extension} |
44 | Provides: php(%{modname}) = %{version} | |
72c237bb | 45 | ExcludeArch: %{ix86} x32 |
e6a2fe32 ER |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
47 | ||
48 | %description | |
49 | The purpose of this driver is to provide exceptionally thin glue | |
50 | between MongoDB and PHP, implementing only fundemental and | |
51 | performance-critical components necessary to build a fully-functional | |
52 | MongoDB driver. | |
53 | ||
54 | %prep | |
55 | %setup -qc | |
56 | mv %{modname}-%{version}/* . | |
57 | ||
3cfe18c3 | 58 | %if %{without bundled} |
8cb30902 ER |
59 | # Ensure we use system library |
60 | # remove only C sources, m4 resources needed for phpize via m4_include | |
61 | find \ | |
8cb30902 | 62 | src/libmongoc \ |
efb59f9a | 63 | -name '*.[ch]' -delete |
3cfe18c3 | 64 | %endif |
8cb30902 | 65 | |
279c36ad ER |
66 | xfail() { |
67 | local t=$1 | |
68 | test -f $t | |
69 | cat >> $t <<-EOF | |
70 | ||
71 | --XFAIL-- | |
72 | Skip | |
73 | EOF | |
74 | } | |
75 | ||
76 | # failed tests. investigate later | |
77 | while read line; do | |
78 | t=${line##*\[}; t=${t%\]} | |
79 | xfail $t | |
80 | done << 'EOF' | |
81 | MongoDB\BSON\Javascript::__set_state() [tests/bson/bson-javascript-set_state-001.phpt] | |
279c36ad ER |
82 | MongoDB\Driver\ReadPreference: var_export() [tests/readPreference/readpreference-var_export-001.phpt] |
83 | MongoDB\Driver\Session with wrong defaultTransactionOptions [tests/session/session_error-001.phpt] | |
84 | EOF | |
85 | ||
e6a2fe32 | 86 | %build |
512f9152 ER |
87 | get_version() { |
88 | local define="$1" filename="$2" | |
89 | awk -vdefine="$define" '/#define/ && $2 == define {print $3}' "$filename" | xargs | |
90 | } | |
e6a2fe32 | 91 | # Sanity check, really often broken |
512f9152 | 92 | extver=$(get_version PHP_MONGODB_VERSION phongo_version.h) |
e6a2fe32 ER |
93 | if test "x${extver}" != "x%{version}"; then |
94 | : Error: Upstream extension version is ${extver}, expecting %{version}. | |
95 | exit 1 | |
96 | fi | |
97 | ||
98 | phpize | |
e6a2fe32 ER |
99 | |
100 | %configure \ | |
8808cfb4 | 101 | --with-mongodb-system-libs=%{?with_bundled:no}%{!?with_bundled:yes} \ |
3cfe18c3 | 102 | --with-mongodb-ssl=%{!?with_ssl:no}%{?with_ssl:openssl} \ |
bc94cadc | 103 | --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \ |
e6a2fe32 ER |
104 | --enable-mongodb |
105 | ||
106 | %{__make} | |
107 | ||
c485d9ea | 108 | # simple module load test, always enabled |
e6a2fe32 ER |
109 | %{__php} -n -q \ |
110 | -d extension_dir=modules \ | |
e6527bb6 | 111 | %if "%php_major_version.%php_minor_version" < "7.4" |
7ac97c34 | 112 | -d extension=%{php_extensiondir}/pcre.so \ |
4b7a708c | 113 | -d extension=%{php_extensiondir}/spl.so \ |
e6527bb6 | 114 | %endif |
7ac97c34 | 115 | -d extension=%{php_extensiondir}/json.so \ |
e6a2fe32 ER |
116 | -d extension=%{modname}.so \ |
117 | -m > modules.log | |
118 | grep %{modname} modules.log | |
119 | ||
c485d9ea ER |
120 | %if %{with tests} |
121 | cat <<'EOF' > run-tests.sh | |
122 | #!/bin/sh | |
e6a2fe32 | 123 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 |
c485d9ea | 124 | exec %{__make} test \ |
e6a2fe32 | 125 | PHP_EXECUTABLE=%{__php} \ |
e6527bb6 | 126 | %if "%php_major_version.%php_minor_version" < "7.4" |
7ac97c34 | 127 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \ |
e6527bb6 ER |
128 | %else |
129 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="json" \ | |
130 | %endif | |
c485d9ea ER |
131 | RUN_TESTS_SETTINGS="-q $*" |
132 | EOF | |
133 | chmod +x run-tests.sh | |
134 | ||
135 | ./run-tests.sh | |
e6a2fe32 ER |
136 | %endif |
137 | ||
138 | %install | |
139 | rm -rf $RPM_BUILD_ROOT | |
140 | %{__make} install \ | |
141 | EXTENSION_DIR=%{php_extensiondir} \ | |
142 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
143 | ||
78f25fe6 | 144 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d |
b3161ed1 | 145 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d |
e6a2fe32 ER |
146 | |
147 | %clean | |
148 | rm -rf $RPM_BUILD_ROOT | |
149 | ||
150 | %files | |
151 | %defattr(644,root,root,755) | |
b3161ed1 | 152 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini |
e6a2fe32 | 153 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so |