]>
Commit | Line | Data |
---|---|---|
19cb3b46 ER |
1 | # |
2 | # Conditional build: | |
721497a3 | 3 | %bcond_without web # make web package |
dc6c2675 | 4 | %bcond_without tests # build without tests |
19cb3b46 | 5 | |
40f7ac2e ER |
6 | # on builders, build "web" only under php70 |
7 | %if 0%{?_pld_builder:1} && "%{?php_suffix}" != "70" | |
19cb3b46 ER |
8 | %undefine with_web |
9 | %endif | |
10 | ||
f4d04e1d | 11 | %define php_name php%{?php_suffix} |
0c8088ff | 12 | %define modname apcu |
0c8088ff | 13 | Summary: APCu - APC User Cache |
f4d04e1d | 14 | Name: %{php_name}-pecl-%{modname} |
40f7ac2e ER |
15 | Version: 5.1.8 |
16 | Release: 1 | |
0c8088ff ER |
17 | License: PHP 3.01 |
18 | Group: Development/Languages/PHP | |
d5da6b37 | 19 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz |
40f7ac2e | 20 | # Source0-md5: 0ef8be2ee8acb4dba5a66b247a254995 |
0c8088ff | 21 | Source1: %{modname}.ini |
6faee651 ER |
22 | Source2: apache.conf |
23 | Source3: config.php | |
3428561a | 24 | Patch0: config.patch |
d5da6b37 | 25 | URL: https://pecl.php.net/package/APCu/ |
40f7ac2e | 26 | BuildRequires: %{php_name}-devel >= 4:7.0.0 |
dc6c2675 | 27 | BuildRequires: %{php_name}-cli |
b01e4cd5 | 28 | BuildRequires: libtool |
f4d04e1d | 29 | BuildRequires: rpmbuild(macros) >= 1.666 |
dc6c2675 ER |
30 | %if %{with tests} |
31 | BuildRequires: %{php_name}-pcre | |
32 | %endif | |
0c8088ff | 33 | %{?requires_php_extension} |
5d23fa5d | 34 | Provides: php(apcu) = %{version} |
3428561a | 35 | Obsoletes: php-pecl-apcu < 4.0.4-2 |
0c8088ff ER |
36 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
37 | ||
6faee651 ER |
38 | %define _webapps /etc/webapps |
39 | %define _webapp %{modname} | |
40 | %define _sysconfdir %{_webapps}/%{_webapp} | |
41 | %define _appdir %{_datadir}/%{_webapp} | |
42 | ||
0c8088ff ER |
43 | %description |
44 | APCu is userland caching: APC stripped of opcode caching in | |
45 | preparation for the deployment of Zend Optimizer+ as the primary | |
46 | solution to opcode caching in future versions of PHP. | |
47 | ||
48 | APCu only supports userland caching (and dumping) of variables, | |
49 | providing an upgrade path for the future. When O+ takes over, many | |
50 | will be tempted to use 3rd party solutions to userland caching, | |
51 | possibly even distributed solutions; this would be a grave error. The | |
52 | tried and tested APC codebase provides far superior support for local | |
53 | storage of PHP variables. | |
54 | ||
d5da6b37 ER |
55 | %package devel |
56 | Summary: APCu developer files (header) | |
57 | Group: Development/Libraries | |
58 | Requires: %{php_name}-devel | |
59 | # does not require base | |
60 | ||
61 | %description devel | |
62 | These are the files needed to compile programs using Igbinary | |
63 | ||
6faee651 ER |
64 | %package -n apcu-panel |
65 | Summary: APCu control panel | |
66 | Group: Applications/Networking | |
877c50b0 | 67 | Requires: php(apcu) = %{version} |
6faee651 ER |
68 | Requires: php(gd) |
69 | Requires: webapps | |
70 | Requires: webserver(access) | |
71 | Requires: webserver(php) >= 5.0 | |
6faee651 | 72 | BuildArch: noarch |
6faee651 ER |
73 | |
74 | %description -n apcu-panel | |
75 | This package provides the APCu control panel, with Webserver | |
76 | configuration, available on <http://localhost/apcu-panel/> | |
77 | ||
0c8088ff ER |
78 | %prep |
79 | %setup -qc | |
80 | mv %{modname}-%{version}/* . | |
6faee651 | 81 | %patch0 -p1 |
0c8088ff ER |
82 | cp -p %{SOURCE1} . |
83 | ||
dc6c2675 ER |
84 | cat <<'EOF' > run-tests.sh |
85 | #!/bin/sh | |
86 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
87 | exec %{__make} test \ | |
88 | PHP_EXECUTABLE=%{__php} \ | |
89 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre" \ | |
90 | RUN_TESTS_SETTINGS="-q $*" | |
91 | EOF | |
92 | chmod +x run-tests.sh | |
93 | ||
0c8088ff | 94 | %build |
b01e4cd5 | 95 | %{__libtoolize} |
0c8088ff ER |
96 | phpize |
97 | %configure \ | |
98 | --%{!?debug:dis}%{?debug:en}able-apcu-debug \ | |
b2a78e74 | 99 | --enable-apcu-spinlocks \ |
0c8088ff ER |
100 | --enable-apcu-mmap |
101 | %{__make} | |
102 | ||
dc6c2675 ER |
103 | # simple module load test |
104 | %{__php} -n -q \ | |
105 | -d extension_dir=modules \ | |
106 | -d extension=%{php_extensiondir}/spl.so \ | |
107 | -d extension=%{modname}.so \ | |
108 | -m > modules.log | |
109 | grep %{modname} modules.log | |
110 | ||
111 | %if %{with tests} | |
112 | ./run-tests.sh --show-diff | |
113 | %endif | |
114 | ||
0c8088ff ER |
115 | %install |
116 | rm -rf $RPM_BUILD_ROOT | |
d5da6b37 ER |
117 | %{__make} install \ |
118 | EXTENSION_DIR=%{php_extensiondir} \ | |
119 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
120 | ||
121 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
0c8088ff ER |
122 | cp -p %{modname}.ini $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini |
123 | ||
6faee651 | 124 | # Install the Control Panel |
19cb3b46 | 125 | %if %{with web} |
6faee651 ER |
126 | install -d $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir}} |
127 | cp -p apc.php $RPM_BUILD_ROOT%{_appdir}/index.php | |
128 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
129 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
130 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config.php | |
19cb3b46 | 131 | %endif |
6faee651 | 132 | |
0c8088ff ER |
133 | %clean |
134 | rm -rf $RPM_BUILD_ROOT | |
135 | ||
136 | %post | |
137 | %php_webserver_restart | |
138 | ||
139 | %postun | |
140 | if [ "$1" = 0 ]; then | |
141 | %php_webserver_restart | |
142 | fi | |
143 | ||
6faee651 ER |
144 | %triggerin -n apcu-panel -- apache1 < 1.3.37-3, apache1-base |
145 | %webapp_register apache %{_webapp} | |
146 | ||
147 | %triggerun -n apcu-panel -- apache1 < 1.3.37-3, apache1-base | |
148 | %webapp_unregister apache %{_webapp} | |
149 | ||
150 | %triggerin -n apcu-panel -- apache < 2.2.0, apache-base | |
151 | %webapp_register httpd %{_webapp} | |
152 | ||
153 | %triggerun -n apcu-panel -- apache < 2.2.0, apache-base | |
154 | %webapp_unregister httpd %{_webapp} | |
155 | ||
0c8088ff ER |
156 | %files |
157 | %defattr(644,root,root,755) | |
158 | %doc README.md NOTICE TECHNOTES.txt TODO INSTALL LICENSE | |
159 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini | |
160 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so | |
6faee651 | 161 | |
d5da6b37 ER |
162 | %files devel |
163 | %defattr(644,root,root,755) | |
164 | %{_includedir}/php/ext/%{modname} | |
165 | ||
19cb3b46 | 166 | %if %{with web} |
6faee651 ER |
167 | %files -n apcu-panel |
168 | %defattr(644,root,root,755) | |
169 | %dir %attr(750,root,http) %{_sysconfdir} | |
170 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
171 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
172 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php | |
173 | %{_appdir} | |
19cb3b46 | 174 | %endif |