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