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.4.29.ebuild php-5.5.13.ebuild ChangeLog
Date: Fri, 30 May 2014 20:11:55
Message-Id: 20140530201149.204762004E@flycatcher.gentoo.org
1 olemarkus 14/05/30 20:11:49
2
3 Modified: ChangeLog
4 Added: php-5.4.29.ebuild php-5.5.13.ebuild
5 Log:
6 Version bump
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.837 dev-lang/php/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.837&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.837&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?r1=1.836&r2=1.837
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
20 retrieving revision 1.836
21 retrieving revision 1.837
22 diff -u -r1.836 -r1.837
23 --- ChangeLog 25 May 2014 18:51:38 -0000 1.836
24 +++ ChangeLog 30 May 2014 20:11:48 -0000 1.837
25 @@ -1,6 +1,13 @@
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.836 2014/05/25 18:51:38 maekke Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.837 2014/05/30 20:11:48 olemarkus Exp $
30 +
31 +*php-5.4.29 (30 May 2014)
32 +*php-5.5.13 (30 May 2014)
33 +
34 + 30 May 2014; Ole Markus With <olemarkus@g.o> +php-5.4.29.ebuild,
35 + +php-5.5.13.ebuild:
36 + Version bump
37
38 25 May 2014; Markus Meier <maekke@g.o> php-5.5.12.ebuild:
39 arm stable, bug #509132
40
41
42
43 1.1 dev-lang/php/php-5.4.29.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.4.29.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.4.29.ebuild?rev=1.1&content-type=text/plain
47
48 Index: php-5.4.29.ebuild
49 ===================================================================
50 # Copyright 1999-2014 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.4.29.ebuild,v 1.1 2014/05/30 20:11:48 olemarkus Exp $
53
54 EAPI=5
55
56 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
57
58 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"
59
60 function php_get_uri ()
61 {
62 case "${1}" in
63 "php-pre")
64 echo "http://downloads.php.net/stas/${2}"
65 ;;
66 "php")
67 echo "http://www.php.net/distributions/${2}"
68 ;;
69 "olemarkus")
70 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
71 ;;
72 "gentoo")
73 echo "mirror://gentoo/${2}"
74 ;;
75 *)
76 die "unhandled case in php_get_uri"
77 ;;
78 esac
79 }
80
81 PHP_MV="$(get_major_version)"
82 SLOT="$(get_version_component_range 1-2)"
83
84 # alias, so we can handle different types of releases (finals, rcs, alphas,
85 # betas, ...) w/o changing the whole ebuild
86 PHP_PV="${PV/_rc/RC}"
87 PHP_PV="${PHP_PV/_alpha/alpha}"
88 PHP_PV="${PHP_PV/_beta/beta}"
89 PHP_RELEASE="php"
90 [[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
91 [[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
92 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
93 PHP_P="${PN}-${PHP_PV}"
94
95 PHP_PATCHSET_LOC="olemarkus"
96
97 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
98
99 PHP_PATCHSET="2"
100 PHP_PATCHSET_URI="
101 $(php_get_uri "${PHP_PATCHSET_LOC}" "php-patchset-${SLOT}-r${PHP_PATCHSET}.tar.bz2")"
102
103 PHP_FPM_INIT_VER="4"
104 PHP_FPM_CONF_VER="1"
105
106 SRC_URI="
107 ${PHP_SRC_URI}
108 ${PHP_PATCHSET_URI}"
109
110 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
111 HOMEPAGE="http://php.net/"
112 LICENSE="PHP-3"
113
114 S="${WORKDIR}/${PHP_P}"
115
116 # We can build the following SAPIs in the given order
117 SAPIS="embed cli cgi fpm apache2"
118
119 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
120 IUSE="${IUSE}
121 ${SAPIS/cli/+cli}
122 threads"
123
124 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
125 crypt +ctype curl curlwrappers debug
126 enchant exif +fileinfo +filter firebird
127 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
128 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
129 mssql mysql mysqlnd mysqli nls
130 oci8-instant-client odbc pcntl pdo +phar +posix postgres qdbm
131 readline recode selinux +session sharedmem
132 +simplexml snmp soap sockets spell sqlite ssl
133 sybase-ct sysvipc systemd tidy +tokenizer truetype unicode wddx
134 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
135
136 DEPEND="
137 >=app-admin/eselect-php-0.7.1-r3[apache2?,fpm?]
138 >=dev-libs/libpcre-8.32[unicode]
139 apache2? ( www-servers/apache[threads=] )
140 berkdb? ( =sys-libs/db-4* )
141 bzip2? ( app-arch/bzip2 )
142 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
143 cjk? ( !gd? (
144 virtual/jpeg:0
145 media-libs/libpng:0=
146 sys-libs/zlib
147 ) )
148 crypt? ( >=dev-libs/libmcrypt-2.4 )
149 curl? ( >=net-misc/curl-7.10.5 )
150 enchant? ( app-text/enchant )
151 exif? ( !gd? (
152 virtual/jpeg:0
153 media-libs/libpng:0=
154 sys-libs/zlib
155 ) )
156 firebird? ( dev-db/firebird )
157 gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
158 gdbm? ( >=sys-libs/gdbm-1.8.0 )
159 gmp? ( >=dev-libs/gmp-4.1.2 )
160 iconv? ( virtual/libiconv )
161 imap? ( virtual/imap-c-client[ssl=] )
162 intl? ( dev-libs/icu:= )
163 iodbc? ( dev-db/libiodbc )
164 kerberos? ( virtual/krb5 )
165 ldap? ( >=net-nds/openldap-1.2.11 )
166 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
167 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
168 mssql? ( dev-db/freetds[mssql] )
169 !mysqlnd? (
170 mysql? ( virtual/mysql )
171 mysqli? ( >=virtual/mysql-4.1 )
172 )
173 nls? ( sys-devel/gettext )
174 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
175 odbc? ( >=dev-db/unixODBC-1.8.13 )
176 postgres? ( dev-db/postgresql-base )
177 qdbm? ( dev-db/qdbm )
178 readline? ( sys-libs/readline )
179 recode? ( app-text/recode )
180 sharedmem? ( dev-libs/mm )
181 simplexml? ( >=dev-libs/libxml2-2.6.8 )
182 snmp? ( >=net-analyzer/net-snmp-5.2 )
183 soap? ( >=dev-libs/libxml2-2.6.8 )
184 spell? ( >=app-text/aspell-0.50 )
185 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
186 ssl? ( >=dev-libs/openssl-0.9.7 )
187 sybase-ct? ( dev-db/freetds )
188 tidy? ( app-text/htmltidy )
189 truetype? (
190 =media-libs/freetype-2*
191 >=media-libs/t1lib-5.0.0
192 !gd? (
193 virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
194 )
195 unicode? ( dev-libs/oniguruma )
196 wddx? ( >=dev-libs/libxml2-2.6.8 )
197 xml? ( >=dev-libs/libxml2-2.6.8 )
198 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
199 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
200 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
201 xpm? (
202 x11-libs/libXpm
203 virtual/jpeg:0
204 media-libs/libpng:0= sys-libs/zlib
205 )
206 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
207 zip? ( sys-libs/zlib )
208 zlib? ( sys-libs/zlib )
209 virtual/mta
210 "
211
212 php="=${CATEGORY}/${PF}"
213
214 REQUIRED_USE="
215 truetype? ( gd )
216 cjk? ( gd )
217 exif? ( gd )
218
219 xpm? ( gd )
220 gd? ( zlib )
221 simplexml? ( xml )
222 soap? ( xml )
223 wddx? ( xml )
224 xmlrpc? ( || ( xml iconv ) )
225 xmlreader? ( xml )
226 xslt? ( xml )
227 ldap-sasl? ( ldap )
228 mhash? ( hash )
229 phar? ( hash )
230 mysqlnd? ( || (
231 mysql
232 mysqli
233 pdo
234 ) )
235
236 qdbm? ( !gdbm )
237 readline? ( !libedit )
238 recode? ( !imap !mysql !mysqli )
239 sharedmem? ( !threads )
240
241 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
242
243 RDEPEND="${DEPEND}"
244
245 RDEPEND="${RDEPEND}
246 fpm? (
247 selinux? ( sec-policy/selinux-phpfpm )
248 systemd? ( sys-apps/systemd ) )"
249
250 DEPEND="${DEPEND}
251 sys-devel/flex
252 >=sys-devel/m4-1.4.3
253 >=sys-devel/libtool-1.5.18"
254
255 # Allow users to install production version if they want to
256
257 case "${PHP_INI_VERSION}" in
258 production|development)
259 ;;
260 *)
261 PHP_INI_VERSION="development"
262 ;;
263 esac
264
265 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
266 PHP_INI_FILE="php.ini"
267
268 want_apache
269
270 pkg_setup() {
271 depend.apache_pkg_setup
272 }
273
274 php_install_ini() {
275 local phpsapi="${1}"
276
277 # work out where we are installing the ini file
278 php_set_ini_dir "${phpsapi}"
279
280 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
281 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
282
283 # default to /tmp for save_path, bug #282768
284 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
285
286 # Set the extension dir
287 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
288
289 # Set the include path to point to where we want to find PEAR packages
290 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
291
292 if use_if_iuse opcache; then
293 elog "Adding opcache to ${phpinisrc}"
294 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> ${phpinisrc}
295 fi
296
297 dodir "${PHP_INI_DIR#${EPREFIX}}"
298 insinto "${PHP_INI_DIR#${EPREFIX}}"
299 newins "${phpinisrc}" "${PHP_INI_FILE}"
300
301 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
302 elog
303
304 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
305 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
306
307 # SAPI-specific handling
308
309 if [[ "${sapi}" == "fpm" ]] ; then
310 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
311 einfo "Installing FPM CGI config file php-fpm.conf"
312 insinto "${PHP_INI_DIR#${EPREFIX}}"
313 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
314
315 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
316 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
317 fi
318
319 # Install PHP ini files into /usr/share/php
320
321 dodoc php.ini-development
322 dodoc php.ini-production
323
324 }
325
326 php_set_ini_dir() {
327 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
328 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
329 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
330 }
331
332 src_prepare() {
333 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
334 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
335 # there is no easy way to circumvent that, all php calls during
336 # install use -n, so no php.ini file will be used.
337 # As such, this is the easiest way to get around
338 addpredict /session_mm_cli250.sem
339 addpredict /session_mm_cli0.sem
340
341 # Change PHP branding
342 # Get the alpha/beta/rc version
343 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
344 -i configure.in || die "Unable to change PHP branding"
345
346 # Patch PHP to show Gentoo as the server platform
347 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
348 -i configure.in || die "Failed to fix server platform name"
349
350 # Prevent PHP from activating the Apache config,
351 # as we will do that ourselves
352 sed -i \
353 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
354 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
355 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
356
357 # Patch PHP to support heimdal instead of mit-krb5
358 if has_version "app-crypt/heimdal" ; then
359 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
360 || die "Failed to fix heimdal libname"
361 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
362 || die "Failed to fix heimdal crypt library reference"
363 fi
364
365 #Add user patches #357637
366 epatch_user
367
368 #force rebuilding aclocal.m4
369 rm aclocal.m4
370 eautoreconf
371
372 if [[ ${CHOST} == *-darwin* ]] ; then
373 # http://bugs.php.net/bug.php?id=48795, bug #343481
374 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
375 fi
376 }
377
378 src_configure() {
379 addpredict /usr/share/snmp/mibs/.index
380 addpredict /var/lib/net-snmp/mib_indexes
381
382 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
383
384 # This is a global variable and should be in caps. It isn't because the
385 # phpconfutils eclass relies on exactly this name...
386 # for --with-libdir see bug #327025
387 my_conf="
388 --prefix="${PHP_DESTDIR}"
389 --mandir="${PHP_DESTDIR}"/man
390 --infodir="${PHP_DESTDIR}"/info
391 --libdir="${PHP_DESTDIR}"/lib
392 --with-libdir=$(get_libdir)
393 --without-pear
394 $(use_enable threads maintainer-zts)"
395
396 # extension USE flag shared
397 my_conf+="
398 $(use_enable bcmath bcmath )
399 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
400 $(use_enable calendar calendar )
401 $(use_enable ctype ctype )
402 $(use_with curl curl "${EPREFIX}"/usr)
403 $(use_with curlwrappers curlwrappers "${EPREFIX}"/usr)
404 $(use_enable xml dom )
405 $(use_with enchant enchant "${EPREFIX}"/usr)
406 $(use_enable exif exif )
407 $(use_enable fileinfo fileinfo )
408 $(use_enable filter filter )
409 $(use_enable ftp ftp )
410 $(use_with nls gettext "${EPREFIX}"/usr)
411 $(use_with gmp gmp "${EPREFIX}"/usr)
412 $(use_enable hash hash )
413 $(use_with mhash mhash "${EPREFIX}"/usr)
414 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
415 $(use_enable intl intl )
416 $(use_enable ipv6 ipv6 )
417 $(use_enable json json )
418 $(use_with kerberos kerberos "${EPREFIX}"/usr)
419 $(use_enable xml libxml )
420 $(use_with xml libxml-dir "${EPREFIX}"/usr)
421 $(use_enable unicode mbstring )
422 $(use_with crypt mcrypt "${EPREFIX}"/usr)
423 $(use_with mssql mssql "${EPREFIX}"/usr)
424 $(use_with unicode onig "${EPREFIX}"/usr)
425 $(use_with ssl openssl "${EPREFIX}"/usr)
426 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
427 $(use_enable pcntl pcntl )
428 $(use_enable phar phar )
429 $(use_enable pdo pdo )
430 $(use_with postgres pgsql "${EPREFIX}"/usr)
431 $(use_enable posix posix )
432 $(use_with spell pspell "${EPREFIX}"/usr)
433 $(use_with recode recode "${EPREFIX}"/usr)
434 $(use_enable simplexml simplexml )
435 $(use_enable sharedmem shmop )
436 $(use_with snmp snmp "${EPREFIX}"/usr)
437 $(use_enable soap soap )
438 $(use_enable sockets sockets )
439 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
440 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
441 $(use_enable sysvipc sysvmsg )
442 $(use_enable sysvipc sysvsem )
443 $(use_enable sysvipc sysvshm )
444 $(use_with systemd fpm-systemd)
445 $(use_with tidy tidy "${EPREFIX}"/usr)
446 $(use_enable tokenizer tokenizer )
447 $(use_enable wddx wddx )
448 $(use_enable xml xml )
449 $(use_enable xmlreader xmlreader )
450 $(use_enable xmlwriter xmlwriter )
451 $(use_with xmlrpc xmlrpc)
452 $(use_with xslt xsl "${EPREFIX}"/usr)
453 $(use_enable zip zip )
454 $(use_with zlib zlib "${EPREFIX}"/usr)
455 $(use_enable debug debug )"
456
457 # DBA support
458 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
459 || use qdbm ; then
460 my_conf="${my_conf} --enable-dba${shared}"
461 fi
462
463 # DBA drivers support
464 my_conf+="
465 $(use_with cdb cdb)
466 $(use_with berkdb db4 ${EPREFIX}/usr)
467 $(use_enable flatfile flatfile )
468 $(use_with gdbm gdbm ${EPREFIX}/usr)
469 $(use_enable inifile inifile )
470 $(use_with qdbm qdbm ${EPREFIX}/usr)"
471
472 # Support for the GD graphics library
473 my_conf+="
474 $(use_with truetype freetype-dir ${EPREFIX}/usr)
475 $(use_with truetype t1lib ${EPREFIX}/usr)
476 $(use_enable cjk gd-jis-conv )
477 $(use_with gd jpeg-dir ${EPREFIX}/usr)
478 $(use_with gd png-dir ${EPREFIX}/usr)
479 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
480 # enable gd last, so configure can pick up the previous settings
481 my_conf+="
482 $(use_with gd gd)"
483
484 # IMAP support
485 if use imap ; then
486 my_conf+="
487 $(use_with imap imap ${EPREFIX}/usr)
488 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
489 fi
490
491 # Interbase/firebird support
492
493 if use firebird ; then
494 my_conf+="
495 $(use_with firebird interbase ${EPREFIX}/usr)"
496 fi
497
498 # LDAP support
499 if use ldap ; then
500 my_conf+="
501 $(use_with ldap ldap ${EPREFIX}/usr)
502 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
503 fi
504
505 # MySQL support
506 if use mysql ; then
507 if use mysqlnd ; then
508 my_conf+="
509 $(use_with mysql mysql mysqlnd)"
510 else
511 my_conf+="
512 $(use_with mysql mysql ${EPREFIX}/usr)"
513 fi
514 my_conf+="
515 $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
516 fi
517
518 # MySQLi support
519 if use mysqlnd ; then
520 my_conf+="
521 $(use_with mysqli mysqli mysqlnd)"
522 else
523 my_conf+="
524 $(use_with mysqli mysqli ${EPREFIX}/usr/bin/mysql_config)"
525 fi
526
527 # ODBC support
528 if use odbc ; then
529 my_conf+="
530 $(use_with odbc unixODBC ${EPREFIX}/usr)"
531 fi
532
533 if use iodbc ; then
534 my_conf+="
535 $(use_with iodbc iodbc ${EPREFIX}/usr)"
536 fi
537
538 # Oracle support
539 if use oci8-instant-client ; then
540 my_conf+="
541 $(use_with oci8-instant-client oci8)"
542 fi
543
544 # PDO support
545 if use pdo ; then
546 my_conf+="
547 $(use_with mssql pdo-dblib )"
548 if use mysqlnd ; then
549 my_conf+="
550 $(use_with mysqlnd pdo-mysql mysqlnd)"
551 else
552 my_conf+="
553 $(use_with mysql pdo-mysql ${EPREFIX}/usr)"
554 fi
555 my_conf+="
556 $(use_with postgres pdo-pgsql )
557 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
558 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
559 if use oci8-instant-client ; then
560 my_conf+="
561 $(use_with oci8-instant-client pdo-oci)"
562 fi
563 fi
564
565 # readline/libedit support
566 my_conf+="
567 $(use_with readline readline ${EPREFIX}/usr)
568 $(use_with libedit libedit ${EPREFIX}/usr)"
569
570 # Session support
571 if use session ; then
572 my_conf+="
573 $(use_with sharedmem mm ${EPREFIX}/usr)"
574 else
575 my_conf+="
576 $(use_enable session session )"
577 fi
578
579 # Use pic for shared modules such as apache2's mod_php
580 my_conf="${my_conf} --with-pic"
581
582 # we use the system copy of pcre
583 # --with-pcre-regex affects ext/pcre
584 # --with-pcre-dir affects ext/filter and ext/zip
585 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
586
587 # Catch CFLAGS problems
588 # Fixes bug #14067.
589 # Changed order to run it in reverse for bug #32022 and #12021.
590 replace-cpu-flags "k6*" "i586"
591
592 # Support user-passed configuration parameters
593 my_conf="${my_conf} ${EXTRA_ECONF:-}"
594
595 # Support the Apache2 extras, they must be set globally for all
596 # SAPIs to work correctly, especially for external PHP extensions
597
598 mkdir -p "${WORKDIR}/sapis-build"
599 for one_sapi in $SAPIS ; do
600 use "${one_sapi}" || continue
601 php_set_ini_dir "${one_sapi}"
602
603 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
604 cd "${WORKDIR}/sapis-build/${one_sapi}"
605
606 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
607 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
608
609 for sapi in $SAPIS ; do
610 case "$sapi" in
611 cli|cgi|embed|fpm)
612 if [[ "${one_sapi}" == "${sapi}" ]] ; then
613 sapi_conf="${sapi_conf} --enable-${sapi}"
614 else
615 sapi_conf="${sapi_conf} --disable-${sapi}"
616 fi
617 ;;
618
619 apache2)
620 if [[ "${one_sapi}" == "${sapi}" ]] ; then
621 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
622 else
623 sapi_conf="${sapi_conf} --without-apxs2"
624 fi
625 ;;
626 esac
627 done
628
629 econf ${sapi_conf}
630 done
631 }
632
633 src_compile() {
634 # snmp seems to run during src_compile, too (bug #324739)
635 addpredict /usr/share/snmp/mibs/.index
636 addpredict /var/lib/net-snmp/mib_indexes
637
638 for sapi in ${SAPIS} ; do
639 if use "${sapi}"; then
640 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
641 emake || die "emake failed"
642 fi
643 done
644 }
645
646 src_install() {
647 # see bug #324739 for what happens when we don't have that
648 addpredict /usr/share/snmp/mibs/.index
649
650 # grab the first SAPI that got built and install common files from there
651 local first_sapi=""
652 for sapi in $SAPIS ; do
653 if use $sapi ; then
654 first_sapi=$sapi
655 break
656 fi
657 done
658
659 # Makefile forgets to create this before trying to write to it...
660 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
661
662 # Install php environment (without any sapis)
663 cd "${WORKDIR}/sapis-build/$first_sapi"
664 emake INSTALL_ROOT="${D}" \
665 install-build install-headers install-programs \
666 || die "emake install failed"
667
668 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
669
670 # Create the directory where we'll put version-specific php scripts
671 keepdir /usr/share/php${PHP_MV}
672
673 local sapi="", file=""
674 local sapi_list=""
675
676 for sapi in ${SAPIS}; do
677 if use "${sapi}" ; then
678 einfo "Installing SAPI: ${sapi}"
679 cd "${WORKDIR}/sapis-build/${sapi}"
680
681 if [[ "${sapi}" == "apache2" ]] ; then
682 # We're specifically not using emake install-sapi as libtool
683 # may cause unnecessary relink failures (see bug #351266)
684 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
685 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
686 keepdir "/usr/$(get_libdir)/apache2/modules"
687 else
688 # needed each time, php_install_ini would reset it
689 local dest="${PHP_DESTDIR#${EPREFIX}}"
690 into "${dest}"
691 case "$sapi" in
692 cli)
693 source="sapi/cli/php"
694 ;;
695 cgi)
696 source="sapi/cgi/php-cgi"
697 ;;
698 fpm)
699 source="sapi/fpm/php-fpm"
700 ;;
701 embed)
702 source="libs/libphp${PHP_MV}$(get_libname)"
703 ;;
704 *)
705 die "unhandled sapi in src_install"
706 ;;
707 esac
708
709 if [[ "${source}" == *"$(get_libname)" ]]; then
710 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
711 else
712 dobin "${source}" || die "Unable to install ${sapi} sapi"
713 local name="$(basename ${source})"
714 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
715 fi
716 fi
717
718 php_install_ini "${sapi}"
719
720 # construct correct SAPI string for php-config
721 # thanks to ferringb for the bash voodoo
722 if [[ "${sapi}" == "apache2" ]]; then
723 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
724 else
725 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
726 fi
727 fi
728 done
729
730 # Installing opcache module
731 if use_if_iuse opcache ; then
732 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
733 fi
734
735 # Install env.d files
736 newenvd "${FILESDIR}/20php5-envd" \
737 "20php${SLOT}"
738 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
739 "${ED}/etc/env.d/20php${SLOT}"
740 sed -e "s|php5|php${SLOT}|g" -i \
741 "${ED}/etc/env.d/20php${SLOT}"
742
743 # set php-config variable correctly (bug #278439)
744 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
745 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
746
747 if use fpm ; then
748 if use systemd; then
749 systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
750 else
751 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
752 fi
753 fi
754 }
755
756 src_test() {
757 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
758 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
759 if [[ ! -x "${PHP_BIN}" ]] ; then
760 ewarn "Test phase requires USE=cli, skipping"
761 return
762 else
763 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
764 fi
765
766 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
767 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
768 fi
769
770 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
771 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
772
773 for name in ${EXPECTED_TEST_FAILURES}; do
774 mv "${name}.out" "${name}.out.orig" 2>/dev/null
775 done
776
777 local failed="$(find -name '*.out')"
778 if [[ ${failed} != "" ]] ; then
779 ewarn "The following test cases failed unexpectedly:"
780 for name in ${failed}; do
781 ewarn " ${name/.out/}"
782 done
783 else
784 einfo "No unexpected test failures, all fine"
785 fi
786
787 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
788 local passed=""
789 for name in ${EXPECTED_TEST_FAILURES}; do
790 [[ -f "${name}.diff" ]] && continue
791 passed="${passed} ${name}"
792 done
793 if [[ ${passed} != "" ]] ; then
794 einfo "The following test cases passed unexpectedly:"
795 for name in ${passed}; do
796 ewarn " ${passed}"
797 done
798 else
799 einfo "None of the known-to-fail tests passed, all fine"
800 fi
801 fi
802 }
803
804 pkg_postinst() {
805 # Output some general info to the user
806 if use apache2 ; then
807 APACHE2_MOD_DEFINE="PHP5"
808 APACHE2_MOD_CONF="70_mod_php5"
809 apache-module_pkg_postinst
810 fi
811
812 # Create the symlinks for php
813 for m in ${SAPIS}; do
814 [[ ${m} == 'embed' ]] && continue;
815 if use $m ; then
816 local ci=$(eselect php show $m)
817 if [[ -z $ci ]]; then
818 eselect php set $m php${SLOT}
819 einfo "Switched ${m} to use php:${SLOT}"
820 einfo
821 elif [[ $ci != "php${SLOT}" ]] ; then
822 elog "To switch $m to use php:${SLOT}, run"
823 elog " eselect php set $m php${SLOT}"
824 elog
825 fi
826 fi
827 done
828
829 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
830 elog "to compile extensions for the ${SLOT} ABI"
831 elog
832 if ! use readline && use cli ; then
833 ewarn "Note that in order to use php interactivly, you need to enable"
834 ewarn "the readline USE flag or php -a will hang"
835 fi
836 elog
837 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
838 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
839 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
840 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
841
842 elog
843 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
844 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
845 elog
846 }
847
848 pkg_prerm() {
849 eselect php cleanup
850 }
851
852
853
854 1.1 dev-lang/php/php-5.5.13.ebuild
855
856 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.13.ebuild?rev=1.1&view=markup
857 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.13.ebuild?rev=1.1&content-type=text/plain
858
859 Index: php-5.5.13.ebuild
860 ===================================================================
861 # Copyright 1999-2014 Gentoo Foundation
862 # Distributed under the terms of the GNU General Public License v2
863 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.5.13.ebuild,v 1.1 2014/05/30 20:11:48 olemarkus Exp $
864
865 EAPI=5
866
867 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
868
869 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"
870
871 function php_get_uri ()
872 {
873 case "${1}" in
874 "php-pre")
875 echo "http://downloads.php.net/dsp/${2}"
876 ;;
877 "php")
878 echo "http://www.php.net/distributions/${2}"
879 ;;
880 "olemarkus")
881 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
882 ;;
883 "gentoo")
884 echo "mirror://gentoo/${2}"
885 ;;
886 *)
887 die "unhandled case in php_get_uri"
888 ;;
889 esac
890 }
891
892 PHP_MV="$(get_major_version)"
893 SLOT="$(get_version_component_range 1-2)"
894
895 # alias, so we can handle different types of releases (finals, rcs, alphas,
896 # betas, ...) w/o changing the whole ebuild
897 PHP_PV="${PV/_rc/RC}"
898 PHP_PV="${PHP_PV/_alpha/alpha}"
899 PHP_PV="${PHP_PV/_beta/beta}"
900 PHP_RELEASE="php"
901 [[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
902 [[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
903 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
904 PHP_P="${PN}-${PHP_PV}"
905
906 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
907
908 PHP_FPM_CONF_VER="1"
909
910 SRC_URI="${PHP_SRC_URI}"
911
912 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
913 HOMEPAGE="http://php.net/"
914 LICENSE="PHP-3"
915
916 S="${WORKDIR}/${PHP_P}"
917
918 # We can build the following SAPIs in the given order
919 SAPIS="embed cli cgi fpm apache2"
920
921 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
922 IUSE="${IUSE}
923 ${SAPIS/cli/+cli}
924 threads"
925
926 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
927 crypt +ctype curl debug
928 enchant exif frontbase +fileinfo +filter firebird
929 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
930 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
931 mssql mysql libmysqlclient mysqli nls
932 oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
933 readline recode selinux +session sharedmem
934 +simplexml snmp soap sockets spell sqlite ssl
935 sybase-ct sysvipc systemd tidy +tokenizer truetype unicode wddx
936 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
937
938 DEPEND="
939 >=app-admin/eselect-php-0.7.1-r3[apache2?,fpm?]
940 >=dev-libs/libpcre-8.32[unicode]
941 apache2? ( www-servers/apache[threads=] )
942 berkdb? ( =sys-libs/db-4* )
943 bzip2? ( app-arch/bzip2 )
944 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
945 cjk? ( !gd? (
946 virtual/jpeg:0
947 media-libs/libpng:0=
948 sys-libs/zlib
949 ) )
950 crypt? ( >=dev-libs/libmcrypt-2.4 )
951 curl? ( >=net-misc/curl-7.10.5 )
952 enchant? ( app-text/enchant )
953 exif? ( !gd? (
954 virtual/jpeg:0
955 media-libs/libpng:0=
956 sys-libs/zlib
957 ) )
958 firebird? ( dev-db/firebird )
959 gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
960 gdbm? ( >=sys-libs/gdbm-1.8.0 )
961 gmp? ( >=dev-libs/gmp-4.1.2 )
962 iconv? ( virtual/libiconv )
963 imap? ( virtual/imap-c-client[ssl=] )
964 intl? ( dev-libs/icu:= )
965 iodbc? ( dev-db/libiodbc )
966 kerberos? ( virtual/krb5 )
967 ldap? ( >=net-nds/openldap-1.2.11 )
968 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
969 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
970 mssql? ( dev-db/freetds[mssql] )
971 libmysqlclient? (
972 mysql? ( virtual/mysql )
973 mysqli? ( >=virtual/mysql-4.1 )
974 )
975 nls? ( sys-devel/gettext )
976 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
977 odbc? ( >=dev-db/unixODBC-1.8.13 )
978 postgres? ( dev-db/postgresql-base )
979 qdbm? ( dev-db/qdbm )
980 readline? ( sys-libs/readline )
981 recode? ( app-text/recode )
982 sharedmem? ( dev-libs/mm )
983 simplexml? ( >=dev-libs/libxml2-2.6.8 )
984 snmp? ( >=net-analyzer/net-snmp-5.2 )
985 soap? ( >=dev-libs/libxml2-2.6.8 )
986 spell? ( >=app-text/aspell-0.50 )
987 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
988 ssl? ( >=dev-libs/openssl-0.9.7 )
989 sybase-ct? ( dev-db/freetds )
990 tidy? ( app-text/htmltidy )
991 truetype? (
992 =media-libs/freetype-2*
993 >=media-libs/t1lib-5.0.0
994 !gd? (
995 virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
996 )
997 unicode? ( dev-libs/oniguruma )
998 wddx? ( >=dev-libs/libxml2-2.6.8 )
999 xml? ( >=dev-libs/libxml2-2.6.8 )
1000 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
1001 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
1002 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
1003 xpm? (
1004 x11-libs/libXpm
1005 virtual/jpeg:0
1006 media-libs/libpng:0= sys-libs/zlib
1007 )
1008 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
1009 zip? ( sys-libs/zlib )
1010 zlib? ( sys-libs/zlib )
1011 virtual/mta
1012 "
1013
1014 php="=${CATEGORY}/${PF}"
1015
1016 REQUIRED_USE="
1017 truetype? ( gd )
1018 cjk? ( gd )
1019 exif? ( gd )
1020
1021 xpm? ( gd )
1022 gd? ( zlib )
1023 simplexml? ( xml )
1024 soap? ( xml )
1025 wddx? ( xml )
1026 xmlrpc? ( || ( xml iconv ) )
1027 xmlreader? ( xml )
1028 xslt? ( xml )
1029 ldap-sasl? ( ldap )
1030 mhash? ( hash )
1031 phar? ( hash )
1032 libmysqlclient? ( || (
1033 mysql
1034 mysqli
1035 pdo
1036 ) )
1037
1038 qdbm? ( !gdbm )
1039 readline? ( !libedit )
1040 recode? ( !imap !mysql !mysqli )
1041 sharedmem? ( !threads )
1042
1043 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
1044
1045 RDEPEND="${DEPEND}"
1046
1047 RDEPEND="${RDEPEND}
1048 fpm? (
1049 selinux? ( sec-policy/selinux-phpfpm )
1050 systemd? ( sys-apps/systemd ) )"
1051
1052 DEPEND="${DEPEND}
1053 sys-devel/flex
1054 >=sys-devel/m4-1.4.3
1055 >=sys-devel/libtool-1.5.18"
1056
1057 # Allow users to install production version if they want to
1058
1059 case "${PHP_INI_VERSION}" in
1060 production|development)
1061 ;;
1062 *)
1063 PHP_INI_VERSION="development"
1064 ;;
1065 esac
1066
1067 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
1068 PHP_INI_FILE="php.ini"
1069
1070 want_apache
1071
1072 pkg_setup() {
1073 depend.apache_pkg_setup
1074 }
1075
1076 php_install_ini() {
1077 local phpsapi="${1}"
1078
1079 # work out where we are installing the ini file
1080 php_set_ini_dir "${phpsapi}"
1081
1082 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
1083 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
1084
1085 # default to /tmp for save_path, bug #282768
1086 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
1087
1088 # Set the extension dir
1089 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
1090
1091 # Set the include path to point to where we want to find PEAR packages
1092 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
1093
1094 dodir "${PHP_INI_DIR#${EPREFIX}}"
1095 insinto "${PHP_INI_DIR#${EPREFIX}}"
1096 newins "${phpinisrc}" "${PHP_INI_FILE}"
1097
1098 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
1099 elog
1100
1101 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
1102 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
1103
1104 if use_if_iuse opcache; then
1105 elog "Adding opcache to $PHP_EXT_INI_DIR"
1106 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
1107 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
1108 fi
1109
1110 # SAPI-specific handling
1111
1112 if [[ "${sapi}" == "fpm" ]] ; then
1113 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
1114 einfo "Installing FPM CGI config file php-fpm.conf"
1115 insinto "${PHP_INI_DIR#${EPREFIX}}"
1116 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
1117
1118 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
1119 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
1120 fi
1121
1122 # Install PHP ini files into /usr/share/php
1123
1124 dodoc php.ini-development
1125 dodoc php.ini-production
1126
1127 }
1128
1129 php_set_ini_dir() {
1130 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
1131 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
1132 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
1133 }
1134
1135 src_prepare() {
1136 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
1137 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
1138 # there is no easy way to circumvent that, all php calls during
1139 # install use -n, so no php.ini file will be used.
1140 # As such, this is the easiest way to get around
1141 addpredict /session_mm_cli250.sem
1142 addpredict /session_mm_cli0.sem
1143
1144 # Change PHP branding
1145 # Get the alpha/beta/rc version
1146 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
1147 -i configure.in || die "Unable to change PHP branding"
1148
1149 # Patch PHP to show Gentoo as the server platform
1150 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
1151 -i configure.in || die "Failed to fix server platform name"
1152
1153 # Prevent PHP from activating the Apache config,
1154 # as we will do that ourselves
1155 sed -i \
1156 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
1157 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
1158 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
1159
1160 # Patch PHP to support heimdal instead of mit-krb5
1161 if has_version "app-crypt/heimdal" ; then
1162 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
1163 || die "Failed to fix heimdal libname"
1164 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
1165 || die "Failed to fix heimdal crypt library reference"
1166 fi
1167
1168 #Add user patches #357637
1169 epatch_user
1170
1171 #force rebuilding aclocal.m4
1172 rm aclocal.m4
1173 eautoreconf
1174
1175 if [[ ${CHOST} == *-darwin* ]] ; then
1176 # http://bugs.php.net/bug.php?id=48795, bug #343481
1177 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
1178 fi
1179 }
1180
1181 src_configure() {
1182 addpredict /usr/share/snmp/mibs/.index
1183 addpredict /var/lib/net-snmp/mib_indexes
1184
1185 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
1186
1187 # This is a global variable and should be in caps. It isn't because the
1188 # phpconfutils eclass relies on exactly this name...
1189 # for --with-libdir see bug #327025
1190 my_conf="
1191 --prefix="${PHP_DESTDIR}"
1192 --mandir="${PHP_DESTDIR}"/man
1193 --infodir="${PHP_DESTDIR}"/info
1194 --libdir="${PHP_DESTDIR}"/lib
1195 --with-libdir=$(get_libdir)
1196 --without-pear
1197 $(use_enable threads maintainer-zts)"
1198
1199 # extension USE flag shared
1200 my_conf+="
1201 $(use_enable bcmath bcmath )
1202 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
1203 $(use_enable calendar calendar )
1204 $(use_enable ctype ctype )
1205 $(use_with curl curl "${EPREFIX}"/usr)
1206 $(use_enable xml dom )
1207 $(use_with enchant enchant "${EPREFIX}"/usr)
1208 $(use_enable exif exif )
1209 $(use_enable fileinfo fileinfo )
1210 $(use_enable filter filter )
1211 $(use_enable ftp ftp )
1212 $(use_with nls gettext "${EPREFIX}"/usr)
1213 $(use_with gmp gmp "${EPREFIX}"/usr)
1214 $(use_enable hash hash )
1215 $(use_with mhash mhash "${EPREFIX}"/usr)
1216 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
1217 $(use_enable intl intl )
1218 $(use_enable ipv6 ipv6 )
1219 $(use_enable json json )
1220 $(use_with kerberos kerberos "${EPREFIX}"/usr)
1221 $(use_enable xml libxml )
1222 $(use_with xml libxml-dir "${EPREFIX}"/usr)
1223 $(use_enable unicode mbstring )
1224 $(use_with crypt mcrypt "${EPREFIX}"/usr)
1225 $(use_with mssql mssql "${EPREFIX}"/usr)
1226 $(use_with unicode onig "${EPREFIX}"/usr)
1227 $(use_with ssl openssl "${EPREFIX}"/usr)
1228 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
1229 $(use_enable pcntl pcntl )
1230 $(use_enable phar phar )
1231 $(use_enable pdo pdo )
1232 $(use_enable opcache opcache )
1233 $(use_with postgres pgsql "${EPREFIX}"/usr)
1234 $(use_enable posix posix )
1235 $(use_with spell pspell "${EPREFIX}"/usr)
1236 $(use_with recode recode "${EPREFIX}"/usr)
1237 $(use_enable simplexml simplexml )
1238 $(use_enable sharedmem shmop )
1239 $(use_with snmp snmp "${EPREFIX}"/usr)
1240 $(use_enable soap soap )
1241 $(use_enable sockets sockets )
1242 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
1243 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
1244 $(use_enable sysvipc sysvmsg )
1245 $(use_enable sysvipc sysvsem )
1246 $(use_enable sysvipc sysvshm )
1247 $(use_with systemd fpm-systemd)
1248 $(use_with tidy tidy "${EPREFIX}"/usr)
1249 $(use_enable tokenizer tokenizer )
1250 $(use_enable wddx wddx )
1251 $(use_enable xml xml )
1252 $(use_enable xmlreader xmlreader )
1253 $(use_enable xmlwriter xmlwriter )
1254 $(use_with xmlrpc xmlrpc)
1255 $(use_with xslt xsl "${EPREFIX}"/usr)
1256 $(use_enable zip zip )
1257 $(use_with zlib zlib "${EPREFIX}"/usr)
1258 $(use_enable debug debug )"
1259
1260 # DBA support
1261 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
1262 || use qdbm ; then
1263 my_conf="${my_conf} --enable-dba${shared}"
1264 fi
1265
1266 # DBA drivers support
1267 my_conf+="
1268 $(use_with cdb cdb)
1269 $(use_with berkdb db4 ${EPREFIX}/usr)
1270 $(use_enable flatfile flatfile )
1271 $(use_with gdbm gdbm ${EPREFIX}/usr)
1272 $(use_enable inifile inifile )
1273 $(use_with qdbm qdbm ${EPREFIX}/usr)"
1274
1275 # Support for the GD graphics library
1276 my_conf+="
1277 $(use_with truetype freetype-dir ${EPREFIX}/usr)
1278 $(use_with truetype t1lib ${EPREFIX}/usr)
1279 $(use_enable cjk gd-jis-conv )
1280 $(use_with gd jpeg-dir ${EPREFIX}/usr)
1281 $(use_with gd png-dir ${EPREFIX}/usr)
1282 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
1283 # enable gd last, so configure can pick up the previous settings
1284 my_conf+="
1285 $(use_with gd gd)"
1286
1287 # IMAP support
1288 if use imap ; then
1289 my_conf+="
1290 $(use_with imap imap ${EPREFIX}/usr)
1291 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
1292 fi
1293
1294 # Interbase/firebird support
1295
1296 if use firebird ; then
1297 my_conf+="
1298 $(use_with firebird interbase ${EPREFIX}/usr)"
1299 fi
1300
1301 # LDAP support
1302 if use ldap ; then
1303 my_conf+="
1304 $(use_with ldap ldap ${EPREFIX}/usr)
1305 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
1306 fi
1307
1308 # MySQL support
1309 local mysqllib="mysqlnd"
1310 local mysqlilib="mysqlnd"
1311 use libmysqlclient && mysqllib="${EPREFIX}/usr"
1312 use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
1313
1314 my_conf+=" $(use_with mysql mysql $mysqllib)"
1315 my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
1316
1317 local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
1318 if use mysql ; then
1319 my_conf+="${mysqlsock}"
1320 elif use mysqli ; then
1321 my_conf+="${mysqlsock}"
1322 fi
1323
1324 # ODBC support
1325 if use odbc ; then
1326 my_conf+="
1327 $(use_with odbc unixODBC ${EPREFIX}/usr)"
1328 fi
1329
1330 if use iodbc ; then
1331 my_conf+="
1332 $(use_with iodbc iodbc ${EPREFIX}/usr)"
1333 fi
1334
1335 # Oracle support
1336 if use oci8-instant-client ; then
1337 my_conf+="
1338 $(use_with oci8-instant-client oci8)"
1339 fi
1340
1341 # PDO support
1342 if use pdo ; then
1343 my_conf+="
1344 $(use_with mssql pdo-dblib )
1345 $(use_with mysql pdo-mysql ${mysqllib})
1346 $(use_with postgres pdo-pgsql )
1347 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
1348 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
1349 if use oci8-instant-client ; then
1350 my_conf+="
1351 $(use_with oci8-instant-client pdo-oci)"
1352 fi
1353 fi
1354
1355 # readline/libedit support
1356 my_conf+="
1357 $(use_with readline readline ${EPREFIX}/usr)
1358 $(use_with libedit libedit ${EPREFIX}/usr)"
1359
1360 # Session support
1361 if use session ; then
1362 my_conf+="
1363 $(use_with sharedmem mm ${EPREFIX}/usr)"
1364 else
1365 my_conf+="
1366 $(use_enable session session )"
1367 fi
1368
1369 # Use pic for shared modules such as apache2's mod_php
1370 my_conf="${my_conf} --with-pic"
1371
1372 # we use the system copy of pcre
1373 # --with-pcre-regex affects ext/pcre
1374 # --with-pcre-dir affects ext/filter and ext/zip
1375 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
1376
1377 # Catch CFLAGS problems
1378 # Fixes bug #14067.
1379 # Changed order to run it in reverse for bug #32022 and #12021.
1380 replace-cpu-flags "k6*" "i586"
1381
1382 # Support user-passed configuration parameters
1383 my_conf="${my_conf} ${EXTRA_ECONF:-}"
1384
1385 # Support the Apache2 extras, they must be set globally for all
1386 # SAPIs to work correctly, especially for external PHP extensions
1387
1388 mkdir -p "${WORKDIR}/sapis-build"
1389 for one_sapi in $SAPIS ; do
1390 use "${one_sapi}" || continue
1391 php_set_ini_dir "${one_sapi}"
1392
1393 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
1394 cd "${WORKDIR}/sapis-build/${one_sapi}"
1395
1396 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
1397 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
1398
1399 for sapi in $SAPIS ; do
1400 case "$sapi" in
1401 cli|cgi|embed|fpm)
1402 if [[ "${one_sapi}" == "${sapi}" ]] ; then
1403 sapi_conf="${sapi_conf} --enable-${sapi}"
1404 else
1405 sapi_conf="${sapi_conf} --disable-${sapi}"
1406 fi
1407 ;;
1408
1409 apache2)
1410 if [[ "${one_sapi}" == "${sapi}" ]] ; then
1411 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
1412 else
1413 sapi_conf="${sapi_conf} --without-apxs2"
1414 fi
1415 ;;
1416 esac
1417 done
1418
1419 econf ${sapi_conf}
1420 done
1421 }
1422
1423 src_compile() {
1424 # snmp seems to run during src_compile, too (bug #324739)
1425 addpredict /usr/share/snmp/mibs/.index
1426 addpredict /var/lib/net-snmp/mib_indexes
1427
1428 for sapi in ${SAPIS} ; do
1429 if use "${sapi}"; then
1430 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
1431 emake || die "emake failed"
1432 fi
1433 done
1434 }
1435
1436 src_install() {
1437 # see bug #324739 for what happens when we don't have that
1438 addpredict /usr/share/snmp/mibs/.index
1439
1440 # grab the first SAPI that got built and install common files from there
1441 local first_sapi=""
1442 for sapi in $SAPIS ; do
1443 if use $sapi ; then
1444 first_sapi=$sapi
1445 break
1446 fi
1447 done
1448
1449 # Makefile forgets to create this before trying to write to it...
1450 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
1451
1452 # Install php environment (without any sapis)
1453 cd "${WORKDIR}/sapis-build/$first_sapi"
1454 emake INSTALL_ROOT="${D}" \
1455 install-build install-headers install-programs \
1456 || die "emake install failed"
1457
1458 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
1459
1460 # Create the directory where we'll put version-specific php scripts
1461 keepdir /usr/share/php${PHP_MV}
1462
1463 local sapi="", file=""
1464 local sapi_list=""
1465
1466 for sapi in ${SAPIS}; do
1467 if use "${sapi}" ; then
1468 einfo "Installing SAPI: ${sapi}"
1469 cd "${WORKDIR}/sapis-build/${sapi}"
1470
1471 if [[ "${sapi}" == "apache2" ]] ; then
1472 # We're specifically not using emake install-sapi as libtool
1473 # may cause unnecessary relink failures (see bug #351266)
1474 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
1475 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
1476 keepdir "/usr/$(get_libdir)/apache2/modules"
1477 else
1478 # needed each time, php_install_ini would reset it
1479 local dest="${PHP_DESTDIR#${EPREFIX}}"
1480 into "${dest}"
1481 case "$sapi" in
1482 cli)
1483 source="sapi/cli/php"
1484 ;;
1485 cgi)
1486 source="sapi/cgi/php-cgi"
1487 ;;
1488 fpm)
1489 source="sapi/fpm/php-fpm"
1490 ;;
1491 embed)
1492 source="libs/libphp${PHP_MV}$(get_libname)"
1493 ;;
1494 *)
1495 die "unhandled sapi in src_install"
1496 ;;
1497 esac
1498
1499 if [[ "${source}" == *"$(get_libname)" ]]; then
1500 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
1501 else
1502 dobin "${source}" || die "Unable to install ${sapi} sapi"
1503 local name="$(basename ${source})"
1504 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
1505 fi
1506 fi
1507
1508 php_install_ini "${sapi}"
1509
1510 # construct correct SAPI string for php-config
1511 # thanks to ferringb for the bash voodoo
1512 if [[ "${sapi}" == "apache2" ]]; then
1513 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
1514 else
1515 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
1516 fi
1517 fi
1518 done
1519
1520 # Installing opcache module
1521 if use_if_iuse opcache ; then
1522 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
1523 fi
1524
1525 # Install env.d files
1526 newenvd "${FILESDIR}/20php5-envd" \
1527 "20php${SLOT}"
1528 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
1529 "${ED}/etc/env.d/20php${SLOT}"
1530 sed -e "s|php5|php${SLOT}|g" -i \
1531 "${ED}/etc/env.d/20php${SLOT}"
1532
1533 # set php-config variable correctly (bug #278439)
1534 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
1535 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
1536
1537 if use fpm ; then
1538 if use systemd; then
1539 systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
1540 else
1541 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
1542 fi
1543 fi
1544 }
1545
1546 src_test() {
1547 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1548 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
1549 if [[ ! -x "${PHP_BIN}" ]] ; then
1550 ewarn "Test phase requires USE=cli, skipping"
1551 return
1552 else
1553 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
1554 fi
1555
1556 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
1557 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
1558 fi
1559
1560 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
1561 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
1562
1563 for name in ${EXPECTED_TEST_FAILURES}; do
1564 mv "${name}.out" "${name}.out.orig" 2>/dev/null
1565 done
1566
1567 local failed="$(find -name '*.out')"
1568 if [[ ${failed} != "" ]] ; then
1569 ewarn "The following test cases failed unexpectedly:"
1570 for name in ${failed}; do
1571 ewarn " ${name/.out/}"
1572 done
1573 else
1574 einfo "No unexpected test failures, all fine"
1575 fi
1576
1577 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
1578 local passed=""
1579 for name in ${EXPECTED_TEST_FAILURES}; do
1580 [[ -f "${name}.diff" ]] && continue
1581 passed="${passed} ${name}"
1582 done
1583 if [[ ${passed} != "" ]] ; then
1584 einfo "The following test cases passed unexpectedly:"
1585 for name in ${passed}; do
1586 ewarn " ${passed}"
1587 done
1588 else
1589 einfo "None of the known-to-fail tests passed, all fine"
1590 fi
1591 fi
1592 }
1593
1594 pkg_postinst() {
1595 # Output some general info to the user
1596 if use apache2 ; then
1597 APACHE2_MOD_DEFINE="PHP5"
1598 APACHE2_MOD_CONF="70_mod_php5"
1599 apache-module_pkg_postinst
1600 fi
1601
1602 # Create the symlinks for php
1603 for m in ${SAPIS}; do
1604 [[ ${m} == 'embed' ]] && continue;
1605 if use $m ; then
1606 local ci=$(eselect php show $m)
1607 if [[ -z $ci ]]; then
1608 eselect php set $m php${SLOT}
1609 einfo "Switched ${m} to use php:${SLOT}"
1610 einfo
1611 elif [[ $ci != "php${SLOT}" ]] ; then
1612 elog "To switch $m to use php:${SLOT}, run"
1613 elog " eselect php set $m php${SLOT}"
1614 elog
1615 fi
1616 fi
1617 done
1618
1619 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
1620 elog "to compile extensions for the ${SLOT} ABI"
1621 elog
1622 if ! use readline && use cli ; then
1623 ewarn "Note that in order to use php interactivly, you need to enable"
1624 ewarn "the readline USE flag or php -a will hang"
1625 fi
1626 elog
1627 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
1628 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
1629 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
1630 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
1631
1632 elog
1633 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
1634 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
1635 elog
1636 }
1637
1638 pkg_prerm() {
1639 eselect php cleanup
1640 }