summaryrefslogtreecommitdiffstats
path: root/php-xcache.spec
blob: b3bdb1ae2c677b18cf58894a89a9fd3c439995f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# remirepo spec file for php-xcache
# With SCL stuff, from Fedora:
#
# Fedora spec file for php-xcache
#
# Copyright (c) 2012-2017 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%if 0%{?scl:1}
%if "%{scl}" == "rh-php56"
%global sub_prefix more-php56-
%else
%global sub_prefix %{scl_prefix}
%endif
%endif

%{?scl:          %scl_package             php-xcache}
%{!?scl:         %global pkg_name         %{name}}
%{!?scl:         %global _root_sysconfdir %{_sysconfdir}}
%{!?scl:         %global _root_datadir    %{_datadir}}
%{!?scl:         %global pkg_name         %{name}}
%{!?php_inidir:  %global php_inidir       %{_sysconfdir}/php.d}
%{!?__pecl:      %global __pecl           %{_bindir}/pecl}
%{!?__php:       %global __php            %{_bindir}/php}

%global ext_name     xcache
#global svnrev       1496
#global prever       rc1
%global with_zts     0%{?__ztsphp:1}

%if "%{php_version}" < "5.6"
%global ini_name  %{ext_name}.ini
%else
%global ini_name  40-%{ext_name}.ini
%endif

Summary:       Fast, stable PHP opcode cacher
Name:          %{?sub_prefix}php-xcache
Epoch:         1
Version:       3.2.0
Release:       2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License:       BSD
Group:         Development/Languages
URL:           http://xcache.lighttpd.net/

%if 0%{?svnrev}
# svn export -r 1496 svn://svn.lighttpd.net/xcache/branches/3.2 xcache-3.2
# tar czf xcache-svn1496.tgz xcache-4.0.0
Source0:       xcache-svn%{svnrev}.tgz
%else
Source0:       http://xcache.lighttpd.net/pub/Releases/%{version}%{?prever:-%{prever}}/%{ext_name}-%{version}%{?prever:-%{prever}}.tar.gz
%endif
Source1:       xcache-httpd.conf

# Relocation of configuration files to /etc/xcache
Patch0:        xcache-config.patch
# Disable cache to allow work with php-opcache
Patch1:        xcache-cacher.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{?scl_prefix}php-devel

Requires:      %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires:      %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}

## Compat SCL (rh-php56)
Provides:      %{?scl_prefix}php-xcache         = %{epoch}:%{version}-%{release}
Provides:      %{?scl_prefix}php-xcache%{?_isa} = %{epoch}:%{version}-%{release}

%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
Obsoletes: php53-xcache  <= %{epoch}:%{version}
Obsoletes: php53u-xcache <= %{epoch}:%{version}
Obsoletes: php54-xcache  <= %{epoch}:%{version}
Obsoletes: php54w-xcache <= %{epoch}:%{version}
%if "%{php_version}" > "5.5"
Obsoletes: php55u-xcache <= %{epoch}:%{version}
Obsoletes: php55w-xcache <= %{epoch}:%{version}
%endif
%if "%{php_version}" > "5.6"
Obsoletes: php56u-xcache <= %{epoch}:%{version}
Obsoletes: php56w-xcache <= %{epoch}:%{version}
%endif
%endif

%if 0%{?fedora} < 20 && 0%{?rhel} < 7
# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
%endif


%description
XCache is a fast, stable  PHP opcode and data cacher that has been tested
and is now running on production servers under high load.

It is tested (on linux) and supported on all of the latest PHP release. 
ThreadSafe is also perfectly supported. 

NOTICE: opcode cacher is disable to allow use with php-opcache only for user
data cache. You need to edit configuration file (xcache.ini) to enable it.

Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection}.


