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