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