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