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