]> git.pld-linux.org Git - packages/php-pecl-mongodb.git/blob - php-pecl-mongodb.spec
clean sources in prep except .m4
[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 # Ensure we use system library
53 # remove only C sources, m4 resources needed for phpize via m4_include
54 find \
55         src/libbson \
56         src/libmongoc \
57         -name '*.[ch]' | xargs %{__rm} -v
58
59 %build
60 # Sanity check, really often broken
61 extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h)
62 if test "x${extver}" != "x%{version}"; then
63         : Error: Upstream extension version is ${extver}, expecting %{version}.
64         exit 1
65 fi
66
67 phpize
68
69 %configure \
70         --with-libbson \
71         --with-libmongoc \
72         --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \
73         --enable-mongodb
74
75 %{__make}
76
77 # simple module load test, always enabled
78 %{__php} -n -q \
79         -d extension_dir=modules \
80         -d extension=%{php_extensiondir}/pcre.so \
81         -d extension=%{php_extensiondir}/spl.so \
82         -d extension=%{php_extensiondir}/json.so \
83         -d extension=%{modname}.so \
84         -m > modules.log
85 grep %{modname} modules.log
86
87 %if %{with tests}
88 cat <<'EOF' > run-tests.sh
89 #!/bin/sh
90 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
91 exec %{__make} test \
92         PHP_EXECUTABLE=%{__php} \
93         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
94         RUN_TESTS_SETTINGS="-q $*"
95 EOF
96 chmod +x run-tests.sh
97
98 ./run-tests.sh
99 %endif
100
101 %install
102 rm -rf $RPM_BUILD_ROOT
103 %{__make} install \
104         EXTENSION_DIR=%{php_extensiondir} \
105         INSTALL_ROOT=$RPM_BUILD_ROOT
106
107 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
108 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
109
110 %clean
111 rm -rf $RPM_BUILD_ROOT
112
113 %files
114 %defattr(644,root,root,755)
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.036229 seconds and 3 git commands to generate.