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