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