/[packages]/updates/2/php-apc/current/SPECS/php-apc.spec
ViewVC logotype

Contents of /updates/2/php-apc/current/SPECS/php-apc.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344754 - (show annotations) (download)
Thu Jan 10 15:42:00 2013 UTC (11 years, 9 months ago) by oden
File size: 6136 byte(s)
- lock down the access to the apc admin php script further

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

  ViewVC Help
Powered by ViewVC 1.1.30