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