1 |
%define _disable_ld_no_undefined 1 |
2 |
|
3 |
%define realname apc (Alternative PHP Cache) |
4 |
%define modname apc |
5 |
%define dirname %{modname} |
6 |
%define soname %{modname}.so |
7 |
%define inifile 99_%{modname}.ini |
8 |
|
9 |
%define _requires_exceptions pear( |
10 |
|
11 |
Summary: The %{realname} module for PHP |
12 |
Name: php-%{modname} |
13 |
Version: 3.1.14 |
14 |
Release: %mkrel 1 |
15 |
Group: Development/PHP |
16 |
License: PHP License |
17 |
URL: http://pecl.php.net/package/APC |
18 |
Source0: http://pecl.php.net/get/APC-%{version}.tgz |
19 |
Source1: apc.ini |
20 |
Patch0: APC-3.1.3p1-default_lock_dir.diff |
21 |
BuildRequires: php-devel >= 3:5.2.0 |
22 |
Conflicts: php-afterburner php-mmcache php-eaccelerator |
23 |
Epoch: 1 |
24 |
|
25 |
%description |
26 |
APC was conceived of to provide a way of boosting the performance of PHP on |
27 |
heavily loaded sites by providing a way for scripts to be cached in a compiled |
28 |
state, so that the overhead of parsing and compiling can be almost completely |
29 |
eliminated. There are commercial products which provide this functionality, but |
30 |
they are neither open-source nor free. Our goal was to level the playing field |
31 |
by providing an implementation that allows greater flexibility and is |
32 |
universally accessible. |
33 |
|
34 |
NOTE!: %{name} has to be loaded last, very important! |
35 |
|
36 |
This package comes with four different flavours of APC (use only one of them): |
37 |
|
38 |
o apc-mmap.so - mmap (fcntl) based locks (default) |
39 |
o apc-sem.so - IPC semamphore based locks |
40 |
o apc-spinlocks.so - Hardware-dependent implementation of spinlocks |
41 |
o apc-pthread.so - NPTL pthread mutex based locks |
42 |
o apc-mmap+mutex.so - mmap (fcntl) and pthread mutex based locks |
43 |
|
44 |
%package admin |
45 |
Summary: Web admin GUI for %{realname} |
46 |
Group: Development/PHP |
47 |
Requires: apache-mod_php |
48 |
Requires: %{name} |
49 |
|
50 |
%description admin |
51 |
This package contains a Web admin GUI for %{realname}. |
52 |
|
53 |
To access the web GUI please open up your favourite web browser and point to: |
54 |
|
55 |
http://localhost/%{name}/ |
56 |
|
57 |
%prep |
58 |
|
59 |
%setup -q -n APC-%{version} |
60 |
[ "../package*.xml" != "/" ] && mv ../package*.xml . |
61 |
|
62 |
%patch0 -p0 |
63 |
|
64 |
cp %{SOURCE1} %{inifile} |
65 |
|
66 |
%build |
67 |
%serverbuild |
68 |
|
69 |
phpize |
70 |
|
71 |
mkdir -p build-apc-mmap |
72 |
pushd build-apc-mmap |
73 |
ln -s ../configure . |
74 |
%configure2_5x \ |
75 |
--enable-%{modname}=shared,%{_prefix} \ |
76 |
--enable-apc-filehits \ |
77 |
--disable-apc-pthreadmutex \ |
78 |
--disable-apc-pthreadrwlocks \ |
79 |
--disable-apc-sem \ |
80 |
--disable-apc-spinlocks \ |
81 |
--enable-apc-mmap \ |
82 |
--enable-apc-memprotect |
83 |
|
84 |
%make |
85 |
popd |
86 |
|
87 |
mkdir -p build-apc-sem |
88 |
pushd build-apc-sem |
89 |
ln -s ../configure . |
90 |
%configure2_5x \ |
91 |
--enable-%{modname}=shared,%{_prefix} \ |
92 |
--enable-apc-filehits \ |
93 |
--disable-apc-pthreadmutex \ |
94 |
--disable-apc-pthreadrwlocks \ |
95 |
--disable-apc-mmap \ |
96 |
--disable-apc-spinlocks \ |
97 |
--enable-apc-sem \ |
98 |
--enable-apc-memprotect |
99 |
|
100 |
%make |
101 |
popd |
102 |
|
103 |
mkdir -p build-apc-spinlocks |
104 |
pushd build-apc-spinlocks |
105 |
ln -s ../configure . |
106 |
%configure2_5x \ |
107 |
--enable-%{modname}=shared,%{_prefix} \ |
108 |
--enable-apc-filehits \ |
109 |
--disable-apc-pthreadmutex \ |
110 |
--disable-apc-pthreadrwlocks \ |
111 |
--disable-apc-sem \ |
112 |
--disable-apc-mmap \ |
113 |
--disable-apc-memprotect \ |
114 |
--enable-apc-spinlocks |
115 |
|
116 |
%make |
117 |
popd |
118 |
|
119 |
mkdir -p build-apc-pthread |
120 |
pushd build-apc-pthread |
121 |
ln -s ../configure . |
122 |
%configure2_5x \ |
123 |
--enable-%{modname}=shared,%{_prefix} \ |
124 |
--enable-apc-filehits \ |
125 |
--enable-apc-pthreadrwlocks \ |
126 |
--disable-apc-spinlocks \ |
127 |
--disable-apc-mmap \ |
128 |
--disable-apc-sem \ |
129 |
--disable-apc-memprotect |
130 |
%make |
131 |
popd |
132 |
|
133 |
mkdir -p build-apc-mmap+mutex |
134 |
pushd build-apc-mmap+mutex |
135 |
ln -s ../configure . |
136 |
%configure2_5x \ |
137 |
--enable-%{modname}=shared,%{_prefix} \ |
138 |
--enable-apc-filehits \ |
139 |
--enable-apc-mmap \ |
140 |
--enable-apc-pthreadmutex |
141 |
%make |
142 |
popd |
143 |
|
144 |
%install |
145 |
rm -rf %{buildroot} |
146 |
|
147 |
install -d %{buildroot}%{_libdir}/php/extensions |
148 |
install -d %{buildroot}%{_sysconfdir}/php.d |
149 |
install -d %{buildroot}/var/www/%{name} |
150 |
install -d %{buildroot}/var/lib/php-apc |
151 |
|
152 |
install -m0644 %{inifile} %{buildroot}%{_sysconfdir}/php.d/%{inifile} |
153 |
|
154 |
install -m0755 build-apc-mmap/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-mmap.so |
155 |
install -m0755 build-apc-sem/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-sem.so |
156 |
install -m0755 build-apc-spinlocks/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-spinlocks.so |
157 |
install -m0755 build-apc-pthread/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-pthread.so |
158 |
install -m0755 build-apc-mmap+mutex/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-mmap+mutex.so |
159 |
|
160 |
install -d -m 755 %{buildroot}%{webappconfdir} |
161 |
cat > %{buildroot}%{webappconfdir}/%{name}.conf << EOF |
162 |
Alias /%{name} /var/www/%{name} |
163 |
|
164 |
<Directory "/var/www/%{name}"> |
165 |
%if %{mgaversion} < 3 |
166 |
Order deny,allow |
167 |
Deny from all |
168 |
Allow from 127.0.0.1 |
169 |
%endif |
170 |
%if %{mgaversion} >= 3 |
171 |
Require local granted |
172 |
%endif |
173 |
ErrorDocument 403 "Access denied per %{webappconfdir}/%{name}.conf" |
174 |
</Directory> |
175 |
EOF |
176 |
|
177 |
install -m0644 apc.php %{buildroot}/var/www/%{name}/index.php |
178 |
|
179 |
%clean |
180 |
rm -rf %{buildroot} |
181 |
|
182 |
%files |
183 |
%defattr(-,root,root) |
184 |
%doc tests CHANGELOG INSTALL LICENSE NOTICE TECHNOTES.txt TODO package*.xml |
185 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php.d/%{inifile} |
186 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-mmap.so |
187 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-sem.so |
188 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-spinlocks.so |
189 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-pthread.so |
190 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-mmap+mutex.so |
191 |
%attr(0755,apache,apache) /var/lib/php-apc |
192 |
|
193 |
%files admin |
194 |
%defattr(-,root,root) |
195 |
%config(noreplace) %{webappconfdir}/%{name}.conf |
196 |
%dir /var/www/%{name} |
197 |
/var/www/%{name}/index.php |
198 |
|
199 |
|