%package -n %{?sub_prefix}xcache-admin
Summary:       XCache Administration
Group:         Development/Languages
Requires:      %{?scl_prefix}mod_php
Requires:      %{name} = %{epoch}:%{version}-%{release}
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
BuildArch:     noarch
%endif
Obsoletes:     %{?scl_prefix}php-xcache-admin     < 3.0.0
Obsoletes:     %{?scl_prefix}php-xcache-coverager < 3.0.0
Obsoletes:     %{?scl_prefix}xcache-coverager     < 3.0.0
Provides:      %{?scl_prefix}xcache-coverager     = %{version}-%{release}

%description -n %{?sub_prefix}xcache-admin
This package provides the XCache Administration web application,
with Apache configuration, on http://localhost/xcache

This requires to configure, in XCache configuration file (xcache.ini):
- xcache.admin.user
- xcache.admin.pass
- xcache.coveragedump_directory


%prep
%setup -q -c 

# rename source folder
mv xcache-%{version}%{?prever:-%{prever}} nts

%if 0%{?scl:1}
sed -e 's:%{_root_datadir}:%{_datadir}:' \
    %{SOURCE1} >xcache-httpd.conf
cd nts
sed -e 's:%{_root_sysconfdir}:%{_sysconfdir}:' \
    -e 's:%{_root_datadir}:%{_datadir}:' \
    %{PATCH0} | patch -p1
%else
cp %{SOURCE1} xcache-httpd.conf
cd nts
%patch0 -p1
%endif
%patch1 -p1

# Sanity check, really often broken
extver=$(sed -n '/define XCACHE_VERSION/{s/.* "//;s/".*$//;p}' xcache.h)
if test "x${extver}" != "x%{version}%{?svnrev:-dev}%{?prever:-%{prever}}"; then
   : Error: Upstream extension version is ${extver}, expecting %{version}%{?svnrev:-dev}%{?prever:-%{prever}}.
   exit 1
fi
cd ..

%if %{with_zts}
# duplicate for ZTS build
cp -pr nts zts
%endif


%build
# Without --enable-xcache-assembler, --enable-xcache-encoder, --enable-xcache-decoder
# This seems not yet implemented

cd nts
%{_bindir}/phpize
%configure \
    --enable-xcache \
    --enable-xcache-constant \
    --enable-xcache-optimizer \
    --enable-xcache-coverager \
    --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}

%if %{with_zts}
cd ../zts
%{_bindir}/zts-phpize
%configure \
    --enable-xcache \
    --enable-xcache-constant \
    --enable-xcache-optimizer \
    --enable-xcache-coverager \
    --with-php-config=%{_bindir}/zts-php-config
make %{?_smp_mflags}
%endif


%install
rm -rf %{buildroot}
# Install the NTS stuff
make -C nts install INSTALL_ROOT=%{buildroot}
install -D -m 644 nts/%{ext_name}.ini %{buildroot}%{php_inidir}/%{ini_name}

