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_rc1.ebuild ChangeLog
Date: Wed, 25 Jun 2014 10:29:11
Message-Id: 20140625102906.9FC352004E@flycatcher.gentoo.org
1 olemarkus 14/06/25 10:29:06
2
3 Modified: ChangeLog
4 Added: php-5.6.0_rc1.ebuild
5 Log:
6 Added first rc for php 5.6
7
8 (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key C4A92BF5)
9
10 Revision Changes Path
11 1.844 dev-lang/php/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.844&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.844&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?r1=1.843&r2=1.844
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
20 retrieving revision 1.843
21 retrieving revision 1.844
22 diff -u -r1.843 -r1.844
23 --- ChangeLog 8 Jun 2014 10:59:25 -0000 1.843
24 +++ ChangeLog 25 Jun 2014 10:29:06 -0000 1.844
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.843 2014/06/08 10:59:25 ago Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.844 2014/06/25 10:29:06 olemarkus Exp $
30 +
31 +*php-5.6.0_rc1 (25 Jun 2014)
32 +
33 + 25 Jun 2014; Ole Markus With <olemarkus@g.o> +php-5.6.0_rc1.ebuild:
34 + Added first rc for php 5.6
35
36 08 Jun 2014; Agostino Sarubbo <ago@g.o> php-5.4.28.ebuild,
37 php-5.5.12.ebuild:
38
39
40
41 1.1 dev-lang/php/php-5.6.0_rc1.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.6.0_rc1.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.6.0_rc1.ebuild?rev=1.1&content-type=text/plain
45
46 Index: php-5.6.0_rc1.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_rc1.ebuild,v 1.1 2014/06/25 10:29:06 olemarkus Exp $
51
52 EAPI=5
53
54 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
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 systemd tidy +tokenizer truetype unicode wddx
123 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
124
125 DEPEND="
126 >=app-admin/eselect-php-0.7.1-r3[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}
235 fpm? (
236 selinux? ( sec-policy/selinux-phpfpm )
237 systemd? ( sys-apps/systemd ) )"
238
239 DEPEND="${DEPEND}
240 sys-devel/flex
241 >=sys-devel/m4-1.4.3
242 >=sys-devel/libtool-1.5.18"
243
244 # Allow users to install production version if they want to
245
246 case "${PHP_INI_VERSION}" in
247 production|development)
248 ;;
249 *)
250 PHP_INI_VERSION="development"
251 ;;
252 esac
253
254 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
255 PHP_INI_FILE="php.ini"
256
257 want_apache
258
259 pkg_setup() {
260 depend.apache_pkg_setup
261 }
262
263 php_install_ini() {
264 local phpsapi="${1}"
265
266 # work out where we are installing the ini file
267 php_set_ini_dir "${phpsapi}"
268
269 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
270 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
271
272 # default to /tmp for save_path, bug #282768
273 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
274
275 # Set the extension dir
276 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
277
278 # Set the include path to point to where we want to find PEAR packages
279 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
280
281 dodir "${PHP_INI_DIR#${EPREFIX}}"
282 insinto "${PHP_INI_DIR#${EPREFIX}}"
283 newins "${phpinisrc}" "${PHP_INI_FILE}"
284
285 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
286 elog
287
288 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
289 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
290
291 if use_if_iuse opcache; then
292 elog "Adding opcache to $PHP_EXT_INI_DIR"
293 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
294 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
295 fi
296
297 # SAPI-specific handling
298
299 if [[ "${sapi}" == "fpm" ]] ; then
300 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
301 einfo "Installing FPM CGI config file php-fpm.conf"
302 insinto "${PHP_INI_DIR#${EPREFIX}}"
303 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
304
305 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
306 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
307 fi
308
309 # Install PHP ini files into /usr/share/php
310
311 dodoc php.ini-development
312 dodoc php.ini-production
313
314 }
315
316 php_set_ini_dir() {
317 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
318 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
319 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
320 }
321
322 src_prepare() {
323 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
324 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
325 # there is no easy way to circumvent that, all php calls during
326 # install use -n, so no php.ini file will be used.
327 # As such, this is the easiest way to get around
328 addpredict /session_mm_cli250.sem
329 addpredict /session_mm_cli0.sem
330
331 # Change PHP branding
332 # Get the alpha/beta/rc version
333 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
334 -i configure.in || die "Unable to change PHP branding"
335
336 # Patch PHP to show Gentoo as the server platform
337 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
338 -i configure.in || die "Failed to fix server platform name"
339
340 # Prevent PHP from activating the Apache config,
341 # as we will do that ourselves
342 sed -i \
343 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
344 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
345 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
346
347 # Patch PHP to support heimdal instead of mit-krb5
348 if has_version "app-crypt/heimdal" ; then
349 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
350 || die "Failed to fix heimdal libname"
351 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
352 || die "Failed to fix heimdal crypt library reference"
353 fi
354
355 #Add user patches #357637
356 epatch_user
357
358 #force rebuilding aclocal.m4
359 rm aclocal.m4
360 eautoreconf
361
362 if [[ ${CHOST} == *-darwin* ]] ; then
363 # http://bugs.php.net/bug.php?id=48795, bug #343481
364 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
365 fi
366 }
367
368 src_configure() {
369 addpredict /usr/share/snmp/mibs/.index
370 addpredict /var/lib/net-snmp/mib_indexes
371
372 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
373
374 # This is a global variable and should be in caps. It isn't because the
375 # phpconfutils eclass relies on exactly this name...
376 # for --with-libdir see bug #327025
377 my_conf="
378 --prefix="${PHP_DESTDIR}"
379 --mandir="${PHP_DESTDIR}"/man
380 --infodir="${PHP_DESTDIR}"/info
381 --libdir="${PHP_DESTDIR}"/lib
382 --with-libdir=$(get_libdir)
383 --without-pear
384 $(use_enable threads maintainer-zts)"
385
386 # extension USE flag shared
387 my_conf+="
388 $(use_enable bcmath bcmath )
389 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
390 $(use_enable calendar calendar )
391 $(use_enable ctype ctype )
392 $(use_with curl curl "${EPREFIX}"/usr)
393 $(use_enable xml dom )
394 $(use_with enchant enchant "${EPREFIX}"/usr)
395 $(use_enable exif exif )
396 $(use_enable fileinfo fileinfo )
397 $(use_enable filter filter )
398 $(use_enable ftp ftp )
399 $(use_with nls gettext "${EPREFIX}"/usr)
400 $(use_with gmp gmp "${EPREFIX}"/usr)
401 $(use_enable hash hash )
402 $(use_with mhash mhash "${EPREFIX}"/usr)
403 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
404 $(use_enable intl intl )
405 $(use_enable ipv6 ipv6 )
406 $(use_enable json json )
407 $(use_with kerberos kerberos "${EPREFIX}"/usr)
408 $(use_enable xml libxml )
409 $(use_with xml libxml-dir "${EPREFIX}"/usr)
410 $(use_enable unicode mbstring )
411 $(use_with crypt mcrypt "${EPREFIX}"/usr)
412 $(use_with mssql mssql "${EPREFIX}"/usr)
413 $(use_with unicode onig "${EPREFIX}"/usr)
414 $(use_with ssl openssl "${EPREFIX}"/usr)
415 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
416 $(use_enable pcntl pcntl )
417 $(use_enable phar phar )
418 $(use_enable pdo pdo )
419 $(use_enable opcache opcache )
420 $(use_with postgres pgsql "${EPREFIX}"/usr)
421 $(use_enable posix posix )
422 $(use_with spell pspell "${EPREFIX}"/usr)
423 $(use_with recode recode "${EPREFIX}"/usr)
424 $(use_enable simplexml simplexml )
425 $(use_enable sharedmem shmop )
426 $(use_with snmp snmp "${EPREFIX}"/usr)
427 $(use_enable soap soap )
428 $(use_enable sockets sockets )
429 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
430 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
431 $(use_enable sysvipc sysvmsg )
432 $(use_enable sysvipc sysvsem )
433 $(use_enable sysvipc sysvshm )
434 $(use_with systemd fpm-systemd)
435 $(use_with tidy tidy "${EPREFIX}"/usr)
436 $(use_enable tokenizer tokenizer )
437 $(use_enable wddx wddx )
438 $(use_enable xml xml )
439 $(use_enable xmlreader xmlreader )
440 $(use_enable xmlwriter xmlwriter )
441 $(use_with xmlrpc xmlrpc)
442 $(use_with xslt xsl "${EPREFIX}"/usr)
443 $(use_enable zip zip )
444 $(use_with zlib zlib "${EPREFIX}"/usr)
445 $(use_enable debug debug )"
446
447 # DBA support
448 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
449 || use qdbm ; then
450 my_conf="${my_conf} --enable-dba${shared}"
451 fi
452
453 # DBA drivers support
454 my_conf+="
455 $(use_with cdb cdb)
456 $(use_with berkdb db4 ${EPREFIX}/usr)
457 $(use_enable flatfile flatfile )
458 $(use_with gdbm gdbm ${EPREFIX}/usr)
459 $(use_enable inifile inifile )
460 $(use_with qdbm qdbm ${EPREFIX}/usr)"
461
462 # Support for the GD graphics library
463 my_conf+="
464 $(use_with truetype freetype-dir ${EPREFIX}/usr)
465 $(use_with truetype t1lib ${EPREFIX}/usr)
466 $(use_enable cjk gd-jis-conv )
467 $(use_with gd jpeg-dir ${EPREFIX}/usr)
468 $(use_with gd png-dir ${EPREFIX}/usr)
469 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
470 # enable gd last, so configure can pick up the previous settings
471 my_conf+="
472 $(use_with gd gd)"
473
474 # IMAP support
475 if use imap ; then
476 my_conf+="
477 $(use_with imap imap ${EPREFIX}/usr)
478 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
479 fi
480
481 # Interbase/firebird support
482
483 if use firebird ; then
484 my_conf+="
485 $(use_with firebird interbase ${EPREFIX}/usr)"
486 fi
487
488 # LDAP support
489 if use ldap ; then
490 my_conf+="
491 $(use_with ldap ldap ${EPREFIX}/usr)
492 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
493 fi
494
495 # MySQL support
496 local mysqllib="mysqlnd"
497 local mysqlilib="mysqlnd"
498 use libmysqlclient && mysqllib="${EPREFIX}/usr"
499 use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
500
501 my_conf+=" $(use_with mysql mysql $mysqllib)"
502 my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
503
504 local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
505 if use mysql ; then
506 my_conf+="${mysqlsock}"
507 elif use mysqli ; then
508 my_conf+="${mysqlsock}"
509 fi
510
511 # ODBC support
512 if use odbc ; then
513 my_conf+="
514 $(use_with odbc unixODBC ${EPREFIX}/usr)"
515 fi
516
517 if use iodbc ; then
518 my_conf+="
519 $(use_with iodbc iodbc ${EPREFIX}/usr)"
520 fi
521
522 # Oracle support
523 if use oci8-instant-client ; then
524 my_conf+="
525 $(use_with oci8-instant-client oci8)"
526 fi
527
528 # PDO support
529 if use pdo ; then
530 my_conf+="
531 $(use_with mssql pdo-dblib )
532 $(use_with mysql pdo-mysql ${mysqllib})
533 $(use_with postgres pdo-pgsql )
534 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
535 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
536 if use oci8-instant-client ; then
537 my_conf+="
538 $(use_with oci8-instant-client pdo-oci)"
539 fi
540 fi
541
542 # readline/libedit support
543 my_conf+="
544 $(use_with readline readline ${EPREFIX}/usr)
545 $(use_with libedit libedit ${EPREFIX}/usr)"
546
547 # Session support
548 if use session ; then
549 my_conf+="
550 $(use_with sharedmem mm ${EPREFIX}/usr)"
551 else
552 my_conf+="
553 $(use_enable session session )"
554 fi
555
556 # Use pic for shared modules such as apache2's mod_php
557 my_conf="${my_conf} --with-pic"
558
559 # we use the system copy of pcre
560 # --with-pcre-regex affects ext/pcre
561 # --with-pcre-dir affects ext/filter and ext/zip
562 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
563
564 # Catch CFLAGS problems
565 # Fixes bug #14067.
566 # Changed order to run it in reverse for bug #32022 and #12021.
567 replace-cpu-flags "k6*" "i586"
568
569 # Support user-passed configuration parameters
570 my_conf="${my_conf} ${EXTRA_ECONF:-}"
571
572 # Support the Apache2 extras, they must be set globally for all
573 # SAPIs to work correctly, especially for external PHP extensions
574
575 mkdir -p "${WORKDIR}/sapis-build"
576 for one_sapi in $SAPIS ; do
577 use "${one_sapi}" || continue
578 php_set_ini_dir "${one_sapi}"
579
580 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
581 cd "${WORKDIR}/sapis-build/${one_sapi}"
582
583 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
584 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
585
586 for sapi in $SAPIS ; do
587 case "$sapi" in
588 cli|cgi|embed|fpm)
589 if [[ "${one_sapi}" == "${sapi}" ]] ; then
590 sapi_conf="${sapi_conf} --enable-${sapi}"
591 else
592 sapi_conf="${sapi_conf} --disable-${sapi}"
593 fi
594 ;;
595
596 apache2)
597 if [[ "${one_sapi}" == "${sapi}" ]] ; then
598 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
599 else
600 sapi_conf="${sapi_conf} --without-apxs2"
601 fi
602 ;;
603 esac
604 done
605
606 econf ${sapi_conf}
607 done
608 }
609
610 src_compile() {
611 # snmp seems to run during src_compile, too (bug #324739)
612 addpredict /usr/share/snmp/mibs/.index
613 addpredict /var/lib/net-snmp/mib_indexes
614
615 for sapi in ${SAPIS} ; do
616 if use "${sapi}"; then
617 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
618 emake || die "emake failed"
619 fi
620 done
621 }
622
623 src_install() {
624 # see bug #324739 for what happens when we don't have that
625 addpredict /usr/share/snmp/mibs/.index
626
627 # grab the first SAPI that got built and install common files from there
628 local first_sapi=""
629 for sapi in $SAPIS ; do
630 if use $sapi ; then
631 first_sapi=$sapi
632 break
633 fi
634 done
635
636 # Makefile forgets to create this before trying to write to it...
637 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
638
639 # Install php environment (without any sapis)
640 cd "${WORKDIR}/sapis-build/$first_sapi"
641 emake INSTALL_ROOT="${D}" \
642 install-build install-headers install-programs \
643 || die "emake install failed"
644
645 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
646
647 # Create the directory where we'll put version-specific php scripts
648 keepdir /usr/share/php${PHP_MV}
649
650 local sapi="", file=""
651 local sapi_list=""
652
653 for sapi in ${SAPIS}; do
654 if use "${sapi}" ; then
655 einfo "Installing SAPI: ${sapi}"
656 cd "${WORKDIR}/sapis-build/${sapi}"
657
658 if [[ "${sapi}" == "apache2" ]] ; then
659 # We're specifically not using emake install-sapi as libtool
660 # may cause unnecessary relink failures (see bug #351266)
661 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
662 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
663 keepdir "/usr/$(get_libdir)/apache2/modules"
664 else
665 # needed each time, php_install_ini would reset it
666 local dest="${PHP_DESTDIR#${EPREFIX}}"
667 into "${dest}"
668 case "$sapi" in
669 cli)
670 source="sapi/cli/php"
671 ;;
672 cgi)
673 source="sapi/cgi/php-cgi"
674 ;;
675 fpm)
676 source="sapi/fpm/php-fpm"
677 ;;
678 embed)
679 source="libs/libphp${PHP_MV}$(get_libname)"
680 ;;
681 *)
682 die "unhandled sapi in src_install"
683 ;;
684 esac
685
686 if [[ "${source}" == *"$(get_libname)" ]]; then
687 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
688 else
689 dobin "${source}" || die "Unable to install ${sapi} sapi"
690 local name="$(basename ${source})"
691 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
692 fi
693 fi
694
695 php_install_ini "${sapi}"
696
697 # construct correct SAPI string for php-config
698 # thanks to ferringb for the bash voodoo
699 if [[ "${sapi}" == "apache2" ]]; then
700 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
701 else
702 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
703 fi
704 fi
705 done
706
707 # Installing opcache module
708 if use_if_iuse opcache ; then
709 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
710 fi
711
712 # Install env.d files
713 newenvd "${FILESDIR}/20php5-envd" \
714 "20php${SLOT}"
715 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
716 "${ED}/etc/env.d/20php${SLOT}"
717 sed -e "s|php5|php${SLOT}|g" -i \
718 "${ED}/etc/env.d/20php${SLOT}"
719
720 # set php-config variable correctly (bug #278439)
721 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
722 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
723
724 if use fpm ; then
725 if use systemd; then
726 systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
727 else
728 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
729 fi
730 fi
731 }
732
733 src_test() {
734 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
735 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
736 if [[ ! -x "${PHP_BIN}" ]] ; then
737 ewarn "Test phase requires USE=cli, skipping"
738 return
739 else
740 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
741 fi
742
743 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
744 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
745 fi
746
747 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
748 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
749
750 for name in ${EXPECTED_TEST_FAILURES}; do
751 mv "${name}.out" "${name}.out.orig" 2>/dev/null
752 done
753
754 local failed="$(find -name '*.out')"
755 if [[ ${failed} != "" ]] ; then
756 ewarn "The following test cases failed unexpectedly:"
757 for name in ${failed}; do
758 ewarn " ${name/.out/}"
759 done
760 else
761 einfo "No unexpected test failures, all fine"
762 fi
763
764 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
765 local passed=""
766 for name in ${EXPECTED_TEST_FAILURES}; do
767 [[ -f "${name}.diff" ]] && continue
768 passed="${passed} ${name}"
769 done
770 if [[ ${passed} != "" ]] ; then
771 einfo "The following test cases passed unexpectedly:"
772 for name in ${passed}; do
773 ewarn " ${passed}"
774 done
775 else
776 einfo "None of the known-to-fail tests passed, all fine"
777 fi
778 fi
779 }
780
781 pkg_postinst() {
782 # Output some general info to the user
783 if use apache2 ; then
784 APACHE2_MOD_DEFINE="PHP5"
785 APACHE2_MOD_CONF="70_mod_php5"
786 apache-module_pkg_postinst
787 fi
788
789 # Create the symlinks for php
790 for m in ${SAPIS}; do
791 [[ ${m} == 'embed' ]] && continue;
792 if use $m ; then
793 local ci=$(eselect php show $m)
794 if [[ -z $ci ]]; then
795 eselect php set $m php${SLOT}
796 einfo "Switched ${m} to use php:${SLOT}"
797 einfo
798 elif [[ $ci != "php${SLOT}" ]] ; then
799 elog "To switch $m to use php:${SLOT}, run"
800 elog " eselect php set $m php${SLOT}"
801 elog
802 fi
803 fi
804 done
805
806 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
807 elog "to compile extensions for the ${SLOT} ABI"
808 elog
809 if ! use readline && use cli ; then
810 ewarn "Note that in order to use php interactivly, you need to enable"
811 ewarn "the readline USE flag or php -a will hang"
812 fi
813 elog
814 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
815 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
816 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
817 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
818
819 elog
820 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
821 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
822 elog
823 }
824
825 pkg_prerm() {
826 eselect php cleanup
827 }