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