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.10 |
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 |
# (cg) Various patches from upstream svn that are needed to fix segv issues |
22 |
# with latest php. |
23 |
# Primarily this is (in my case) for https://bugs.php.net/bug.php?id=62442 |
24 |
# but other bugs are fixed too. |
25 |
Patch10: php-apc-3.1.10-svn-r325142.patch |
26 |
Patch11: php-apc-3.1.10-svn-r325482.patch |
27 |
Patch12: php-apc-3.1.10-svn-r325483.patch |
28 |
Patch13: php-apc-3.1.10-svn-r325875.patch |
29 |
Patch14: php-apc-3.1.10-svn-r325977.patch |
30 |
Patch15: php-apc-3.1.10-svn-r326089.patch |
31 |
BuildRequires: php-devel >= 3:5.2.0 |
32 |
Conflicts: php-afterburner php-mmcache php-eaccelerator |
33 |
Epoch: 1 |
34 |
|
35 |
%description |
36 |
APC was conceived of to provide a way of boosting the performance of PHP on |
37 |
heavily loaded sites by providing a way for scripts to be cached in a compiled |
38 |
state, so that the overhead of parsing and compiling can be almost completely |
39 |
eliminated. There are commercial products which provide this functionality, but |
40 |
they are neither open-source nor free. Our goal was to level the playing field |
41 |
by providing an implementation that allows greater flexibility and is |
42 |
universally accessible. |
43 |
|
44 |
NOTE!: %{name} has to be loaded last, very important! |
45 |
|
46 |
This package comes with four different flavours of APC (use only one of them): |
47 |
|
48 |
o apc-mmap.so - mmap (fcntl) based locks (default) |
49 |
o apc-sem.so - IPC semamphore based locks |
50 |
o apc-spinlocks.so - Hardware-dependent implementation of spinlocks |
51 |
o apc-pthread.so - NPTL pthread mutex based locks |
52 |
|
53 |
%package admin |
54 |
Summary: Web admin GUI for %{realname} |
55 |
Group: Development/PHP |
56 |
Requires: apache-mod_php |
57 |
Requires: %{name} |
58 |
|
59 |
%description admin |
60 |
This package contains a Web admin GUI for %{realname}. |
61 |
|
62 |
To access the web GUI please open up your favourite web browser and point to: |
63 |
|
64 |
http://localhost/%{name}/ |
65 |
|
66 |
%prep |
67 |
|
68 |
%setup -q -n APC-%{version} |
69 |
[ "../package*.xml" != "/" ] && mv ../package*.xml . |
70 |
|
71 |
%patch0 -p0 |
72 |
%patch10 -p3 |
73 |
%patch11 -p3 |
74 |
%patch12 -p3 |
75 |
%patch13 -p3 |
76 |
%patch14 -p3 |
77 |
%patch15 -p3 |
78 |
|
79 |
cp %{SOURCE1} %{inifile} |
80 |
|
81 |
%build |
82 |
%serverbuild |
83 |
|
84 |
phpize |
85 |
|
86 |
mkdir -p build-apc-mmap |
87 |
pushd build-apc-mmap |
88 |
ln -s ../configure . |
89 |
%configure2_5x \ |
90 |
--enable-%{modname}=shared,%{_prefix} \ |
91 |
--enable-apc-filehits \ |
92 |
--disable-apc-pthreadmutex \ |
93 |
--disable-apc-sem \ |
94 |
--disable-apc-spinlocks \ |
95 |
--enable-apc-mmap \ |
96 |
--enable-apc-memprotect |
97 |
|
98 |
%make |
99 |
popd |
100 |
|
101 |
mkdir -p build-apc-sem |
102 |
pushd build-apc-sem |
103 |
ln -s ../configure . |
104 |
%configure2_5x \ |
105 |
--enable-%{modname}=shared,%{_prefix} \ |
106 |
--enable-apc-filehits \ |
107 |
--disable-apc-pthreadmutex \ |
108 |
--disable-apc-mmap \ |
109 |
--disable-apc-spinlocks \ |
110 |
--enable-apc-sem \ |
111 |
--enable-apc-memprotect |
112 |
|
113 |
%make |
114 |
popd |
115 |
|
116 |
mkdir -p build-apc-spinlocks |
117 |
pushd build-apc-spinlocks |
118 |
ln -s ../configure . |
119 |
%configure2_5x \ |
120 |
--enable-%{modname}=shared,%{_prefix} \ |
121 |
--enable-apc-filehits \ |
122 |
--disable-apc-pthreadmutex \ |
123 |
--disable-apc-sem \ |
124 |
--disable-apc-mmap \ |
125 |
--disable-apc-memprotect \ |
126 |
--enable-apc-spinlocks |
127 |
|
128 |
%make |
129 |
popd |
130 |
|
131 |
mkdir -p build-apc-pthread |
132 |
pushd build-apc-pthread |
133 |
ln -s ../configure . |
134 |
%configure2_5x \ |
135 |
--enable-%{modname}=shared,%{_prefix} \ |
136 |
--enable-apc-filehits \ |
137 |
--disable-apc-spinlocks \ |
138 |
--disable-apc-mmap \ |
139 |
--disable-apc-sem \ |
140 |
--disable-apc-memprotect |
141 |
|
142 |
%make |
143 |
popd |
144 |
|
145 |
%install |
146 |
rm -rf %{buildroot} |
147 |
|
148 |
install -d %{buildroot}%{_libdir}/php/extensions |
149 |
install -d %{buildroot}%{_sysconfdir}/php.d |
150 |
install -d %{buildroot}/var/www/%{name} |
151 |
install -d %{buildroot}/var/lib/php-apc |
152 |
|
153 |
install -m0644 %{inifile} %{buildroot}%{_sysconfdir}/php.d/%{inifile} |
154 |
|
155 |
install -m0755 build-apc-mmap/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-mmap.so |
156 |
install -m0755 build-apc-sem/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-sem.so |
157 |
install -m0755 build-apc-spinlocks/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-spinlocks.so |
158 |
install -m0755 build-apc-pthread/modules/apc.so %{buildroot}%{_libdir}/php/extensions/apc-pthread.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 |
Order deny,allow |
166 |
Deny from all |
167 |
Allow from 127.0.0.1 |
168 |
ErrorDocument 403 "Access denied per %{webappconfdir}/%{name}.conf" |
169 |
</Directory> |
170 |
EOF |
171 |
|
172 |
install -m0644 apc.php %{buildroot}/var/www/%{name}/index.php |
173 |
|
174 |
%clean |
175 |
rm -rf %{buildroot} |
176 |
|
177 |
%files |
178 |
%defattr(-,root,root) |
179 |
%doc tests CHANGELOG INSTALL LICENSE NOTICE TECHNOTES.txt TODO package*.xml |
180 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php.d/%{inifile} |
181 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-mmap.so |
182 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-sem.so |
183 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-spinlocks.so |
184 |
%attr(0755,root,root) %{_libdir}/php/extensions/apc-pthread.so |
185 |
%attr(0755,apache,apache) /var/lib/php-apc |
186 |
|
187 |
%files admin |
188 |
%defattr(-,root,root) |
189 |
%config(noreplace) %{webappconfdir}/%{name}.conf |
190 |
%dir /var/www/%{name} |
191 |
/var/www/%{name}/index.php |
192 |
|
193 |
|