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