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