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