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