summaryrefslogtreecommitdiffstats
path: root/php-xcache-dev.spec
blob: 45afcc4833a5c0c56b731a314573dd0f331826b8 (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
%global ext_name     xcache

Summary:       Fast, stable PHP opcode cacher
Name:          php-xcache
Version:       2.0.1
Release:       3%{?dist}
License:       BSD
Group:         Development/Languages
URL:           http://xcache.lighttpd.net/

Source0:       http://xcache.lighttpd.net/pub/Releases/%{version}/%{ext_name}-%{version}.tar.gz
Source1:       xcache-admin.conf
Source2:       xcache-coverager.conf

# Specific RPM extension PATH
Patch0:        %{ext_name}-conf.patch

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

Requires:      php(zend-abi) = %{php_zend_api}
Requires:      php(api) = %{php_core_api}

# Only one opcode cache
Conflicts:     php-pecl-apc, php-eaccelerator

# Other third party repo stuff
Obsoletes: php53-xcache
Obsoletes: php53u-xcache
%if "%{php_version}" > "5.4"
Obsoletes: php54-xcache
%endif

# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}


%description
XCache is a fast, stable  PHP opcode 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. 

It overcomes a lot of problems that has been with other competing opcachers
such as being able to be used with new  PHP versions. 


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

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

This requires to configure xcache.admin.user and xcache.admin.pass options
in XCache configuration file (xcache.ini).


%package -n xcache-coverager
Summary:       XCache PHP Code Coverage Viewer
Group:         Development/Languages
Requires:      mod_php, httpd
Requires:      %{name} = %{version}-%{release}
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
BuildArch:     noarch
%endif
Obsoletes:     php-xcache-admin < %{version}-%{release}
Provides:      php-xcache-admin = %{version}-%{release}

%description -n xcache-coverager
This package provides the XCache PHP Code Coverage Viewer web application,
with Apache configuration, on http://localhost/xcache-coverager

This requires to configure xcache.coveragedump_directory option in XCache
configuration file (xcache.ini).


%prep
%setup -q -c 

# rename source folder
mv %{ext_name}-%{version} nts

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

# duplicate for ZTS build
cp -pr nts zts

cd nts
%patch0 -p0 -b .upstream
sed -e 's:@EXTDIR@:%{php_extdir}:'    -i %{ext_name}.ini

cd ../zts
%patch0 -p0 -b .upstream
sed -e 's:@EXTDIR@:%{php_ztsextdir}:' -i %{ext_name}.ini


%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}

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}


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

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

# Install the admin stuff
install -d -m 755 %{buildroot}%{_datadir}/xcache/admin
install -p -m 644 nts/admin/* %{buildroot}%{_datadir}/xcache/admin
install -D -m 644 -p %{SOURCE1} \
        %{buildroot}%{_sysconfdir}/httpd/conf.d/xcache-admin.conf

# Install the coverager stuff
install -d -m 755 %{buildroot}%{_datadir}/xcache/coverager
install -p -m 644 nts/coverager/* %{buildroot}%{_datadir}/xcache/coverager
install -D -m 644 -p %{SOURCE2} \
        %{buildroot}%{_sysconfdir}/httpd/conf.d/xcache-coverager.conf


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

%{__ztsphp} --no-php-ini \
    --define zend_extension=%{buildroot}%{php_ztsextdir}/%{ext_name}.so \
    --modules | grep XCache


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc nts/{AUTHORS,ChangeLog,COPYING,README,THANKS}
%config(noreplace) %{_sysconfdir}/php.d/%{ext_name}.ini
%config(noreplace) %{php_ztsinidir}/%{ext_name}.ini
%{php_extdir}/%{ext_name}.so
%{php_ztsextdir}/%{ext_name}.so

%files -n xcache-admin
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/httpd/conf.d/xcache-admin.conf
%dir %{_datadir}/xcache
%{_datadir}/xcache/admin

%files -n xcache-coverager
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/httpd/conf.d/xcache-coverager.conf
%dir %{_datadir}/xcache
%{_datadir}/xcache/coverager


%changelog
* 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