Tue, 02 Jul 2013 17:58:45 +0200
Import package vendor original specs for necessary manipulations.
1 ##
2 ## apache-php.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package information
25 Name: apache-php
26 Summary: Apache Extension: PHP Scripting Language
27 URL: http://www.php.net/
28 Vendor: The PHP Project
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: BASE
32 Group: Web
33 License: PHP
34 Version: 5.4.14
35 Release: 20120800
37 # package options
38 %option with_bc no
39 %option with_bdb no
40 %option with_bzip2 no
41 %option with_calendar no
42 %option with_ctype no
43 %option with_curl no
44 %option with_debug no
45 %option with_dom no
46 %option with_exif no
47 %option with_freetype no
48 %option with_ftp no
49 %option with_gd no
50 %option with_gdbm no
51 %option with_gettext no
52 %option with_iconv no
53 %option with_imap no
54 %option with_json no
55 %option with_tokenizer no
56 %option with_mbregex no
57 %option with_mbstring no
58 %option with_mcrypt no
59 %option with_mhash no
60 %option with_mm no
61 %option with_mysql no
62 %option with_mysqlnd no
63 %option with_oci8 no
64 %option with_odbc no
65 %option with_openldap no
66 %option with_openldapsasl no
67 %option with_pear no
68 %option with_pgsql no
69 %option with_posix no
70 %option with_sendmail no
71 %option with_session no
72 %option with_simplexml no
73 %option with_snmp no
74 %option with_soap no
75 %option with_sqlite no
76 %option with_ssl no
77 %option with_tidy no
78 %option with_versioning no
79 %option with_wddx no
80 %option with_xml no
81 %option with_xmlwriter no
82 %option with_xslt no
83 %option with_zlib no
84 %option with_zip no
86 # fixing implicit extension dependencies and correlations
87 %if "%{with_mm}" == "yes"
88 %undefine with_session
89 %define with_session yes
90 %endif
91 %if "%{with_pear}" == "yes"
92 %undefine with_xml
93 %define with_xml yes
94 %endif
95 %if "%{with_freetype}" == "yes"
96 %undefine with_gd
97 %define with_gd yes
98 %endif
99 %if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes" || "%{with_zip}" == "yes"
100 %undefine with_zlib
101 %define with_zlib yes
102 %endif
103 %if "%{with_xslt}" == "yes"
104 %undefine with_dom
105 %define with_dom yes
106 %endif
107 %if "%{with_dom}" == "yes"
108 %undefine with_xml
109 %define with_xml yes
110 %endif
111 %if "%{with_soap}" == "yes"
112 %undefine with_xml
113 %define with_xml yes
114 %endif
115 %if "%{with_pgsql}" == "yes"
116 %undefine with_ssl
117 %define with_ssl yes
118 %endif
120 # list of sources
121 Source0: http://static.php.net/www.php.net/distributions/php-%{version}.tar.bz2
122 Source1: apache-php.ini
123 Source2: apache-php.conf
124 Patch0: apache-php.patch
126 # build information
127 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, flex, bison
128 PreReq: OpenPKG, openpkg >= 20100101
129 BuildPreReq: apache
130 PreReq: apache
131 BuildPreReq: pcre
132 PreReq: pcre
133 %if "%{with_sqlite}" == "yes"
134 BuildPreReq: sqlite
135 PreReq: sqlite
136 %endif
137 %if "%{with_mysql}" == "yes"
138 BuildPreReq: mysql
139 PreReq: mysql
140 %endif
141 %if "%{with_pgsql}" == "yes"
142 BuildPreReq: postgresql
143 PreReq: postgresql
144 %endif
145 %if "%{with_gd}" == "yes"
146 BuildPreReq: gd >= 2.0.20, jpeg, png
147 PreReq: gd >= 2.0.20, jpeg, png
148 %endif
149 %if "%{with_bdb}" == "yes"
150 BuildPreReq: db
151 PreReq: db
152 %endif
153 %if "%{with_zlib}" == "yes"
154 BuildPreReq: zlib
155 PreReq: zlib
156 %endif
157 %if "%{with_bzip2}" == "yes"
158 BuildPreReq: bzip2
159 PreReq: bzip2
160 %endif
161 %if "%{with_ssl}" == "yes"
162 BuildPreReq: openssl
163 PreReq: openssl
164 %endif
165 %if "%{with_openldap}" == "yes"
166 BuildPreReq: openldap
167 PreReq: openldap
168 %if "%{with_openldapsasl}" == "yes"
169 BuildPreReq: openldap::with_sasl = yes
170 PreReq: openldap::with_sasl = yes
171 %else
172 BuildPreReq: openldap::with_sasl = no
173 PreReq: openldap::with_sasl = no
174 %endif
175 %endif
176 %if "%{with_mm}" == "yes"
177 BuildPreReq: mm
178 PreReq: mm
179 %endif
180 %if "%{with_freetype}" == "yes"
181 BuildPreReq: freetype
182 PreReq: freetype
183 %endif
184 %if "%{with_gettext}" == "yes"
185 BuildPreReq: gettext, libiconv
186 PreReq: gettext, libiconv
187 %endif
188 %if "%{with_iconv}" == "yes"
189 BuildPreReq: libiconv
190 PreReq: libiconv
191 %endif
192 %if "%{with_imap}" == "yes"
193 BuildPreReq: imap, openssl
194 PreReq: imap, openssl
195 %endif
196 %if "%{with_xml}" == "yes"
197 BuildPreReq: libxml
198 PreReq: libxml
199 %endif
200 %if "%{with_xmlwriter}" == "yes"
201 %undefine with_xml
202 %define with_xml yes
203 %endif
204 %if "%{with_xslt}" == "yes"
205 BuildPreReq: libxslt
206 PreReq: libxslt
207 %endif
208 %if "%{with_dom}" == "yes"
209 BuildPreReq: libxml, libxslt
210 PreReq: libxml, libxslt
211 %endif
212 %if "%{with_curl}" == "yes"
213 BuildPreReq: curl
214 PreReq: curl
215 %endif
216 %if "%{with_mhash}" == "yes"
217 BuildPreReq: mhash
218 PreReq: mhash
219 %endif
220 %if "%{with_mcrypt}" == "yes"
221 BuildPreReq: libmcrypt
222 PreReq: libmcrypt
223 %endif
224 %if "%{with_gdbm}" == "yes"
225 BuildPreReq: gdbm, gdbm::with_ndbm = yes
226 PreReq: gdbm, gdbm::with_ndbm = yes
227 %endif
228 %if "%{with_oci8}" == "yes"
229 BuildPreReq: oracle
230 PreReq: oracle
231 %endif
232 %if "%{with_snmp}" == "yes"
233 BuildPreReq: snmp
234 PreReq: snmp
235 %endif
236 %if "%{with_odbc}" == "yes"
237 BuildPreReq: unixodbc
238 PreReq: unixodbc
239 %endif
240 %if "%{with_sendmail}" == "yes"
241 BuildPreReq: MTA
242 PreReq: MTA
243 %endif
244 %if "%{with_simplexml}" == "yes"
245 BuildPreReq: libxml
246 PreReq: libxml
247 %endif
248 %if "%{with_tidy}" == "yes"
249 BuildPreReq: tidy
250 PreReq: tidy
251 %endif
253 %description
254 PHP is an HTML-embedded scripting language. Much of its syntax is
255 borrowed from C, Java and Perl with a couple of unique PHP-specific
256 features thrown in. The goal of the language is to allow web
257 developers to write dynamically generated pages quickly.
259 This package provides a Dynamic Shared Object (DSO) for the Apache
260 HTTP 2.2 web server. In general speaking, this module is also known
261 as mod_php.
263 %track
264 prog apache-php = {
265 version = %{version}
266 url = http://www.php.net/downloads.php
267 regex = php-(5\.\d+\.\d+)\.tar\.(bz2|gz)
268 }
270 %prep
271 %setup -q -n php-%{version}
272 %{l_shtool} subst \
273 -e 's;-i -a -n php5;-i -n php5;' \
274 configure
275 %{l_shtool} subst \
276 -e 's;\(/include\)/freetype2;\1;' \
277 configure \
278 ext/gd/config.m4
279 %patch -p0
281 %build
282 # configure package
283 case "%{l_platform -t}" in
284 *-sunos5.10 ) cflags="%{l_cflags}" ;;
285 * ) cflags="%{l_cflags -O}" ;;
286 esac
287 cppflags="%{l_cppflags}"
288 ldflags="%{l_ldflags}"
289 libs=""
290 %if "%{with_gdbm}" == "yes"
291 libs="$libs -lndbm -lgdbm"
292 %endif
293 %if "%{with_gd}" == "yes"
294 libs="$libs -lpng -lz"
295 %endif
296 %if "%{with_gettext}" == "yes"
297 libs="$libs -liconv"
298 %endif
299 %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
300 libs="$libs -lsasl2"
301 %endif
302 %if "%{with_imap}" == "yes"
303 libs="$libs -lssl -lcrypto"
304 %endif
305 %if "%{with_bdb}" == "yes"
306 libs="$libs -ldb"
307 %endif
308 %if "%{with_pgsql}" == "yes"
309 libs="$libs `pg_config --libs`"
310 %endif
311 %if "%{with_oci8}" == "yes"
312 ORACLE_HOME="`%{l_rc} --query oracle_home`"
313 export ORACLE_HOME
314 %endif
315 CC="%{l_cc}" \
316 CFLAGS="$cflags" \
317 CPPFLAGS="$cppflags" \
318 LDFLAGS="$ldflags" \
319 LIBS="$libs" \
320 %if "%{with_sendmail}" == "yes"
321 PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
322 %else
323 PROG_SENDMAIL="`%{l_shtool} path false`" \
324 %endif
325 ./configure \
326 --prefix=%{l_prefix} \
327 --sysconfdir=%{l_prefix}/etc/apache \
328 --with-config-file-path=%{l_prefix}/etc/apache \
329 --libdir=%{l_prefix}/lib/php \
330 --disable-all \
331 --enable-pdo \
332 --enable-filter \
333 --with-pcre-regex=%{l_prefix} \
334 %if "%{with_calendar}" == "yes"
335 --enable-calendar \
336 %endif
337 %if "%{with_sqlite}" == "yes"
338 --with-sqlite3=%{l_prefix} \
339 --with-pdo-sqlite=%{l_prefix} \
340 %else
341 --without-pdo-sqlite \
342 %endif
343 %if "%{with_mysql}" == "yes" || "%{with_mysqlnd}" == "yes"
344 %if "%{with_mysqlnd}" == "yes"
345 --with-mysql=mysqlnd \
346 --with-pdo-mysql=mysqlnd \
347 %else
348 --with-mysql=%{l_prefix} \
349 --with-pdo-mysql=%{l_prefix} \
350 %endif
351 --with-mysqli=mysqlnd \
352 --with-mysql-sock=%{l_prefix}/var/mysql/mysql.sock \
353 %else
354 --without-mysql \
355 --without-pdo-mysql \
356 %endif
357 %if "%{with_pgsql}" == "yes"
358 --with-pgsql=%{l_prefix} \
359 --with-pdo-pgsql=%{l_prefix} \
360 %else
361 --without-pgsql \
362 %endif
363 %if "%{with_posix}" == "yes"
364 --enable-posix \
365 %endif
366 %if "%{with_gd}" == "yes"
367 --with-gd=yes \
368 --with-jpeg-dir=%{l_prefix} \
369 --with-png-dir=%{l_prefix} \
370 %endif
371 %if "%{with_freetype}" == "yes"
372 --enable-gd-native-ttf \
373 --with-freetype-dir=%{l_prefix} \
374 %endif
375 %if "%{with_bdb}" == "yes"
376 --with-db4=%{l_prefix} \
377 %endif
378 %if "%{with_debug}" == "yes"
379 --enable-debug \
380 %else
381 --disable-debug \
382 %endif
383 %if "%{with_zlib}" == "yes"
384 --with-zlib=%{l_prefix} \
385 --with-zlib-dir=%{l_prefix} \
386 %endif
387 %if "%{with_bzip2}" == "yes"
388 --with-bz2=%{l_prefix} \
389 %endif
390 %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
391 --with-openssl=%{l_prefix} \
392 %endif
393 %if "%{with_openldap}" == "yes"
394 --with-ldap=%{l_prefix} \
395 %endif
396 %if "%{with_session}" == "yes"
397 --enable-session \
398 %endif
399 %if "%{with_mm}" == "yes"
400 --with-mm=%{l_prefix} \
401 %endif
402 %if "%{with_ftp}" == "yes"
403 --enable-ftp \
404 %endif
405 %if "%{with_oci8}" == "yes"
406 --with-oci8 \
407 %endif
408 %if "%{with_gettext}" == "yes"
409 --with-gettext=%{l_prefix} \
410 %endif
411 %if "%{with_imap}" == "yes"
412 --with-imap=%{l_prefix} \
413 --with-imap-ssl=%{l_prefix} \
414 %endif
415 %if "%{with_json}" == "yes"
416 --enable-json \
417 %else
418 --disable-json \
419 %endif
420 %if "%{with_tokenizer}" == "yes"
421 --enable-tokenizer \
422 %else
423 --disable-tokenizer \
424 %endif
425 %if "%{with_xml}" == "yes"
426 --enable-xml \
427 --enable-xmlreader \
428 --enable-libxml \
429 --with-libxml-dir=%{l_prefix} \
430 %else
431 --disable-xml \
432 %endif
433 %if "%{with_xslt}" == "yes"
434 --with-xsl=%{l_prefix} \
435 %else
436 --without-xsl \
437 %endif
438 %if "%{with_dom}" == "yes"
439 --enable-dom \
440 %else
441 --disable-dom \
442 %endif
443 %if "%{with_wddx}" == "yes"
444 --enable-wddx \
445 %endif
446 %if "%{with_soap}" == "yes"
447 --enable-soap \
448 %endif
449 %if "%{with_bc}" == "yes"
450 --enable-bcmath \
451 %endif
452 %if "%{with_mhash}" == "yes"
453 --with-mhash=%{l_prefix} \
454 %endif
455 %if "%{with_mcrypt}" == "yes"
456 --with-mcrypt=%{l_prefix} \
457 %endif
458 %if "%{with_ctype}" == "yes"
459 --enable-ctype \
460 %endif
461 %if "%{with_curl}" == "yes"
462 --with-curl=%{l_prefix} \
463 %endif
464 %if "%{with_gdbm}" == "yes"
465 --with-gdbm=%{l_prefix} \
466 %endif
467 %if "%{with_versioning}" == "yes"
468 --enable-versioning \
469 %endif
470 %if "%{with_pear}" == "yes"
471 --with-pear=%{l_prefix}/lib/php \
472 %else
473 --without-pear \
474 %endif
475 %if "%{with_simplexml}" == "yes"
476 --enable-simplexml \
477 --enable-libxml \
478 --with-libxml-dir=%{l_prefix} \
479 %else
480 --disable-simplexml \
481 %endif
482 %if "%{with_snmp}" == "yes"
483 --with-snmp=%{l_prefix} \
484 --with-openssl-dir=%{l_prefix} \
485 %endif
486 %if "%{with_odbc}" == "yes"
487 --with-unixODBC=%{l_prefix} \
488 --with-pdo-odbc=unixODBC,%{l_prefix} \
489 %endif
490 %if "%{with_mbregex}" == "yes"
491 --enable-mbregex \
492 %endif
493 %if "%{with_mbstring}" == "yes"
494 --enable-mbstring \
495 %endif
496 %if "%{with_exif}" == "yes"
497 --with-exif \
498 %endif
499 %if "%{with_iconv}" == "yes"
500 --with-iconv=%{l_prefix} \
501 %endif
502 %if "%{with_tidy}" == "yes"
503 --with-tidy=%{l_prefix} \
504 %else
505 --without-tidy \
506 %endif
507 %if "%{with_zip}" == "yes"
508 --enable-zip \
509 %endif
510 %if "%{with_xmlwriter}" == "yes"
511 --enable-xmlwriter \
512 %endif
513 --with-apxs2=%{l_prefix}/sbin/apxs \
514 --disable-cli \
515 --disable-cgi
517 # build package
518 %{l_make} %{l_mflags -O}
520 %install
521 # install package
522 %{l_make} %{l_mflags} install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
523 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/libphp5.so \
524 $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/mod_php.so
526 # install default configuration file
527 %{l_shtool} mkdir -f -p -m 755 \
528 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
529 %{l_shtool} install -c -m 644 %{l_value -s -a} \
530 %{SOURCE apache-php.ini} \
531 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
532 %{l_shtool} install -c -m 644 %{l_value -s -a} \
533 %{SOURCE apache-php.conf} \
534 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
536 # create session storage directory
537 %if "%{with_session}" == "yes"
538 %{l_shtool} mkdir -f -p -m 775 \
539 $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache-php.session
540 %endif
542 # determine installation files
543 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
544 %if "%{with_session}" == "yes"
545 '%attr(0770,%{l_rusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache-php.session' \
546 %endif
547 '%config %{l_prefix}/etc/apache/apache-php.ini' \
548 '%config %{l_prefix}/etc/apache/apache.d/apache-php.conf'
550 %files -f files
552 %clean
554 %post
555 # after upgrade, restart service
556 [ $1 -eq 2 ] || exit 0
557 eval `%{l_rc} apache status 2>/dev/null`
558 [ ".$apache_active" = .yes ] && %{l_rc} apache restart
559 exit 0