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