]> git.pld-linux.org Git - packages/php-pecl-msgpack.git/blob - php-pecl-msgpack.spec
add run-test wrapper
[packages/php-pecl-msgpack.git] / php-pecl-msgpack.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4
5 %define         php_name        php%{?php_suffix}
6 %define         modname msgpack
7 Summary:        PHP extension for interfacing with MessagePack
8 Name:           %{php_name}-pecl-%{modname}
9 Version:        2.0.1
10 Release:        1
11 License:        PHP 3.01
12 Group:          Development/Languages/PHP
13 Source0:        http://pecl.php.net/get/%{modname}-%{version}.tgz
14 # Source0-md5:  4d1db4592ffa4101601aefc794191de5
15 URL:            http://pecl.php.net/package/msgpack/
16 BuildRequires:  %{php_name}-devel
17 BuildRequires:  rpmbuild(macros) >= 1.666
18 %if %{with tests}
19 BuildRequires:  %{php_name}-cli
20 BuildRequires:  %{php_name}-pcre
21 BuildRequires:  %{php_name}-session
22 BuildRequires:  %{php_name}-spl
23 %endif
24 %{?requires_php_extension}
25 Requires:       %{php_name}-session
26 Provides:       php(msgpack) = %{version}
27 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28
29 %description
30 This extension provide API for communicating with MessagePack
31 serialization.
32
33 MessagePack is a binary-based efficient object serialization library.
34 It enables to exchange structured objects between many languages like
35 JSON. But unlike JSON, it is very fast and small.
36
37 %prep
38 %setup -qc
39 mv %{modname}-%{version}/* .
40
41 %build
42 phpize
43 %configure
44 %{__make}
45
46 %if %{with tests}
47 # simple module load test
48 %{__php} -n -q \
49         -d extension_dir=modules \
50         -d extension=%{php_extensiondir}/pcre.so \
51         -d extension=%{php_extensiondir}/spl.so \
52         -d extension=%{php_extensiondir}/session.so \
53         -d extension=%{modname}.so \
54         -m > modules.log
55 grep %{modname} modules.log
56
57 cat <<'EOF' > run-tests.sh
58 #!/bin/sh
59 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
60 exec %{__make} test \
61         PHP_EXECUTABLE=%{__php} \
62         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl session" \
63         RUN_TESTS_SETTINGS="-q $*"
64 EOF
65 chmod +x run-tests.sh
66
67 ./run-tests.sh
68 %endif
69
70 %install
71 rm -rf $RPM_BUILD_ROOT
72 %{__make} install \
73         EXTENSION_DIR=%{php_extensiondir} \
74         INSTALL_ROOT=$RPM_BUILD_ROOT
75
76 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
77 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
78 ; Enable %{modname} extension module
79 extension=%{modname}.so
80 EOF
81
82 # no -devel package yet
83 %{__rm} $RPM_BUILD_ROOT%{_includedir}/php/ext/msgpack/php_msgpack.h
84
85 %clean
86 rm -rf $RPM_BUILD_ROOT
87
88 %post
89 %php_webserver_restart
90
91 %postun
92 if [ "$1" = 0 ]; then
93         %php_webserver_restart
94 fi
95
96 %files
97 %defattr(644,root,root,755)
98 %doc CREDITS EXPERIMENTAL
99 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
100 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.084779 seconds and 3 git commands to generate.