Gentoo Archives: gentoo-commits

From: "Ole Markus With (olemarkus)" <olemarkus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/php: php-5.5.0_beta2.ebuild ChangeLog
Date: Thu, 28 Mar 2013 21:41:43
Message-Id: 20130328214138.60A602171E@flycatcher.gentoo.org
1 olemarkus 13/03/28 21:41:38
2
3 Modified: ChangeLog
4 Added: php-5.5.0_beta2.ebuild
5 Log:
6 Bumping php 5.5 to beta2. Also does proper install of opcache using ext and ext-active
7
8 (Portage version: 2.1.11.52/cvs/Linux x86_64, signed Manifest commit with key C4A92BF5)
9
10 Revision Changes Path
11 1.690 dev-lang/php/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.690&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.690&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?r1=1.689&r2=1.690
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
20 retrieving revision 1.689
21 retrieving revision 1.690
22 diff -u -r1.689 -r1.690
23 --- ChangeLog 25 Mar 2013 20:45:12 -0000 1.689
24 +++ ChangeLog 28 Mar 2013 21:41:38 -0000 1.690
25 @@ -1,6 +1,14 @@
26 # ChangeLog for dev-lang/php
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.689 2013/03/25 20:45:12 olemarkus Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.690 2013/03/28 21:41:38 olemarkus Exp $
30 +
31 +*php-5.5.0_beta2 (28 Mar 2013)
32 +
33 + 28 Mar 2013; Ole Markus With <olemarkus@g.o>
34 + +files/all_mysql_socket_location-gentoo.patch,
35 + +files/all_strict_aliasing.patch, +php-5.5.0_beta2.ebuild:
36 + Bumping php 5.5 to beta2. Also does proper install of opcache using ext and
37 + ext-active
38
39 *php-5.5.0_beta1-r3 (25 Mar 2013)
40
41
42
43
44 1.1 dev-lang/php/php-5.5.0_beta2.ebuild
45
46 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.0_beta2.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.0_beta2.ebuild?rev=1.1&content-type=text/plain
48
49 Index: php-5.5.0_beta2.ebuild
50 ===================================================================
51 # Copyright 1999-2013 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.5.0_beta2.ebuild,v 1.1 2013/03/28 21:41:38 olemarkus Exp $
54
55 EAPI=5
56
57 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool
58
59 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
60
61 function php_get_uri ()
62 {
63 case "${1}" in
64 "php-pre")
65 echo "http://downloads.php.net/dsp/${2}"
66 ;;
67 "php")
68 echo "http://www.php.net/distributions/${2}"
69 ;;
70 "olemarkus")
71 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
72 ;;
73 "gentoo")
74 echo "mirror://gentoo/${2}"
75 ;;
76 *)
77 die "unhandled case in php_get_uri"
78 ;;
79 esac
80 }
81
82 PHP_MV="$(get_major_version)"
83 SLOT="$(get_version_component_range 1-2)"
84
85 # alias, so we can handle different types of releases (finals, rcs, alphas,
86 # betas, ...) w/o changing the whole ebuild
87 PHP_PV="${PV/_rc/RC}"
88 PHP_PV="${PHP_PV/_alpha/alpha}"
89 PHP_PV="${PHP_PV/_beta/beta}"
90 PHP_RELEASE="php"
91 [[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
92 [[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
93 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
94 PHP_P="${PN}-${PHP_PV}"
95
96 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
97
98 PHP_FPM_CONF_VER="1"
99
100 SRC_URI="${PHP_SRC_URI}"
101
102 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
103 HOMEPAGE="http://php.net/"
104 LICENSE="PHP-3"
105
106 S="${WORKDIR}/${PHP_P}"
107
108 # We can build the following SAPIs in the given order
109 SAPIS="embed cli cgi fpm apache2"
110
111 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
112 IUSE="${IUSE}
113 ${SAPIS/cli/+cli}
114 threads"
115
116 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
117 crypt +ctype curl curlwrappers debug doc
118 enchant exif frontbase +fileinfo +filter firebird
119 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
120 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
121 mssql mysql mysqlnd mysqli nls
122 oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
123 readline recode selinux +session sharedmem
124 +simplexml snmp soap sockets spell sqlite ssl
125 sybase-ct sysvipc tidy +tokenizer truetype unicode wddx
126 +xml xmlreader xmlwriter xmlrpc xpm xsl zip zlib"
127
128 DEPEND="
129 >=app-admin/eselect-php-0.7.0[apache2?,fpm?]
130 >=dev-libs/libpcre-8.32[unicode]
131 apache2? ( www-servers/apache[threads=] )
132 berkdb? ( =sys-libs/db-4* )
133 bzip2? ( app-arch/bzip2 )
134 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
135 cjk? ( !gd? (
136 virtual/jpeg
137 media-libs/libpng
138 sys-libs/zlib
139 ) )
140 crypt? ( >=dev-libs/libmcrypt-2.4 )
141 curl? ( >=net-misc/curl-7.10.5 )
142 enchant? ( app-text/enchant )
143 exif? ( !gd? (
144 virtual/jpeg
145 media-libs/libpng
146 sys-libs/zlib
147 ) )
148 firebird? ( dev-db/firebird )
149 gd? ( virtual/jpeg media-libs/libpng sys-libs/zlib )
150 gdbm? ( >=sys-libs/gdbm-1.8.0 )
151 gmp? ( >=dev-libs/gmp-4.1.2 )
152 iconv? ( virtual/libiconv )
153 imap? ( virtual/imap-c-client[ssl=] )
154 intl? ( dev-libs/icu:= )
155 iodbc? ( dev-db/libiodbc )
156 kerberos? ( virtual/krb5 )
157 ldap? ( >=net-nds/openldap-1.2.11 )
158 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
159 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
160 mssql? ( dev-db/freetds[mssql] )
161 !mysqlnd? (
162 mysql? ( virtual/mysql )
163 mysqli? ( >=virtual/mysql-4.1 )
164 )
165 nls? ( sys-devel/gettext )
166 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
167 odbc? ( >=dev-db/unixODBC-1.8.13 )
168 postgres? ( dev-db/postgresql-base )
169 qdbm? ( dev-db/qdbm )
170 readline? ( sys-libs/readline )
171 recode? ( app-text/recode )
172 sharedmem? ( dev-libs/mm )
173 simplexml? ( >=dev-libs/libxml2-2.6.8 )
174 snmp? ( >=net-analyzer/net-snmp-5.2 )
175 soap? ( >=dev-libs/libxml2-2.6.8 )
176 spell? ( >=app-text/aspell-0.50 )
177 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
178 ssl? ( >=dev-libs/openssl-0.9.7 )
179 sybase-ct? ( dev-db/freetds )
180 tidy? ( app-text/htmltidy )
181 truetype? (
182 =media-libs/freetype-2*
183 >=media-libs/t1lib-5.0.0
184 !gd? (
185 virtual/jpeg media-libs/libpng sys-libs/zlib )
186 )
187 unicode? ( dev-libs/oniguruma )
188 wddx? ( >=dev-libs/libxml2-2.6.8 )
189 xml? ( >=dev-libs/libxml2-2.6.8 )
190 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
191 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
192 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
193 xpm? (
194 x11-libs/libXpm
195 virtual/jpeg
196 media-libs/libpng sys-libs/zlib
197 )
198 xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
199 zip? ( sys-libs/zlib )
200 zlib? ( sys-libs/zlib )
201 virtual/mta
202 "
203
204 php="=${CATEGORY}/${PF}"
205
206 REQUIRED_USE="
207 truetype? ( gd )
208 cjk? ( gd )
209 exif? ( gd )
210
211 xpm? ( gd )
212 gd? ( zlib )
213 simplexml? ( xml )
214 soap? ( xml )
215 wddx? ( xml )
216 xmlrpc? ( || ( xml iconv ) )
217 xmlreader? ( xml )
218 xsl? ( xml )
219 ldap-sasl? ( ldap )
220 mhash? ( hash )
221 phar? ( hash )
222 mysqlnd? ( || (
223 mysql
224 mysqli
225 pdo
226 ) )
227
228 qdbm? ( !gdbm )
229 readline? ( !libedit )
230 recode? ( !imap !mysql !mysqli )
231 sharedmem? ( !threads )
232
233 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
234
235 RDEPEND="${DEPEND}"
236
237 RDEPEND="${RDEPEND} fpm? ( selinux? ( sec-policy/selinux-phpfpm ) )"
238
239 DEPEND="${DEPEND}
240 sys-devel/flex
241 >=sys-devel/m4-1.4.3
242 >=sys-devel/libtool-1.5.18"
243
244 # They are in PDEPEND because we need PHP installed first!
245 PDEPEND="doc? ( app-doc/php-docs )"
246
247 # Allow users to install production version if they want to
248
249 case "${PHP_INI_VERSION}" in
250 production|development)
251 ;;
252 *)
253 PHP_INI_VERSION="development"
254 ;;
255 esac
256
257 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
258 PHP_INI_FILE="php.ini"
259
260 want_apache
261
262 pkg_setup() {
263 depend.apache_pkg_setup
264 }
265
266 php_install_ini() {
267 local phpsapi="${1}"
268
269 # work out where we are installing the ini file
270 php_set_ini_dir "${phpsapi}"
271
272 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
273 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
274
275 # default to /tmp for save_path, bug #282768
276 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
277
278 # Set the extension dir
279 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
280
281 # Set the include path to point to where we want to find PEAR packages
282 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
283
284
285 dodir "${PHP_INI_DIR#${EPREFIX}}"
286 insinto "${PHP_INI_DIR#${EPREFIX}}"
287 newins "${phpinisrc}" "${PHP_INI_FILE}"
288
289 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
290 elog
291
292 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
293 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
294
295 if use_if_iuse opcache; then
296 elog "Adding opcache to $PHP_EXT_INI_DIR"
297 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
298 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
299 fi
300
301 # SAPI-specific handling
302
303 if [[ "${sapi}" == "fpm" ]] ; then
304 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
305 einfo "Installing FPM CGI config file php-fpm.conf"
306 insinto "${PHP_INI_DIR#${EPREFIX}}"
307 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
308
309 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
310 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
311 fi
312
313 # Install PHP ini files into /usr/share/php
314
315 dodoc php.ini-development
316 dodoc php.ini-production
317
318 }
319
320 php_set_ini_dir() {
321 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
322 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
323 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
324 }
325
326 src_prepare() {
327 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
328 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
329 # there is no easy way to circumvent that, all php calls during
330 # install use -n, so no php.ini file will be used.
331 # As such, this is the easiest way to get around
332 addpredict /session_mm_cli250.sem
333 addpredict /session_mm_cli0.sem
334
335 # Change PHP branding
336 # Get the alpha/beta/rc version
337 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
338 -i configure.in || die "Unable to change PHP branding"
339
340
341 epatch "${FILESDIR}"/all_mysql_socket_location-gentoo.patch
342 epatch "${FILESDIR}"/all_strict_aliasing.patch
343
344 # Patch PHP to show Gentoo as the server platform
345 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
346 -i configure.in || die "Failed to fix server platform name"
347
348 # Prevent PHP from activating the Apache config,
349 # as we will do that ourselves
350 sed -i \
351 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
352 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
353 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
354
355 # Patch PHP to support heimdal instead of mit-krb5
356 if has_version "app-crypt/heimdal" ; then
357 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
358 || die "Failed to fix heimdal libname"
359 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
360 || die "Failed to fix heimdal crypt library reference"
361 fi
362
363 #Add user patches #357637
364 epatch_user
365
366 #force rebuilding aclocal.m4
367 rm aclocal.m4
368 eautoreconf
369
370 if [[ ${CHOST} == *-darwin* ]] ; then
371 # http://bugs.php.net/bug.php?id=48795, bug #343481
372 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
373 fi
374 }
375
376 src_configure() {
377 addpredict /usr/share/snmp/mibs/.index
378 addpredict /var/lib/net-snmp/mib_indexes
379
380 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
381
382 # This is a global variable and should be in caps. It isn't because the
383 # phpconfutils eclass relies on exactly this name...
384 # for --with-libdir see bug #327025
385 my_conf="
386 --prefix="${PHP_DESTDIR}"
387 --mandir="${PHP_DESTDIR}"/man
388 --infodir="${PHP_DESTDIR}"/info
389 --libdir="${PHP_DESTDIR}"/lib
390 --with-libdir=$(get_libdir)
391 --without-pear
392 $(use_enable threads maintainer-zts)"
393
394 # extension USE flag shared
395 my_conf+="
396 $(use_enable bcmath bcmath )
397 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
398 $(use_enable calendar calendar )
399 $(use_enable ctype ctype )
400 $(use_with curl curl "${EPREFIX}"/usr)
401 $(use_with curlwrappers curlwrappers "${EPREFIX}"/usr)
402 $(use_enable xml dom )
403 $(use_with enchant enchant "${EPREFIX}"/usr)
404 $(use_enable exif exif )
405 $(use_enable fileinfo fileinfo )
406 $(use_enable filter filter )
407 $(use_enable ftp ftp )
408 $(use_with nls gettext "${EPREFIX}"/usr)
409 $(use_with gmp gmp "${EPREFIX}"/usr)
410 $(use_enable hash hash )
411 $(use_with mhash mhash "${EPREFIX}"/usr)
412 $(use_with iconv iconv )
413 $(use_enable intl intl )
414 $(use_enable ipv6 ipv6 )
415 $(use_enable json json )
416 $(use_with kerberos kerberos "${EPREFIX}"/usr)
417 $(use_enable xml libxml )
418 $(use_with xml libxml-dir "${EPREFIX}"/usr)
419 $(use_enable unicode mbstring )
420 $(use_with crypt mcrypt "${EPREFIX}"/usr)
421 $(use_with mssql mssql "${EPREFIX}"/usr)
422 $(use_with unicode onig "${EPREFIX}"/usr)
423 $(use_with ssl openssl "${EPREFIX}"/usr)
424 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
425 $(use_enable pcntl pcntl )
426 $(use_enable phar phar )
427 $(use_enable pdo pdo )
428 $(use_enable opcache opcache )
429 $(use_with postgres pgsql "${EPREFIX}"/usr)
430 $(use_enable posix posix )
431 $(use_with spell pspell "${EPREFIX}"/usr)
432 $(use_with recode recode "${EPREFIX}"/usr)
433 $(use_enable simplexml simplexml )
434 $(use_enable sharedmem shmop )
435 $(use_with snmp snmp "${EPREFIX}"/usr)
436 $(use_enable soap soap )
437 $(use_enable sockets sockets )
438 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
439 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
440 $(use_enable sysvipc sysvmsg )
441 $(use_enable sysvipc sysvsem )
442 $(use_enable sysvipc sysvshm )
443 $(use_with tidy tidy "${EPREFIX}"/usr)
444 $(use_enable tokenizer tokenizer )
445 $(use_enable wddx wddx )
446 $(use_enable xml xml )
447 $(use_enable xmlreader xmlreader )
448 $(use_enable xmlwriter xmlwriter )
449 $(use_with xmlrpc xmlrpc)
450 $(use_with xsl xsl "${EPREFIX}"/usr)
451 $(use_enable zip zip )
452 $(use_with zlib zlib "${EPREFIX}"/usr)
453 $(use_enable debug debug )"
454
455 # DBA support
456 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
457 || use qdbm ; then
458 my_conf="${my_conf} --enable-dba${shared}"
459 fi
460
461 # DBA drivers support
462 my_conf+="
463 $(use_with cdb cdb)
464 $(use_with berkdb db4 ${EPREFIX}/usr)
465 $(use_enable flatfile flatfile )
466 $(use_with gdbm gdbm ${EPREFIX}/usr)
467 $(use_enable inifile inifile )
468 $(use_with qdbm qdbm ${EPREFIX}/usr)"
469
470 # Support for the GD graphics library
471 my_conf+="
472 $(use_with truetype freetype-dir ${EPREFIX}/usr)
473 $(use_with truetype t1lib ${EPREFIX}/usr)
474 $(use_enable cjk gd-jis-conv )
475 $(use_with gd jpeg-dir ${EPREFIX}/usr)
476 $(use_with gd png-dir ${EPREFIX}/usr)
477 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
478 # enable gd last, so configure can pick up the previous settings
479 my_conf+="
480 $(use_with gd gd)"
481
482 # IMAP support
483 if use imap ; then
484 my_conf+="
485 $(use_with imap imap ${EPREFIX}/usr)
486 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
487 fi
488
489 # Interbase/firebird support
490
491 if use firebird ; then
492 my_conf+="
493 $(use_with firebird interbase ${EPREFIX}/usr)"
494 fi
495
496 # LDAP support
497 if use ldap ; then
498 my_conf+="
499 $(use_with ldap ldap ${EPREFIX}/usr)
500 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
501 fi
502
503 # MySQL support
504 if use mysql ; then
505 if use mysqlnd ; then
506 my_conf+="
507 $(use_with mysql mysql mysqlnd)"
508 else
509 my_conf+="
510 $(use_with mysql mysql ${EPREFIX}/usr)"
511 fi
512 my_conf+="
513 $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
514 fi
515
516 # MySQLi support
517 if use mysqlnd ; then
518 my_conf+="
519 $(use_with mysqli mysqli mysqlnd)"
520 else
521 my_conf+="
522 $(use_with mysqli mysqli ${EPREFIX}/usr/bin/mysql_config)"
523 fi
524
525 # ODBC support
526 if use odbc ; then
527 my_conf+="
528 $(use_with odbc unixODBC ${EPREFIX}/usr)"
529 fi
530
531 if use iodbc ; then
532 my_conf+="
533 $(use_with iodbc iodbc ${EPREFIX}/usr)"
534 fi
535
536 # Oracle support
537 if use oci8-instant-client ; then
538 my_conf+="
539 $(use_with oci8-instant-client oci8)"
540 fi
541
542 # PDO support
543 if use pdo ; then
544 my_conf+="
545 $(use_with mssql pdo-dblib )"
546 if use mysqlnd ; then
547 my_conf+="
548 $(use_with mysqlnd pdo-mysql mysqlnd)"
549 else
550 my_conf+="
551 $(use_with mysql pdo-mysql ${EPREFIX}/usr)"
552 fi
553 my_conf+="
554 $(use_with postgres pdo-pgsql )
555 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
556 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
557 if use oci8-instant-client ; then
558 my_conf+="
559 $(use_with oci8-instant-client pdo-oci)"
560 fi
561 fi
562
563 # readline/libedit support
564 my_conf+="
565 $(use_with readline readline ${EPREFIX}/usr)
566 $(use_with libedit libedit ${EPREFIX}/usr)"
567
568 # Session support
569 if use session ; then
570 my_conf+="
571 $(use_with sharedmem mm ${EPREFIX}/usr)"
572 else
573 my_conf+="
574 $(use_enable session session )"
575 fi
576
577 # Use pic for shared modules such as apache2's mod_php
578 my_conf="${my_conf} --with-pic"
579
580 # we use the system copy of pcre
581 # --with-pcre-regex affects ext/pcre
582 # --with-pcre-dir affects ext/filter and ext/zip
583 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
584
585 # Catch CFLAGS problems
586 # Fixes bug #14067.
587 # Changed order to run it in reverse for bug #32022 and #12021.
588 replace-cpu-flags "k6*" "i586"
589
590 # Support user-passed configuration parameters
591 my_conf="${my_conf} ${EXTRA_ECONF:-}"
592
593 # Support the Apache2 extras, they must be set globally for all
594 # SAPIs to work correctly, especially for external PHP extensions
595
596 mkdir -p "${WORKDIR}/sapis-build"
597 for one_sapi in $SAPIS ; do
598 use "${one_sapi}" || continue
599 php_set_ini_dir "${one_sapi}"
600
601 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
602 cd "${WORKDIR}/sapis-build/${one_sapi}"
603
604 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
605 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
606
607 for sapi in $SAPIS ; do
608 case "$sapi" in
609 cli|cgi|embed|fpm)
610 if [[ "${one_sapi}" == "${sapi}" ]] ; then
611 sapi_conf="${sapi_conf} --enable-${sapi}"
612 else
613 sapi_conf="${sapi_conf} --disable-${sapi}"
614 fi
615 ;;
616
617 apache2)
618 if [[ "${one_sapi}" == "${sapi}" ]] ; then
619 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
620 else
621 sapi_conf="${sapi_conf} --without-apxs2"
622 fi
623 ;;
624 esac
625 done
626
627 econf ${sapi_conf}
628 done
629 }
630
631 src_compile() {
632 # snmp seems to run during src_compile, too (bug #324739)
633 addpredict /usr/share/snmp/mibs/.index
634 addpredict /var/lib/net-snmp/mib_indexes
635
636 for sapi in ${SAPIS} ; do
637 if use "${sapi}"; then
638 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
639 emake || die "emake failed"
640 fi
641 done
642 }
643
644 src_install() {
645 # see bug #324739 for what happens when we don't have that
646 addpredict /usr/share/snmp/mibs/.index
647
648 # grab the first SAPI that got built and install common files from there
649 local first_sapi=""
650 for sapi in $SAPIS ; do
651 if use $sapi ; then
652 first_sapi=$sapi
653 break
654 fi
655 done
656
657 # Makefile forgets to create this before trying to write to it...
658 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
659
660 # Install php environment (without any sapis)
661 cd "${WORKDIR}/sapis-build/$first_sapi"
662 emake INSTALL_ROOT="${D}" \
663 install-build install-headers install-programs \
664 || die "emake install failed"
665
666 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
667
668 # Create the directory where we'll put version-specific php scripts
669 keepdir /usr/share/php${PHP_MV}
670
671 local sapi="", file=""
672 local sapi_list=""
673
674 for sapi in ${SAPIS}; do
675 if use "${sapi}" ; then
676 einfo "Installing SAPI: ${sapi}"
677 cd "${WORKDIR}/sapis-build/${sapi}"
678
679 if [[ "${sapi}" == "apache2" ]] ; then
680 # We're specifically not using emake install-sapi as libtool
681 # may cause unnecessary relink failures (see bug #351266)
682 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
683 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
684 keepdir "/usr/$(get_libdir)/apache2/modules"
685 else
686 # needed each time, php_install_ini would reset it
687 into "${PHP_DESTDIR#${EPREFIX}}"
688 case "$sapi" in
689 cli)
690 source="sapi/cli/php"
691 ;;
692 cgi)
693 source="sapi/cgi/php-cgi"
694 ;;
695 fpm)
696 source="sapi/fpm/php-fpm"
697 ;;
698 embed)
699 source="libs/libphp${PHP_MV}$(get_libname)"
700 ;;
701 *)
702 die "unhandled sapi in src_install"
703 ;;
704 esac
705
706 if [[ "${source}" == *"$(get_libname)" ]]; then
707 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
708 else
709 dobin "${source}" || die "Unable to install ${sapi} sapi"
710 fi
711 fi
712
713 php_install_ini "${sapi}"
714
715 # construct correct SAPI string for php-config
716 # thanks to ferringb for the bash voodoo
717 if [[ "${sapi}" == "apache2" ]]; then
718 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
719 else
720 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
721 fi
722 fi
723 done
724
725 # Installing opcache module
726 if use_if_iuse opcache ; then
727 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
728 fi
729
730 # Install env.d files
731 newenvd "${FILESDIR}/20php5-envd" \
732 "20php${SLOT}"
733 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
734 "${ED}/etc/env.d/20php${SLOT}"
735 sed -e "s|php5|php${SLOT}|g" -i \
736 "${ED}/etc/env.d/20php${SLOT}"
737
738 # set php-config variable correctly (bug #278439)
739 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
740 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
741 }
742
743 src_test() {
744 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
745 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
746 if [[ ! -x "${PHP_BIN}" ]] ; then
747 ewarn "Test phase requires USE=cli, skipping"
748 return
749 else
750 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
751 fi
752
753 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
754 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
755 fi
756
757 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
758 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
759
760 for name in ${EXPECTED_TEST_FAILURES}; do
761 mv "${name}.out" "${name}.out.orig" 2>/dev/null
762 done
763
764 local failed="$(find -name '*.out')"
765 if [[ ${failed} != "" ]] ; then
766 ewarn "The following test cases failed unexpectedly:"
767 for name in ${failed}; do
768 ewarn " ${name/.out/}"
769 done
770 else
771 einfo "No unexpected test failures, all fine"
772 fi
773
774 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
775 local passed=""
776 for name in ${EXPECTED_TEST_FAILURES}; do
777 [[ -f "${name}.diff" ]] && continue
778 passed="${passed} ${name}"
779 done
780 if [[ ${passed} != "" ]] ; then
781 einfo "The following test cases passed unexpectedly:"
782 for name in ${passed}; do
783 ewarn " ${passed}"
784 done
785 else
786 einfo "None of the known-to-fail tests passed, all fine"
787 fi
788 fi
789 }
790
791 pkg_postinst() {
792 # Output some general info to the user
793 if use apache2 ; then
794 APACHE2_MOD_DEFINE="PHP5"
795 APACHE2_MOD_CONF="70_mod_php5"
796 apache-module_pkg_postinst
797 fi
798
799 # Create the symlinks for php
800 for m in ${SAPIS}; do
801 [[ ${m} == 'embed' ]] && continue;
802 if use $m ; then
803 local ci=$(eselect php show $m)
804 if [[ -z $ci ]]; then
805 eselect php set $m php${SLOT}
806 einfo "Switched ${m} to use php:${SLOT}"
807 einfo
808 elif [[ $ci != "php${SLOT}" ]] ; then
809 elog "To switch $m to use php:${SLOT}, run"
810 elog " eselect php set $m php${SLOT}"
811 elog
812 fi
813 fi
814 done
815
816 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
817 elog "to compile extensions for the ${SLOT} ABI"
818 elog
819 if ! use readline && use cli ; then
820 ewarn "Note that in order to use php interactivly, you need to enable"
821 ewarn "the readline USE flag or php -a will hang"
822 fi
823 elog
824 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
825 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
826 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
827 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
828
829 elog
830 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
831 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
832 elog
833 }
834
835 pkg_prerm() {
836 eselect php cleanup
837 }