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