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