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