]> git.pld-linux.org Git - packages/php-pecl-memcached.git/blob - php-pecl-memcached.spec
d3731ca211e200d2703f7be2c5ca36ba35bdd8f4
[packages/php-pecl-memcached.git] / php-pecl-memcached.spec
1 #
2 # Conditional build:
3 %bcond_without  igbinary        # memcached igbinary serializer support
4 %bcond_without  json            # memcached json serializer support
5 %bcond_without  msgpack         # memcached msgpack serializer support
6 %bcond_without  sasl            # memcached sasl support
7 %bcond_without  session         # memcached session handler support
8 %bcond_without  tests           # build without tests
9
10 %define         php_name        php%{?php_suffix}
11 %define         modname memcached
12 Summary:        Interface to memcached via libmemcached library
13 Summary(pl.UTF-8):      Interfejs do memcached z użyciem biblioteki libmemcached
14 Name:           %{php_name}-pecl-%{modname}
15 # for PHP < 7 support see 2.2.x branch
16 Version:        3.0.0
17 Release:        1
18 License:        PHP 3.01
19 Group:          Development/Languages/PHP
20 Source0:        https://github.com/php-memcached-dev/php-memcached/archive/php7/%{modname}-%{version}.tar.gz
21 # Source0-md5:  df81b124ac101bd21922deb0ef2ad9b9
22 URL:            http://pecl.php.net/package/memcached/
23 BuildRequires:  %{php_name}-devel >= 4:7.0.0
24 %{?with_igbinary:BuildRequires: %{php_name}-pecl-igbinary-devel}
25 %{?with_msgpack:BuildRequires:  %{php_name}-pecl-msgpack-devel}
26 %{?with_sasl:BuildRequires:     cyrus-sasl-devel}
27 BuildRequires:  fastlz-devel
28 BuildRequires:  libmemcached-devel >= 1.0.18
29 BuildRequires:  pkgconfig
30 BuildRequires:  re2c
31 BuildRequires:  rpmbuild(macros) >= 1.650
32 BuildRequires:  zlib-devel
33 %if %{with tests}
34 BuildRequires:  %{php_name}-cli
35 BuildRequires:  %{php_name}-pcre
36 %{?with_igbinary:BuildRequires: %{php_name}-pecl-igbinary}
37 %{?with_msgpack:BuildRequires:  %{php_name}-pecl-msgpack}
38 %{?with_session:BuildRequires:  %{php_name}-session}
39 BuildRequires:  %{php_name}-spl
40 BuildRequires:  memcached
41 %endif
42 %{?requires_php_extension}
43 Suggests:       %{php_name}-pecl-igbinary
44 Suggests:       %{php_name}-pecl-msgpack
45 Suggests:       %{php_name}-session
46 Provides:       php(%{modname}) = %{version}
47 Obsoletes:      php-pecl-memcached < 2.2.0-1
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %description
51 This extension uses libmemcached library to provide API for
52 communicating with memcached servers.
53
54 %description -l pl.UTF-8
55 Rozszerzenie to wykorzystuje bibliotekę memcached w celu udostępnienia
56 API do komunikacji z serwerami memcached.
57
58 %prep
59 %setup -qc
60 mv php-memcached-*/{.??*,*} .
61
62 rm fastlz/fastlz.c
63
64 # redirect tests fail (the actual tests they redirect work)
65 rm tests/experimental/serializer_igbinary.phpt
66 rm tests/experimental/serializer_json.phpt
67
68 # skip failed tests
69 xfail() {
70         t=$(echo "$*" | sed -rne 's/.+\[(.+)\]/\1/p')
71
72         test -f "$t"
73         cat >> $t <<-EOF
74
75         --XFAIL--
76         Skip
77         EOF
78 }
79
80 %if 0
81 xfail Memcached::getByKey with CAS [tests/experimental/get_bykey_cas.phpt]
82 xfail Memcached::getDelayedByKey with CAS [tests/experimental/getdelayed_bykey_cas.phpt]
83 xfail Memcached::getDelayedByKey with callback exception [tests/experimental/getdelayed_cbthrows.phpt]
84 xfail Memcached::getMulti bad server [tests/experimental/getmulti_badserver.phpt]
85 xfail Memcached::phpinfo [tests/experimental/moduleinfo.phpt]
86 xfail Memcached::getStats [tests/experimental/stats.phpt]
87 xfail Memcached::getStats with bad server [tests/experimental/stats_badserver.phpt]
88 xfail Memcached store and fetch type and value correctness using JSON serializer [tests/types_json.phpt]
89 xfail Memcached multi store and multi fetch type and value correctness using JSON serializer [tests/types_json_multi.phpt]
90 %ifarch x32
91 xfail Memcached::addServer unix doamin socket [tests/experimental/addserver_unixdomain.phpt]
92 xfail Memcached::set/delete UDP [tests/experimental/get_udp.phpt]
93 xfail Memcached::getDelayedByKey with bad server [tests/experimental/getdelayed_badserver.phpt]
94 xfail Memcached::getServerByKey [tests/getserverbykey.phpt]
95 xfail Memcached result codes. [tests/rescode.phpt]
96 xfail Memcached::setMulti [tests/setmulti.phpt]
97 %endif
98 %endif
99
100 %build
101 phpize
102 %configure \
103         %{__enable_disable igbinary memcached-igbinary} \
104         %{__enable_disable json memcached-json} \
105         %{__enable_disable msgpack memcached-msgpack} \
106         %{__enable_disable sasl memcached-sasl} \
107         %{__enable_disable session memcached-session} \
108         --with-system-fastlz
109 %{__make}
110
111 %if %{with tests}
112 # simple module load test
113 %{__php} -n -q \
114         -d extension_dir=modules \
115         -d extension=%{php_extensiondir}/pcre.so \
116         -d extension=%{php_extensiondir}/spl.so \
117 %if %{with session}
118         -d extension=%{php_extensiondir}/session.so \
119 %endif
120 %if %{with igbinary}
121         -d extension=%{php_extensiondir}/igbinary.so \
122 %endif
123 %if %{with msgpack}
124         -d extension=%{php_extensiondir}/msgpack.so \
125 %endif
126         -d extension=%{modname}.so \
127         -m > modules.log
128 grep %{modname} modules.log
129
130 cat <<'EOF' > run-tests.sh
131 #!/bin/sh
132 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
133 exec %{__make} test \
134         PHP_EXECUTABLE=%{__php} \
135         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl%{?with_session: session}%{?with_igbinary: igbinary}%{?with_msgpack: msgpack}" \
136         RUN_TESTS_SETTINGS="-q $*"
137 EOF
138 chmod +x run-tests.sh
139
140 # Launch the Memcached service and stop it on exit
141 %{_sbindir}/memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid
142 trap 'kill $(cat memcached.pid)' EXIT
143
144 ./run-tests.sh
145 %endif
146
147 %install
148 rm -rf $RPM_BUILD_ROOT
149 %{__make} install \
150         INSTALL_ROOT=$RPM_BUILD_ROOT \
151         EXTENSION_DIR=%{php_extensiondir}
152
153 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
154 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
155 ; Enable %{modname} extension module
156 extension=%{modname}.so
157
158 EOF
159 cat %{modname}.ini >> $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
160
161 %clean
162 rm -rf $RPM_BUILD_ROOT
163
164 %post
165 %php_webserver_restart
166
167 %postun
168 if [ "$1" = 0 ]; then
169         %php_webserver_restart
170 fi
171
172 %files
173 %defattr(644,root,root,755)
174 %doc CREDITS
175 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
176 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.034142 seconds and 2 git commands to generate.