]> git.pld-linux.org Git - packages/php-pecl-mongodb.git/blob - php-pecl-mongodb.spec
45933bb07e02aae41d74cb39a1693f605cae6312
[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_with     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:        1
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 Source1:        mongodb.ini
23 URL:            https://pecl.php.net/package/mongodb
24 BuildRequires:  %{php_name}-cli
25 BuildRequires:  %{php_name}-devel >= 4:5.4.0
26 BuildRequires:  %{php_name}-json
27 BuildRequires:  %{php_name}-pcre
28 BuildRequires:  %{php_name}-spl
29 %{?with_sasl:BuildRequires:     cyrus-sasl-devel}
30 %if %{without bundled}
31 BuildRequires:  libbson-devel >= 1.8.0
32 BuildRequires:  mongo-c-driver-devel >= 1.9
33 %endif
34 BuildRequires:  openssl-devel
35 BuildRequires:  rpmbuild(macros) >= 1.666
36 Requires:       %{php_name}-json
37 Requires:       %{php_name}-pcre
38 Requires:       %{php_name}-spl
39 %{?requires_php_extension}
40 Provides:       php(%{modname}) = %{version}
41 ExcludeArch:    %{ix86} x32
42 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44 %description
45 The purpose of this driver is to provide exceptionally thin glue
46 between MongoDB and PHP, implementing only fundemental and
47 performance-critical components necessary to build a fully-functional
48 MongoDB driver.
49
50 %prep
51 %setup -qc
52 mv %{modname}-%{version}/* .
53
54 %if %{without bundled}
55 # Ensure we use system library
56 # remove only C sources, m4 resources needed for phpize via m4_include
57 find \
58         src/libbson \
59         src/libmongoc \
60         -name '*.[ch]' | xargs %{__rm} -v
61 %endif
62
63 %build
64 # Sanity check, really often broken
65 extver=$(sed -n '/#define PHP_MONGODB_VERSION/{s/.* "//;s/".*$//;p}' php_phongo.h)
66 if test "x${extver}" != "x%{version}"; then
67         : Error: Upstream extension version is ${extver}, expecting %{version}.
68         exit 1
69 fi
70
71 phpize
72
73 %configure \
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} \
77         --with-mongodb-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \
78         --enable-mongodb
79
80 %{__make}
81
82 # simple module load test, always enabled
83 %{__php} -n -q \
84         -d extension_dir=modules \
85         -d extension=%{php_extensiondir}/pcre.so \
86         -d extension=%{php_extensiondir}/spl.so \
87         -d extension=%{php_extensiondir}/json.so \
88         -d extension=%{modname}.so \
89         -m > modules.log
90 grep %{modname} modules.log
91
92 %if %{with tests}
93 cat <<'EOF' > run-tests.sh
94 #!/bin/sh
95 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
96 exec %{__make} test \
97         PHP_EXECUTABLE=%{__php} \
98         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \
99         RUN_TESTS_SETTINGS="-q $*"
100 EOF
101 chmod +x run-tests.sh
102
103 ./run-tests.sh
104 %endif
105
106 %install
107 rm -rf $RPM_BUILD_ROOT
108 %{__make} install \
109         EXTENSION_DIR=%{php_extensiondir} \
110         INSTALL_ROOT=$RPM_BUILD_ROOT
111
112 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
113 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
114
115 %clean
116 rm -rf $RPM_BUILD_ROOT
117
118 %files
119 %defattr(644,root,root,755)
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.0688 seconds and 2 git commands to generate.