%if %{with_zts}
# Install the ZTS stuff
make -C zts install INSTALL_ROOT=%{buildroot}
install -D -m 644 zts/%{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif

# Install the admin stuff
install -d -m 755 %{buildroot}%{_datadir}
cp -pr nts/htdocs %{buildroot}%{_datadir}/xcache
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/cacher
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/coverager
mv %{buildroot}%{_datadir}/xcache/config.example.php \
   %{buildroot}%{_sysconfdir}/xcache
mv %{buildroot}%{_datadir}/xcache/cacher/config.example.php \
   %{buildroot}%{_sysconfdir}/xcache/cacher
mv %{buildroot}%{_datadir}/xcache/coverager/config.example.php \
   %{buildroot}%{_sysconfdir}/xcache/coverager

install -D -m 644 -p xcache-httpd.conf \
        %{buildroot}%{_root_sysconfdir}/httpd/conf.d/%{?scl_prefix}xcache.conf


%check
cd nts

# simple module load test
%{__php} --no-php-ini \
    --define extension_dir=%{buildroot}%{php_extdir}/\
    --define extension=%{ext_name}.so \
    --modules | grep XCache

# upstream unit tests
TEST_PHP_EXECUTABLE=%{__php} \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
%{__php} -n run-tests.php -n -c xcache-test.ini tests

%if %{with_zts}
cd ../zts
%{__ztsphp} --no-php-ini \
    --define extension_dir=%{buildroot}%{php_ztsextdir}/\
    --define extension=%{ext_name}.so \
    --modules | grep XCache

TEST_PHP_EXECUTABLE=%{__ztsphp} \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
%{__ztsphp} -n run-tests.php -n -c xcache-test.ini tests
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc nts/{AUTHORS,ChangeLog,COPYING,README,THANKS}
%config(noreplace) %{php_inidir}/%{ini_name}
%{php_extdir}/%{ext_name}.so

%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{ini_name}
%{php_ztsextdir}/%{ext_name}.so
%endif

%files -n %{?sub_prefix}xcache-admin
%defattr(-,root,root,-)
%config(noreplace) %{_root_sysconfdir}/httpd/conf.d/%{?scl_prefix}xcache.conf
%{_datadir}/xcache
# No real configuration files, only sample files
%{_sysconfdir}/xcache


%changelog
* Mon Jun 22 2015 Remi Collet <rcollet@redhat.com> - 0.9.38-3
- allow build against rh-php56 (as more-php56)

* Wed Dec 24 2014 Remi Collet <remi@fedoraproject.org> - 1:3.2.0-1.1
- Fedora 21 SCL mass rebuild

* Thu Sep 18 2014 Remi Collet <remi@fedoraproject.org> - 1:3.2.0-1
- Update to 3.2.0

* Tue Sep  9 2014 Remi Collet <remi@fedoraproject.org> - 1:3.2.0-0.1.rc1
- Update to 3.2.0-rc1

* Tue Sep  9 2014 Remi Collet <remi@fedoraproject.org> - 3.1.1-1
- version 3.1.1

* Mon Aug 25 2014 Remi Collet <rcollet@redhat.com> - 4.0.0-0.2.svn1496
- improve SCL build

* Sat Jun  7 2014 Remi Collet <remi@fedoraproject.org> - 4.0.0-0.1.svn1496
- Update to 4.0.0-dev for PHP 5.6
- add numerical prefix to configuration file

* Thu Jan  9 2014 Remi Collet <remi@fedoraproject.org> - 3.1.0-2
- adapt for SCL
- drop conflicts with other opcode cache
- disable opcode cache in provided configuration

* Sat Oct 12 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-1
- version 3.1.0

* Sat Oct 12 2013 Remi Collet <remi@fedoraproject.org> - 3.0.4-1
- version 3.0.4 (bugfixes)

* Fri Jun 28 2013 Remi Collet <remi@fedoraproject.org> - 3.0.3-1
- bump version, no change

* Fri Jun 14 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-0.3.svn1268
- latest changes from upstream

* Fri Jun 14 2013 Remi Collet <remi@fedoraproject.org> - 3.0.2-1
- bugfixes version

* Tue May 14 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-0.2.svn1238
- latest changes from upstream

* Tue Apr 16 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-0.1.svn1234
- update to SVN snapshot for php 5.5 compatibility

* Thu Jan 17 2013 Remi Collet <remi@fedoraproject.org> - 3.0.1-1
- bugfixes version

* Thu Nov 22 2012 Remi Collet <remi@fedoraproject.org> - 3.0.0-1.1
- upstream have fixed the sources (review #859504)

* Wed Oct 31 2012 Remi Collet <remi@fedoraproject.org> - 3.0.0-2
- rebuild for remi repo

* Wed Oct 31 2012 Remi Collet <remi@fedoraproject.org> - 3.0.0-1
- new major version
- drop xcache-coverager subpackage
- xcache-admin now provides cacher, coverager and diagnosis
- run unit tests provided by upstream

* Sat Oct 27 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-3
- drop php prefix from sub packages
- fix License
- spec cleanups

* Fri Sep 21 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-2
- add admin and coverager sub-package

* Sun Sep  9 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-1
- initial package