Gentoo Archives: gentoo-commits

From: "Ole Markus With (olemarkus)" <olemarkus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/php: php-5.5.1-r1.ebuild ChangeLog
Date: Sat, 27 Jul 2013 11:15:59
Message-Id: 20130727111555.8369421710@flycatcher.gentoo.org
1 olemarkus 13/07/27 11:15:55
2
3 Modified: ChangeLog
4 Added: php-5.5.1-r1.ebuild
5 Log:
6 Revbump providing preliminary systemd support
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.733 dev-lang/php/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.733&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.733&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?r1=1.732&r2=1.733
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
20 retrieving revision 1.732
21 retrieving revision 1.733
22 diff -u -r1.732 -r1.733
23 --- ChangeLog 27 Jul 2013 11:12:32 -0000 1.732
24 +++ ChangeLog 27 Jul 2013 11:15:55 -0000 1.733
25 @@ -1,6 +1,11 @@
26 # ChangeLog for dev-lang/php
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.732 2013/07/27 11:12:32 olemarkus Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.733 2013/07/27 11:15:55 olemarkus Exp $
30 +
31 +*php-5.5.1-r1 (27 Jul 2013)
32 +
33 + 27 Jul 2013; Ole Markus With <olemarkus@g.o> +php-5.5.1-r1.ebuild:
34 + Revbump providing preliminary systemd support
35
36 *php-5.5.1-r1 (27 Jul 2013)
37
38
39
40
41 1.1 dev-lang/php/php-5.5.1-r1.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.1-r1.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.1-r1.ebuild?rev=1.1&content-type=text/plain
45
46 Index: php-5.5.1-r1.ebuild
47 ===================================================================
48 # Copyright 1999-2013 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.5.1-r1.ebuild,v 1.1 2013/07/27 11:15:55 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-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/dsp/${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 systemd 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.1-r1[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
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
142 media-libs/libpng:0=
143 sys-libs/zlib
144 ) )
145 firebird? ( dev-db/firebird )
146 gd? ( virtual/jpeg 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 systemd? ( sys-apps/systemd )
177 sybase-ct? ( dev-db/freetds )
178 tidy? ( app-text/htmltidy )
179 truetype? (
180 =media-libs/freetype-2*
181 >=media-libs/t1lib-5.0.0
182 !gd? (
183 virtual/jpeg media-libs/libpng:0= sys-libs/zlib )
184 )
185 unicode? ( dev-libs/oniguruma )
186 wddx? ( >=dev-libs/libxml2-2.6.8 )
187 xml? ( >=dev-libs/libxml2-2.6.8 )
188 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
189 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
190 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
191 xpm? (
192 x11-libs/libXpm
193 virtual/jpeg
194 media-libs/libpng:0= sys-libs/zlib
195 )
196 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
197 zip? ( sys-libs/zlib )
198 zlib? ( sys-libs/zlib )
199 virtual/mta
200 "
201
202 php="=${CATEGORY}/${PF}"
203
204 REQUIRED_USE="
205 truetype? ( gd )
206 cjk? ( gd )
207 exif? ( gd )
208
209 xpm? ( gd )
210 gd? ( zlib )
211 simplexml? ( xml )
212 soap? ( xml )
213 wddx? ( xml )
214 xmlrpc? ( || ( xml iconv ) )
215 xmlreader? ( xml )
216 xslt? ( xml )
217 ldap-sasl? ( ldap )
218 mhash? ( hash )
219 phar? ( hash )
220 libmysqlclient? ( || (
221 mysql
222 mysqli
223 pdo
224 ) )
225
226 qdbm? ( !gdbm )
227 readline? ( !libedit )
228 recode? ( !imap !mysql !mysqli )
229 sharedmem? ( !threads )
230
231 systemd? ( fpm )
232
233 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
234
235 RDEPEND="${DEPEND}"
236
237 RDEPEND="${RDEPEND} fpm? ( selinux? ( sec-policy/selinux-phpfpm ) )"
238
239 DEPEND="${DEPEND}
240 sys-devel/flex
241 >=sys-devel/m4-1.4.3
242 >=sys-devel/libtool-1.5.18"
243
244 # 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
282 dodir "${PHP_INI_DIR#${EPREFIX}}"
283 insinto "${PHP_INI_DIR#${EPREFIX}}"
284 newins "${phpinisrc}" "${PHP_INI_FILE}"
285
286 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
287 elog
288
289 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
290 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
291
292 if use_if_iuse opcache; then
293 elog "Adding opcache to $PHP_EXT_INI_DIR"
294 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
295 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
296 fi
297
298 # SAPI-specific handling
299
300 if [[ "${sapi}" == "fpm" ]] ; then
301 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
302 einfo "Installing FPM CGI config file php-fpm.conf"
303 insinto "${PHP_INI_DIR#${EPREFIX}}"
304 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
305
306 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
307 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
308 fi
309
310 # Install PHP ini files into /usr/share/php
311
312 dodoc php.ini-development
313 dodoc php.ini-production
314
315 }
316
317 php_set_ini_dir() {
318 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
319 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
320 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
321 }
322
323 src_prepare() {
324 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
325 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
326 # there is no easy way to circumvent that, all php calls during
327 # install use -n, so no php.ini file will be used.
328 # As such, this is the easiest way to get around
329 addpredict /session_mm_cli250.sem
330 addpredict /session_mm_cli0.sem
331
332 # Change PHP branding
333 # Get the alpha/beta/rc version
334 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
335 -i configure.in || die "Unable to change PHP branding"
336
337
338 epatch "${FILESDIR}"/iodbc-pkgconfig.patch
339 epatch "${FILESDIR}"/stricter-libc-client-symlink-check.patch
340 epatch "${FILESDIR}"/all_strict_aliasing.patch
341
342 # Patch PHP to show Gentoo as the server platform
343 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
344 -i configure.in || die "Failed to fix server platform name"
345
346 # Prevent PHP from activating the Apache config,
347 # as we will do that ourselves
348 sed -i \
349 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
350 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
351 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
352
353 # Patch PHP to support heimdal instead of mit-krb5
354 if has_version "app-crypt/heimdal" ; then
355 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
356 || die "Failed to fix heimdal libname"
357 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
358 || die "Failed to fix heimdal crypt library reference"
359 fi
360
361 #Add user patches #357637
362 epatch_user
363
364 #force rebuilding aclocal.m4
365 rm aclocal.m4
366 eautoreconf
367
368 if [[ ${CHOST} == *-darwin* ]] ; then
369 # http://bugs.php.net/bug.php?id=48795, bug #343481
370 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
371 fi
372 }
373
374 src_configure() {
375 addpredict /usr/share/snmp/mibs/.index
376 addpredict /var/lib/net-snmp/mib_indexes
377
378 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
379
380 # This is a global variable and should be in caps. It isn't because the
381 # phpconfutils eclass relies on exactly this name...
382 # for --with-libdir see bug #327025
383 my_conf="
384 --prefix="${PHP_DESTDIR}"
385 --mandir="${PHP_DESTDIR}"/man
386 --infodir="${PHP_DESTDIR}"/info
387 --libdir="${PHP_DESTDIR}"/lib
388 --with-libdir=$(get_libdir)
389 --without-pear
390 $(use_enable threads maintainer-zts)"
391
392 # extension USE flag shared
393 my_conf+="
394 $(use_enable bcmath bcmath )
395 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
396 $(use_enable calendar calendar )
397 $(use_enable ctype ctype )
398 $(use_with curl curl "${EPREFIX}"/usr)
399 $(use_enable xml dom )
400 $(use_with enchant enchant "${EPREFIX}"/usr)
401 $(use_enable exif exif )
402 $(use_enable fileinfo fileinfo )
403 $(use_enable filter filter )
404 $(use_enable ftp ftp )
405 $(use_with nls gettext "${EPREFIX}"/usr)
406 $(use_with gmp gmp "${EPREFIX}"/usr)
407 $(use_enable hash hash )
408 $(use_with mhash mhash "${EPREFIX}"/usr)
409 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
410 $(use_enable intl intl )
411 $(use_enable ipv6 ipv6 )
412 $(use_enable json json )
413 $(use_with kerberos kerberos "${EPREFIX}"/usr)
414 $(use_enable xml libxml )
415 $(use_with xml libxml-dir "${EPREFIX}"/usr)
416 $(use_enable unicode mbstring )
417 $(use_with crypt mcrypt "${EPREFIX}"/usr)
418 $(use_with mssql mssql "${EPREFIX}"/usr)
419 $(use_with unicode onig "${EPREFIX}"/usr)
420 $(use_with ssl openssl "${EPREFIX}"/usr)
421 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
422 $(use_enable pcntl pcntl )
423 $(use_enable phar phar )
424 $(use_enable pdo pdo )
425 $(use_enable opcache opcache )
426 $(use_with postgres pgsql "${EPREFIX}"/usr)
427 $(use_enable posix posix )
428 $(use_with spell pspell "${EPREFIX}"/usr)
429 $(use_with recode recode "${EPREFIX}"/usr)
430 $(use_enable simplexml simplexml )
431 $(use_enable sharedmem shmop )
432 $(use_with snmp snmp "${EPREFIX}"/usr)
433 $(use_enable soap soap )
434 $(use_enable sockets sockets )
435 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
436 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
437 $(use_enable sysvipc sysvmsg )
438 $(use_enable sysvipc sysvsem )
439 $(use_enable sysvipc sysvshm )
440 $(use_with tidy tidy "${EPREFIX}"/usr)
441 $(use_enable tokenizer tokenizer )
442 $(use_enable wddx wddx )
443 $(use_enable xml xml )
444 $(use_enable xmlreader xmlreader )
445 $(use_enable xmlwriter xmlwriter )
446 $(use_with xmlrpc xmlrpc)
447 $(use_with xslt xsl "${EPREFIX}"/usr)
448 $(use_enable zip zip )
449 $(use_with zlib zlib "${EPREFIX}"/usr)
450 $(use_enable debug debug )"
451
452 # DBA support
453 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
454 || use qdbm ; then
455 my_conf="${my_conf} --enable-dba${shared}"
456 fi
457
458 # DBA drivers support
459 my_conf+="
460 $(use_with cdb cdb)
461 $(use_with berkdb db4 ${EPREFIX}/usr)
462 $(use_enable flatfile flatfile )
463 $(use_with gdbm gdbm ${EPREFIX}/usr)
464 $(use_enable inifile inifile )
465 $(use_with qdbm qdbm ${EPREFIX}/usr)"
466
467 # Support for the GD graphics library
468 my_conf+="
469 $(use_with truetype freetype-dir ${EPREFIX}/usr)
470 $(use_with truetype t1lib ${EPREFIX}/usr)
471 $(use_enable cjk gd-jis-conv )
472 $(use_with gd jpeg-dir ${EPREFIX}/usr)
473 $(use_with gd png-dir ${EPREFIX}/usr)
474 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
475 # enable gd last, so configure can pick up the previous settings
476 my_conf+="
477 $(use_with gd gd)"
478
479 # IMAP support
480 if use imap ; then
481 my_conf+="
482 $(use_with imap imap ${EPREFIX}/usr)
483 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
484 fi
485
486 # Interbase/firebird support
487
488 if use firebird ; then
489 my_conf+="
490 $(use_with firebird interbase ${EPREFIX}/usr)"
491 fi
492
493 # LDAP support
494 if use ldap ; then
495 my_conf+="
496 $(use_with ldap ldap ${EPREFIX}/usr)
497 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
498 fi
499
500 # MySQL support
501 local mysqllib="mysqlnd"
502 local mysqlilib="mysqlnd"
503 use libmysqlclient && mysqllib="${EPREFIX}/usr"
504 use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
505
506 my_conf+=" $(use_with mysql mysql $mysqllib)"
507 my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
508
509 local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
510 if use mysql ; then
511 my_conf+="${mysqlsock}"
512 elif use mysqli ; then
513 my_conf+="${mysqlsock}"
514 fi
515
516 # ODBC support
517 if use odbc ; then
518 my_conf+="
519 $(use_with odbc unixODBC ${EPREFIX}/usr)"
520 fi
521
522 if use iodbc ; then
523 my_conf+="
524 $(use_with iodbc iodbc ${EPREFIX}/usr)"
525 fi
526
527 # Oracle support
528 if use oci8-instant-client ; then
529 my_conf+="
530 $(use_with oci8-instant-client oci8)"
531 fi
532
533 # PDO support
534 if use pdo ; then
535 my_conf+="
536 $(use_with mssql pdo-dblib )
537 $(use_with mysql pdo-mysql ${mysqllib})
538 $(use_with postgres pdo-pgsql )
539 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
540 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
541 if use oci8-instant-client ; then
542 my_conf+="
543 $(use_with oci8-instant-client pdo-oci)"
544 fi
545 fi
546
547 # readline/libedit support
548 my_conf+="
549 $(use_with readline readline ${EPREFIX}/usr)
550 $(use_with libedit libedit ${EPREFIX}/usr)"
551
552 # Session support
553 if use session ; then
554 my_conf+="
555 $(use_with sharedmem mm ${EPREFIX}/usr)"
556 else
557 my_conf+="
558 $(use_enable session session )"
559 fi
560
561 # Use pic for shared modules such as apache2's mod_php
562 my_conf="${my_conf} --with-pic"
563
564 # we use the system copy of pcre
565 # --with-pcre-regex affects ext/pcre
566 # --with-pcre-dir affects ext/filter and ext/zip
567 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
568
569 # Catch CFLAGS problems
570 # Fixes bug #14067.
571 # Changed order to run it in reverse for bug #32022 and #12021.
572 replace-cpu-flags "k6*" "i586"
573
574 # Support user-passed configuration parameters
575 my_conf="${my_conf} ${EXTRA_ECONF:-}"
576
577 # Support the Apache2 extras, they must be set globally for all
578 # SAPIs to work correctly, especially for external PHP extensions
579
580 mkdir -p "${WORKDIR}/sapis-build"
581 for one_sapi in $SAPIS ; do
582 use "${one_sapi}" || continue
583 php_set_ini_dir "${one_sapi}"
584
585 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
586 cd "${WORKDIR}/sapis-build/${one_sapi}"
587
588 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
589 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
590
591 for sapi in $SAPIS ; do
592 case "$sapi" in
593 cli|cgi|embed|fpm)
594 if [[ "${one_sapi}" == "${sapi}" ]] ; then
595 sapi_conf="${sapi_conf} --enable-${sapi}"
596 else
597 sapi_conf="${sapi_conf} --disable-${sapi}"
598 fi
599
600 if [[ ${sapi} == "fpm" ]] && use systemd ; then
601 sapi_conf+=" --with-fpm-systemd"
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
734 src_test() {
735 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
736 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
737 if [[ ! -x "${PHP_BIN}" ]] ; then
738 ewarn "Test phase requires USE=cli, skipping"
739 return
740 else
741 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
742 fi
743
744 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
745 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
746 fi
747
748 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
749 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
750
751 for name in ${EXPECTED_TEST_FAILURES}; do
752 mv "${name}.out" "${name}.out.orig" 2>/dev/null
753 done
754
755 local failed="$(find -name '*.out')"
756 if [[ ${failed} != "" ]] ; then
757 ewarn "The following test cases failed unexpectedly:"
758 for name in ${failed}; do
759 ewarn " ${name/.out/}"
760 done
761 else
762 einfo "No unexpected test failures, all fine"
763 fi
764
765 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
766 local passed=""
767 for name in ${EXPECTED_TEST_FAILURES}; do
768 [[ -f "${name}.diff" ]] && continue
769 passed="${passed} ${name}"
770 done
771 if [[ ${passed} != "" ]] ; then
772 einfo "The following test cases passed unexpectedly:"
773 for name in ${passed}; do
774 ewarn " ${passed}"
775 done
776 else
777 einfo "None of the known-to-fail tests passed, all fine"
778 fi
779 fi
780 }
781
782 pkg_postinst() {
783 # Output some general info to the user
784 if use apache2 ; then
785 APACHE2_MOD_DEFINE="PHP5"
786 APACHE2_MOD_CONF="70_mod_php5"
787 apache-module_pkg_postinst
788 fi
789
790 # Create the symlinks for php
791 for m in ${SAPIS}; do
792 [[ ${m} == 'embed' ]] && continue;
793 if use $m ; then
794 local ci=$(eselect php show $m)
795 if [[ -z $ci ]]; then
796 eselect php set $m php${SLOT}
797 einfo "Switched ${m} to use php:${SLOT}"
798 einfo
799 elif [[ $ci != "php${SLOT}" ]] ; then
800 elog "To switch $m to use php:${SLOT}, run"
801 elog " eselect php set $m php${SLOT}"
802 elog
803 fi
804 fi
805 done
806
807 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
808 elog "to compile extensions for the ${SLOT} ABI"
809 elog
810 if ! use readline && use cli ; then
811 ewarn "Note that in order to use php interactivly, you need to enable"
812 ewarn "the readline USE flag or php -a will hang"
813 fi
814 elog
815 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
816 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
817 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
818 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
819
820 elog
821 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
822 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
823 elog
824 }
825
826 pkg_prerm() {
827 eselect php cleanup
828 }