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