Gentoo Archives: gentoo-commits

From: "Christian Hoffmann (hoffie)" <hoffie@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/php: ChangeLog php-5.2.5-r1.ebuild
Date: Sat, 08 Dec 2007 23:23:50
Message-Id: E1J191G-0007mI-TH@stork.gentoo.org
1 hoffie 07/12/08 23:23:38
2
3 Modified: ChangeLog
4 Added: php-5.2.5-r1.ebuild
5 Log:
6 revision bump w/ updated patchset to fix most of the security issues listed in bug 199156
7 (Portage version: 2.1.4_rc8)
8
9 Revision Changes Path
10 1.213 dev-lang/php/ChangeLog
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/php/ChangeLog?rev=1.213&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/php/ChangeLog?rev=1.213&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/php/ChangeLog?r1=1.212&r2=1.213
15
16 Index: ChangeLog
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
19 retrieving revision 1.212
20 retrieving revision 1.213
21 diff -u -r1.212 -r1.213
22 --- ChangeLog 15 Nov 2007 17:25:24 -0000 1.212
23 +++ ChangeLog 8 Dec 2007 23:23:38 -0000 1.213
24 @@ -1,6 +1,12 @@
25 # ChangeLog for dev-lang/php
26 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
27 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.212 2007/11/15 17:25:24 hoffie Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.213 2007/12/08 23:23:38 hoffie Exp $
29 +
30 +*php-5.2.5-r1 (08 Dec 2007)
31 +
32 + 08 Dec 2007; Christian Hoffmann <hoffie@g.o> +php-5.2.5-r1.ebuild:
33 + revision bump w/ updated patchset to fix most of the security issues listed
34 + in bug 199156
35
36 15 Nov 2007; Christian Hoffmann <hoffie@g.o> -php-4.4.7.ebuild,
37 -php-5.2.4.ebuild, -php-5.2.4_p20070914-r2.ebuild:
38
39
40
41 1.1 dev-lang/php/php-5.2.5-r1.ebuild
42
43 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/php/php-5.2.5-r1.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/php/php-5.2.5-r1.ebuild?rev=1.1&content-type=text/plain
45
46 Index: php-5.2.5-r1.ebuild
47 ===================================================================
48 # Copyright 1999-2007 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.5-r1.ebuild,v 1.1 2007/12/08 23:23:38 hoffie Exp $
51
52 CGI_SAPI_USE="discard-path force-cgi-redirect"
53 APACHE2_SAPI_USE="concurrentmodphp threads"
54 IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild"
55
56 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
57
58 # NOTE: Portage doesn't support setting PROVIDE based on the USE flags
59 # that have been enabled, so we have to PROVIDE everything for now
60 # and hope for the best
61 PROVIDE="virtual/php virtual/httpd-php"
62
63 # php package settings
64 SLOT="5"
65 MY_PHP_PV="${PV}"
66 MY_PHP_P="php-${MY_PHP_PV}"
67 PHP_PACKAGE="1"
68
69 # php patch settings, general
70 PHP_PATCHSET_REV="1"
71 SUHOSIN_PATCH="suhosin-patch-${PV}-0.9.6.2.patch.gz"
72 MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch"
73 # php patch settings, ebuild specific
74 FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch"
75 CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/concurrent_apache_modules.patch"
76
77 inherit versionator php5_2-sapi apache-module
78
79 DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs."
80
81 DEPEND="app-admin/php-toolkit"
82 RDEPEND="${DEPEND}"
83
84 want_apache
85
86 pkg_setup() {
87 PHPCONFUTILS_AUTO_USE=""
88
89 # Make sure the user has specified at least one SAPI
90 einfo "Determining SAPI(s) to build"
91 phpconfutils_require_any " Enabled SAPI:" " Disabled SAPI:" cli cgi apache2
92
93 # Threaded Apache2 support
94 if use apache2 ; then
95 if [[ "${APACHE_VERSION}" != "0" ]] ; then
96 if ! use threads ; then
97 APACHE2_SAFE_MPMS="itk peruser prefork"
98 else
99 APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker"
100 fi
101
102 ewarn
103 ewarn "If this package fails with a fatal error about Apache2 not having"
104 ewarn "been compiled with a compatible MPM, this is normally because you"
105 ewarn "need to toggle the 'threads' USE flag."
106 ewarn
107 ewarn "If 'threads' is off, try switching it on."
108 ewarn "If 'threads' is on, try switching it off."
109 ewarn
110
111 apache-module_pkg_setup
112 fi
113 fi
114
115 # Concurrent PHP Apache2 modules support
116 if use apache2 ; then
117 if [[ "${APACHE_VERSION}" != "0" ]] ; then
118 if use concurrentmodphp ; then
119 ewarn
120 ewarn "'concurrentmodphp' makes it possible to load multiple, differently"
121 ewarn "versioned mod_php's into the same Apache instance. This is done with"
122 ewarn "a few linker tricks and workarounds, and is not guaranteed to always"
123 ewarn "work correctly, so use it at your own risk. Especially, do not use"
124 ewarn "this in conjunction with PHP modules (PECL, ...) other than the ones"
125 ewarn "you may find in the Portage tree or the PHP Overlay!"
126 ewarn "This is an experimental feature, so please rebuild PHP"
127 ewarn "without the 'concurrentmodphp' USE flag if you experience"
128 ewarn "any problems, and then reproduce any bugs before filing"
129 ewarn "them in Gentoo's Bugzilla or bugs.php.net."
130 ewarn "If you have conclusive evidence that a bug directly"
131 ewarn "derives from 'concurrentmodphp', please file a bug in"
132 ewarn "Gentoo's Bugzilla only."
133 ewarn
134 ebeep 5
135 fi
136 fi
137 fi
138
139 # fastbuild support
140 if use fastbuild ; then
141 ewarn
142 ewarn "'fastbuild' attempts to build all SAPIs in a single pass."
143 ewarn "This is an experimental feature, so please rebuild PHP"
144 ewarn "without the 'fastbuild' USE flag if you experience"
145 ewarn "any problems, and then reproduce any bugs before filing"
146 ewarn "them in Gentoo's Bugzilla or bugs.php.net."
147 ewarn "If you have conclusive evidence that a bug directly"
148 ewarn "derives from 'fastbuild', please file a bug in"
149 ewarn "Gentoo's Bugzilla only."
150 ewarn
151 fi
152
153 php5_2-sapi_pkg_setup
154 }
155
156 php_determine_sapis() {
157 # holds the list of sapis that we want to build
158 PHPSAPIS=
159
160 if use cli || phpconfutils_usecheck cli ; then
161 PHPSAPIS="${PHPSAPIS} cli"
162 fi
163
164 if use cgi ; then
165 PHPSAPIS="${PHPSAPIS} cgi"
166 fi
167
168 # note - apache SAPI comes after the simpler cli/cgi sapis
169 if use apache2 ; then
170 if [[ "${APACHE_VERSION}" != "0" ]] ; then
171 PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}"
172 fi
173 fi
174 }
175
176 src_unpack() {
177 if [[ "${PHP_PACKAGE}" == 1 ]] ; then
178 unpack ${A}
179 fi
180
181 cd "${S}"
182
183 # Concurrent PHP Apache2 modules support
184 if use apache2 ; then
185 if [[ "${APACHE_VERSION}" != "0" ]] ; then
186 if use concurrentmodphp ; then
187 if [[ -n "${CONCURRENTMODPHP_PATCH}" ]] && [[ -f "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" ]] ; then
188 epatch "${WORKDIR}/${CONCURRENTMODPHP_PATCH}"
189 else
190 ewarn "There is no concurrent mod_php patch available for this PHP release yet!"
191 fi
192 fi
193 fi
194 fi
195
196 # fastbuild support
197 if use fastbuild ; then
198 if [[ -n "${FASTBUILD_PATCH}" ]] && [[ -f "${WORKDIR}/${FASTBUILD_PATCH}" ]] ; then
199 epatch "${WORKDIR}/${FASTBUILD_PATCH}"
200 else
201 ewarn "There is no fastbuild patch available for this PHP release yet!"
202 fi
203 fi
204
205 # Now let the eclass do the rest and regenerate the configure
206 php5_2-sapi_src_unpack
207
208 # Fix Makefile.global:test to consider the CGI SAPI if present
209 if use cgi ; then
210 sed -e "s|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\"|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\" \&\& test \! -z \"\$(top_builddir)/php-cgi\" \&\& test -x \"\$(top_builddir)/php-cgi\"|g" -i Makefile.global
211 sed -e "s|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\"|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\" TEST_PHP_CGI_EXECUTABLE=\"\$(top_builddir)/php-cgi\"|g" -i Makefile.global
212 fi
213
214 # try to fix some test cases which fail because of sandbox otherwise
215 sed -e 's:/no/such/:.\0:' -i ext/standard/tests/file/005_error.phpt \
216 ext/standard/tests/file/006_error.phpt \
217 ext/standard/tests/file/touch.phpt
218
219 # REMOVING BROKEN TESTS:
220 # removing this test as it has been broken for ages and is not easily
221 # fixable (depends on a lot of factors)
222 rm ext/standard/tests/general_functions/phpinfo.phpt
223
224 # never worked properly, no easy fix
225 rm ext/iconv/tests/bug16069.phpt ext/iconv/tests/iconv_stream_filter.phpt
226 }
227
228 src_compile() {
229 if use fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then
230 src_compile_fastbuild
231 else
232 src_compile_normal
233 fi
234 }
235
236 src_compile_fastbuild() {
237 php_determine_sapis
238
239 build_cli=0
240 build_cgi=0
241 build_apache2=0
242 my_conf=""
243
244 for x in ${PHPSAPIS} ; do
245 case ${x} in
246 cli)
247 build_cli=1
248 ;;
249 cgi)
250 build_cgi=1
251 ;;
252 apache2)
253 build_apache2=1
254 ;;
255 esac
256 done
257
258 if [[ ${build_cli} = 1 ]] ; then
259 my_conf="${my_conf} --enable-cli"
260 else
261 my_conf="${my_conf} --disable-cli"
262 fi
263
264 if [[ ${build_cgi} = 1 ]] ; then
265 my_conf="${my_conf} --enable-cgi --enable-fastcgi"
266 phpconfutils_extension_enable "discard-path" "discard-path" 0
267 phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0
268 else
269 my_conf="${my_conf} --disable-cgi"
270 fi
271
272 if [[ ${build_apache2} = 1 ]] ; then
273 my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2"
274
275 # Threaded Apache2 support
276 if use threads ; then
277 my_conf="${my_conf} --enable-maintainer-zts"
278 ewarn "Enabling ZTS for Apache2 MPM"
279 fi
280
281 # Concurrent PHP Apache2 modules support
282 if use concurrentmodphp ; then
283 append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs"
284 fi
285 fi
286
287 # Now we know what we are building, build it
288 php5_2-sapi_src_compile
289
290 # To keep the separate php.ini files for each SAPI, we change the
291 # build-defs.h and recompile
292
293 if [[ ${build_cli} = 1 ]] ; then
294 einfo
295 einfo "Building CLI SAPI"
296 einfo
297
298 sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cli-php5"|g;' -i main/build-defs.h
299 sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php5/ext-active"|g;' -i main/build-defs.h
300 for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
301 [[ -f ${x} ]] && rm -f ${x}
302 done
303 make sapi/cli/php || die "Unable to make CLI SAPI"
304 cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI"
305 fi
306
307 if [[ ${build_cgi} = 1 ]] ; then
308 einfo
309 einfo "Building CGI SAPI"
310 einfo
311
312 sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cgi-php5"|g;' -i main/build-defs.h
313 sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php5/ext-active"|g;' -i main/build-defs.h
314 for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
315 [[ -f ${x} ]] && rm -f ${x}
316 done
317 make sapi/cgi/php-cgi || die "Unable to make CGI SAPI"
318 cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI"
319 fi
320
321 if [[ ${build_apache2} = 1 ]] ; then
322 einfo
323 einfo "Building apache${APACHE_VERSION} SAPI"
324 einfo
325
326 sed -e "s|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH \"/etc/php/apache${APACHE_VERSION}-php5\"|g;" -i main/build-defs.h
327 sed -e "s|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR \"/etc/php/apache${APACHE_VERSION}-php5/ext-active\"|g;" -i main/build-defs.h
328 for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
329 [[ -f ${x} ]] && rm -f ${x}
330 done
331 make || die "Unable to make apache${APACHE_VERSION} SAPI"
332 fi
333 }
334
335 src_compile_normal() {
336 php_determine_sapis
337
338 CLEAN_REQUIRED=0
339 my_conf=""
340
341 # Support the Apache2 extras, they must be set globally for all
342 # SAPIs to work correctly, especially for external PHP extensions
343 if use apache2 ; then
344 if [[ "${APACHE_VERSION}" != "0" ]] ; then
345 # Concurrent PHP Apache2 modules support
346 if use concurrentmodphp ; then
347 append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs"
348 fi
349 fi
350 fi
351
352 for x in ${PHPSAPIS} ; do
353 # Support the Apache2 extras, they must be set globally for all
354 # SAPIs to work correctly, especially for external PHP extensions
355 if use apache2 ; then
356 if [[ "${APACHE_VERSION}" != "0" ]] ; then
357 # Threaded Apache2 support
358 if use threads ; then
359 my_conf="${my_conf} --enable-maintainer-zts"
360 ewarn "Enabling ZTS for Apache2 MPM"
361 fi
362 fi
363 fi
364
365 if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then
366 make clean
367 fi
368
369 PHPSAPI="${x}"
370
371 case ${x} in
372 cli)
373 my_conf="${my_conf} --enable-cli --disable-cgi"
374 php5_2-sapi_src_compile
375 cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI"
376 ;;
377 cgi)
378 my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi"
379 phpconfutils_extension_enable "discard-path" "discard-path" 0
380 phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0
381 php5_2-sapi_src_compile
382 cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI"
383 ;;
384 apache2)
385 my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2"
386 php5_2-sapi_src_compile
387 ;;
388 esac
389
390 CLEAN_REQUIRED=1
391 my_conf=""
392 done
393 }
394
395 src_install() {
396 php_determine_sapis
397
398 destdir=/usr/$(get_libdir)/php5
399
400 # Let the eclass do the common work
401 php5_2-sapi_src_install
402
403 einfo
404 einfo "Installing SAPI(s) ${PHPSAPIS}"
405 einfo
406
407 for x in ${PHPSAPIS} ; do
408
409 PHPSAPI="${x}"
410
411 case ${x} in
412 cli)
413 einfo "Installing CLI SAPI"
414 into ${destdir}
415 newbin php-cli php || die "Unable to install ${x} sapi"
416 php5_2-sapi_install_ini
417 ;;
418 cgi)
419 einfo "Installing CGI SAPI"
420 into ${destdir}
421 dobin php-cgi || die "Unable to install ${x} sapi"
422 php5_2-sapi_install_ini
423 ;;
424 apache2)
425 einfo "Installing Apache${APACHE_VERSION} SAPI"
426 make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI"
427 if use concurrentmodphp ; then
428 einfo "Installing Apache${APACHE_VERSION} config file for PHP5-concurrent (70_mod_php5_concurr.conf)"
429 insinto ${APACHE_MODULES_CONFDIR}
430 newins "${FILESDIR}/70_mod_php5_concurr.conf-apache2" "70_mod_php5_concurr.conf"
431
432 # Put the ld version script in the right place so it's always accessible
433 insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/"
434 doins "${FILESDIR}/php5-ldvs"
435
436 # Redefine the extension dir to have the modphp suffix
437 PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned"
438 else
439 einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)"
440 insinto ${APACHE_MODULES_CONFDIR}
441 newins "${FILESDIR}/70_mod_php5.conf-apache2" "70_mod_php5.conf"
442 fi
443 php5_2-sapi_install_ini
444 ;;
445 esac
446 done
447
448 # Install env.d files
449 newenvd "${FILESDIR}/20php5-envd" "20php5"
450 sed -e "s|/lib/|/$(get_libdir)/|g" -i "${D}/etc/env.d/20php5"
451 }
452
453 pkg_postinst() {
454 # Output some general info to the user
455 if use apache2 ; then
456 APACHE2_MOD_DEFINE="PHP5"
457 if use concurrentmodphp ; then
458 APACHE2_MOD_CONF="70_mod_php5_concurr"
459 else
460 APACHE2_MOD_CONF="70_mod_php5"
461 fi
462 apache-module_pkg_postinst
463 fi
464
465 # Update Apache2 to use mod_php
466 if use apache2 ; then
467 "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1
468 exitStatus=$?
469 if [[ ${exitStatus} == 2 ]] ; then
470 php-select apache2 php5
471 elif [[ ${exitStatus} == 4 ]] ; then
472 ewarn
473 ewarn "Apache2 is configured to load a different version of PHP."
474 ewarn "To make Apache2 use PHP v5, use php-select:"
475 ewarn
476 ewarn " php-select apache2 php5"
477 ewarn
478 fi
479 fi
480
481 # Create the symlinks for php-cli
482 if use cli || phpconfutils_usecheck cli ; then
483 "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1
484 exitStatus=$?
485 if [[ ${exitStatus} == 5 ]] ; then
486 php-select php php5
487 elif [[ ${exitStatus} == 4 ]] ; then
488 ewarn
489 ewarn "/usr/bin/php links to a different version of PHP."
490 ewarn "To make /usr/bin/php point to PHP v5, use php-select:"
491 ewarn
492 ewarn " php-select php php5"
493 ewarn
494 fi
495 fi
496
497 # Create the symlinks for php-cgi
498 if use cgi ; then
499 "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1
500 exitStatus=$?
501 if [[ ${exitStatus} == 5 ]] ; then
502 php-select php-cgi php5
503 elif [[ ${exitStatus} == 4 ]] ; then
504 ewarn
505 ewarn "/usr/bin/php-cgi links to a different version of PHP."
506 ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:"
507 ewarn
508 ewarn " php-select php-cgi php5"
509 ewarn
510 fi
511 fi
512
513 # Create the symlinks for php-devel
514 "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1
515 exitStatus=$?
516 if [[ $exitStatus == 5 ]] ; then
517 php-select php-devel php5
518 elif [[ $exitStatus == 4 ]] ; then
519 ewarn
520 ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a"
521 ewarn "different version of PHP. To make them point to PHP v5, use"
522 ewarn "php-select:"
523 ewarn
524 ewarn " php-select php-devel php5"
525 ewarn
526 fi
527
528 php5_2-sapi_pkg_postinst
529 }
530
531 src_test() {
532 vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
533 if ! use cli; then
534 einfo "Skipping tests as PHP was built without CLI support"
535 return
536 fi
537 REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php \
538 TEST_PHP_CGI_EXECUTABLE=./sapi/cgi/php-cgi ./sapi/cli/php -n ./run-tests.php -n
539 if [[ $? != 0 ]] ; then
540 eerror "Some tests failed!"
541 fi
542 }
543
544
545
546 --
547 gentoo-commits@g.o mailing list