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.10.ebuild php-5.3.20.ebuild php-5.5.0_alpha2.ebuild ChangeLog
Date: Tue, 01 Jan 2013 13:44:27
Message-Id: 20130101134417.5C93A2171D@flycatcher.gentoo.org
1 olemarkus 13/01/01 13:44:17
2
3 Modified: ChangeLog
4 Added: php-5.4.10.ebuild php-5.3.20.ebuild
5 php-5.5.0_alpha2.ebuild
6 Log:
7 Version bumps
8
9 (Portage version: 2.1.11.9/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.667 dev-lang/php/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.667&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?rev=1.667&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/ChangeLog?r1=1.666&r2=1.667
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v
21 retrieving revision 1.666
22 retrieving revision 1.667
23 diff -u -r1.666 -r1.667
24 --- ChangeLog 1 Jan 2013 13:33:17 -0000 1.666
25 +++ ChangeLog 1 Jan 2013 13:44:17 -0000 1.667
26 @@ -1,9 +1,16 @@
27 # ChangeLog for dev-lang/php
28 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.666 2013/01/01 13:33:17 dilfridge Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.667 2013/01/01 13:44:17 olemarkus Exp $
31 +
32 +*php-5.5.0_alpha2 (01 Jan 2013)
33 +*php-5.4.10 (01 Jan 2013)
34 +*php-5.3.20 (01 Jan 2013)
35 +
36 + 01 Jan 2013; Ole Markus With <olemarkus@g.o> +php-5.3.20.ebuild,
37 + +php-5.4.10.ebuild, +php-5.5.0_alpha2.ebuild:
38 + Version bumps
39
40 01 Jan 2013; Andreas K. Huettel <dilfridge@g.o> +ChangeLog-2012:
41 Split ChangeLog.
42
43 For previous entries, please see ChangeLog-2012.
44 -
45
46
47
48 1.1 dev-lang/php/php-5.4.10.ebuild
49
50 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.4.10.ebuild?rev=1.1&view=markup
51 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.4.10.ebuild?rev=1.1&content-type=text/plain
52
53 Index: php-5.4.10.ebuild
54 ===================================================================
55 # Copyright 1999-2013 Gentoo Foundation
56 # Distributed under the terms of the GNU General Public License v2
57 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.4.10.ebuild,v 1.1 2013/01/01 13:44:17 olemarkus Exp $
58
59 EAPI=4
60
61 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool
62
63 SUHOSIN_VERSION=""
64 FPM_VERSION="builtin"
65 EXPECTED_TEST_FAILURES=""
66
67 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"
68
69 function php_get_uri ()
70 {
71 case "${1}" in
72 "php-pre")
73 echo "http://downloads.php.net/stas/${2}"
74 ;;
75 "php")
76 echo "http://www.php.net/distributions/${2}"
77 ;;
78 "suhosin")
79 echo "http://download.suhosin.org/${2}"
80 ;;
81 "olemarkus")
82 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
83 ;;
84 "gentoo")
85 echo "mirror://gentoo/${2}"
86 ;;
87 *)
88 die "unhandled case in php_get_uri"
89 ;;
90 esac
91 }
92
93 PHP_MV="$(get_major_version)"
94 SLOT="$(get_version_component_range 1-2)"
95
96 # alias, so we can handle different types of releases (finals, rcs, alphas,
97 # betas, ...) w/o changing the whole ebuild
98 PHP_PV="${PV/_rc/RC}"
99 PHP_PV="${PHP_PV/_alpha/alpha}"
100 PHP_PV="${PHP_PV/_beta/beta}"
101 PHP_RELEASE="php"
102 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
103 PHP_P="${PN}-${PHP_PV}"
104
105 PHP_PATCHSET_LOC="olemarkus"
106
107 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
108
109 PHP_PATCHSET="2"
110 PHP_PATCHSET_URI="
111 $(php_get_uri "${PHP_PATCHSET_LOC}" "php-patchset-${SLOT}-r${PHP_PATCHSET}.tar.bz2")"
112
113 PHP_FPM_INIT_VER="4"
114 PHP_FPM_CONF_VER="1"
115
116 if [[ ${SUHOSIN_VERSION} == *-gentoo ]]; then
117 # in some cases we use our own suhosin patch (very recent version,
118 # patch conflicts, etc.)
119 SUHOSIN_TYPE="olemarkus"
120 else
121 SUHOSIN_TYPE="suhosin"
122 fi
123
124 if [[ -n ${SUHOSIN_VERSION} ]]; then
125 SUHOSIN_PATCH="suhosin-patch-${SUHOSIN_VERSION}.patch";
126 SUHOSIN_URI="$(php_get_uri ${SUHOSIN_TYPE} ${SUHOSIN_PATCH}.gz )"
127 fi
128
129 SRC_URI="
130 ${PHP_SRC_URI}
131 ${PHP_PATCHSET_URI}"
132
133 if [[ -n ${SUHOSIN_VERSION} ]]; then
134 SRC_URI="${SRC_URI}
135 suhosin? ( ${SUHOSIN_URI} )"
136 fi
137
138 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
139 HOMEPAGE="http://php.net/"
140 LICENSE="PHP-3"
141
142 S="${WORKDIR}/${PHP_P}"
143
144 # We can build the following SAPIs in the given order
145 SAPIS="embed cli cgi fpm apache2"
146
147 # Gentoo-specific, common features
148 IUSE="kolab"
149
150 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
151 IUSE="${IUSE}
152 ${SAPIS/cli/+cli}
153 threads"
154
155 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
156 crypt +ctype curl curlwrappers debug doc
157 enchant exif frontbase +fileinfo +filter firebird
158 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
159 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
160 mssql mysql mysqlnd mysqli nls
161 oci8-instant-client odbc pcntl pdo +phar pic +posix postgres qdbm
162 readline recode selinux +session sharedmem
163 +simplexml snmp soap sockets spell sqlite ssl
164 sybase-ct sysvipc tidy +tokenizer truetype unicode wddx
165 +xml xmlreader xmlwriter xmlrpc xpm xsl zip zlib"
166
167 # Enable suhosin if available
168 [[ -n $SUHOSIN_VERSION ]] && IUSE="${IUSE} suhosin"
169
170 DEPEND="
171 >=app-admin/eselect-php-0.6.2
172 >=dev-libs/libpcre-8.12[unicode]
173 apache2? ( www-servers/apache[threads=] )
174 berkdb? ( =sys-libs/db-4* )
175 bzip2? ( app-arch/bzip2 )
176 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
177 cjk? ( !gd? (
178 virtual/jpeg
179 media-libs/libpng
180 sys-libs/zlib
181 ) )
182 crypt? ( >=dev-libs/libmcrypt-2.4 )
183 curl? ( >=net-misc/curl-7.10.5 )
184 enchant? ( app-text/enchant )
185 exif? ( !gd? (
186 virtual/jpeg
187 media-libs/libpng
188 sys-libs/zlib
189 ) )
190 firebird? ( dev-db/firebird )
191 gd? ( virtual/jpeg media-libs/libpng sys-libs/zlib )
192 gdbm? ( >=sys-libs/gdbm-1.8.0 )
193 gmp? ( >=dev-libs/gmp-4.1.2 )
194 iconv? ( virtual/libiconv )
195 imap? ( virtual/imap-c-client[ssl=] )
196 intl? ( dev-libs/icu )
197 iodbc? ( dev-db/libiodbc )
198 kerberos? ( virtual/krb5 )
199 kolab? ( >=net-libs/c-client-2004g-r1 )
200 ldap? ( >=net-nds/openldap-1.2.11 )
201 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
202 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
203 mssql? ( dev-db/freetds[mssql] )
204 !mysqlnd? (
205 mysql? ( virtual/mysql )
206 mysqli? ( >=virtual/mysql-4.1 )
207 )
208 nls? ( sys-devel/gettext )
209 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
210 odbc? ( >=dev-db/unixODBC-1.8.13 )
211 postgres? ( dev-db/postgresql-base )
212 qdbm? ( dev-db/qdbm )
213 readline? ( sys-libs/readline )
214 recode? ( app-text/recode )
215 sharedmem? ( dev-libs/mm )
216 simplexml? ( >=dev-libs/libxml2-2.6.8 )
217 snmp? ( >=net-analyzer/net-snmp-5.2 )
218 soap? ( >=dev-libs/libxml2-2.6.8 )
219 spell? ( >=app-text/aspell-0.50 )
220 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
221 ssl? ( >=dev-libs/openssl-0.9.7 )
222 sybase-ct? ( dev-db/freetds )
223 tidy? ( app-text/htmltidy )
224 truetype? (
225 =media-libs/freetype-2*
226 >=media-libs/t1lib-5.0.0
227 !gd? (
228 virtual/jpeg media-libs/libpng sys-libs/zlib )
229 )
230 unicode? ( dev-libs/oniguruma )
231 wddx? ( >=dev-libs/libxml2-2.6.8 )
232 xml? ( >=dev-libs/libxml2-2.6.8 )
233 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
234 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
235 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
236 xpm? (
237 x11-libs/libXpm
238 virtual/jpeg
239 media-libs/libpng sys-libs/zlib
240 )
241 xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
242 zip? ( sys-libs/zlib )
243 zlib? ( sys-libs/zlib )
244 virtual/mta
245 "
246
247 php="=${CATEGORY}/${PF}"
248
249 REQUIRED_USE="
250 truetype? ( gd )
251 cjk? ( gd )
252 exif? ( gd )
253
254 xpm? ( gd )
255 gd? ( zlib )
256 simplexml? ( xml )
257 soap? ( xml )
258 wddx? ( xml )
259 xmlrpc? ( || ( xml iconv ) )
260 xmlreader? ( xml )
261 xsl? ( xml )
262 ldap-sasl? ( ldap )
263 kolab? ( imap )
264 mhash? ( hash )
265 phar? ( hash )
266 mysqlnd? ( || (
267 mysql
268 mysqli
269 pdo
270 ) )
271
272 qdbm? ( !gdbm )
273 readline? ( !libedit )
274 recode? ( !imap !mysql !mysqli )
275 sharedmem? ( !threads )
276
277 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
278
279 RDEPEND="${DEPEND}"
280
281 [[ -n $SUHOSIN_VERSION ]] && RDEPEND="${RDEPEND} suhosin? (
282 =${CATEGORY}/${PN}-${SLOT}*[unicode] )"
283
284 RDEPEND="${RDEPEND} fpm? ( selinux? ( sec-policy/selinux-phpfpm ) )"
285
286 DEPEND="${DEPEND}
287 sys-devel/flex
288 >=sys-devel/m4-1.4.3
289 >=sys-devel/libtool-1.5.18"
290
291 # They are in PDEPEND because we need PHP installed first!
292 PDEPEND="doc? ( app-doc/php-docs )"
293
294 # No longer depend on the extension. The suhosin USE flag only installs the
295 # patch
296 #[[ -n $SUHOSIN_VERSION ]] && PDEPEND="${PDEPEND} suhosin? ( dev-php${PHP_MV}/suhosin )"
297
298 # Allow users to install production version if they want to
299
300 case "${PHP_INI_VERSION}" in
301 production|development)
302 ;;
303 *)
304 PHP_INI_VERSION="development"
305 ;;
306 esac
307
308 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
309 PHP_INI_FILE="php.ini"
310
311 want_apache
312
313 pkg_setup() {
314 depend.apache_pkg_setup
315 }
316
317 php_install_ini() {
318 local phpsapi="${1}"
319
320 # work out where we are installing the ini file
321 php_set_ini_dir "${phpsapi}"
322
323 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
324 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
325
326 # default to /tmp for save_path, bug #282768
327 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
328
329 # Set the extension dir
330 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
331
332 # Set the include path to point to where we want to find PEAR packages
333 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
334
335 dodir "${PHP_INI_DIR#${EPREFIX}}"
336 insinto "${PHP_INI_DIR#${EPREFIX}}"
337 newins "${phpinisrc}" "${PHP_INI_FILE}"
338
339 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
340 elog
341
342 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
343 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
344
345 # SAPI-specific handling
346 if [[ "${sapi}" == "apache2" ]] ; then
347 insinto "${APACHE_MODULES_CONFDIR#${EPREFIX}}"
348 newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
349 "70_mod_php${PHP_MV}.conf"
350 fi
351
352 if [[ "${sapi}" == "fpm" ]] ; then
353 [[ -z ${PHP_FPM_INIT_VER} ]] && PHP_FPM_INIT_VER=3
354 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
355 einfo "Installing FPM CGI config file php-fpm.conf"
356 insinto "${PHP_INI_DIR#${EPREFIX}}"
357 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
358 dodir "/etc/init.d"
359 insinto "/etc/init.d"
360 newinitd "${FILESDIR}/php-fpm-r${PHP_FPM_INIT_VER}.init" "php-fpm"
361 # dosym "${PHP_DESTDIR#${EPREFIX}}/bin/php-fpm" "/usr/bin/php-fpm"
362
363 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
364 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
365 fi
366
367 # Install PHP ini files into /usr/share/php
368
369 dodoc php.ini-development
370 dodoc php.ini-production
371
372 }
373
374 php_set_ini_dir() {
375 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
376 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
377 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
378 }
379
380 src_prepare() {
381 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
382 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
383 # there is no easy way to circumvent that, all php calls during
384 # install use -n, so no php.ini file will be used.
385 # As such, this is the easiest way to get around
386 addpredict /session_mm_cli250.sem
387 addpredict /session_mm_cli0.sem
388
389 # kolab support (support for imap annotations)
390 use kolab && epatch "${WORKDIR}/patches/opt/imap-kolab-annotations.patch"
391
392 # Change PHP branding
393 # Get the alpha/beta/rc version
394 local ver=$(get_version_component_range 4)
395 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-${ver}-pl${PR/r/}-gentoo\2|g" \
396 -i configure.in || die "Unable to change PHP branding"
397
398 # Apply generic PHP patches
399 EPATCH_SOURCE="${WORKDIR}/patches/generic" EPATCH_SUFFIX="patch" \
400 EPATCH_FORCE="yes" \
401 EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
402
403 # Patch PHP to show Gentoo as the server platform
404 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
405 -i configure.in || die "Failed to fix server platform name"
406
407 # Prevent PHP from activating the Apache config,
408 # as we will do that ourselves
409 sed -i \
410 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
411 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
412 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
413
414 # Patch PHP to support heimdal instead of mit-krb5
415 if has_version "app-crypt/heimdal" ; then
416 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
417 || die "Failed to fix heimdal libname"
418 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
419 || die "Failed to fix heimdal crypt library reference"
420 fi
421
422 # Suhosin support
423 if [[ -n $SUHOSIN_VERSION ]] ; then
424 if use suhosin ; then
425 epatch "${WORKDIR}/${SUHOSIN_PATCH}"
426 fi
427 else
428 ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
429 fi
430
431 #Add user patches #357637
432 epatch_user
433
434 #force rebuilding aclocal.m4
435 rm aclocal.m4
436 eautoreconf
437
438 if [[ ${CHOST} == *-darwin* ]] ; then
439 # http://bugs.php.net/bug.php?id=48795, bug #343481
440 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
441 fi
442 }
443
444 src_configure() {
445 addpredict /usr/share/snmp/mibs/.index
446 addpredict /var/lib/net-snmp/mib_indexes
447
448 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
449
450 # This is a global variable and should be in caps. It isn't because the
451 # phpconfutils eclass relies on exactly this name...
452 # for --with-libdir see bug #327025
453 my_conf="
454 --prefix="${PHP_DESTDIR}"
455 --mandir="${PHP_DESTDIR}"/man
456 --infodir="${PHP_DESTDIR}"/info
457 --libdir="${PHP_DESTDIR}"/lib
458 --with-libdir=$(get_libdir)
459 --without-pear
460 $(use_enable threads maintainer-zts)"
461
462 # extension USE flag shared
463 my_conf+="
464 $(use_enable bcmath bcmath )
465 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
466 $(use_enable calendar calendar )
467 $(use_enable ctype ctype )
468 $(use_with curl curl "${EPREFIX}"/usr)
469 $(use_with curlwrappers curlwrappers "${EPREFIX}"/usr)
470 $(use_enable xml dom )
471 $(use_with enchant enchant "${EPREFIX}"/usr)
472 $(use_enable exif exif )
473 $(use_enable fileinfo fileinfo )
474 $(use_enable filter filter )
475 $(use_enable ftp ftp )
476 $(use_with nls gettext "${EPREFIX}"/usr)
477 $(use_with gmp gmp "${EPREFIX}"/usr)
478 $(use_enable hash hash )
479 $(use_with mhash mhash "${EPREFIX}"/usr)
480 $(use_with iconv iconv )
481 $(use_enable intl intl )
482 $(use_enable ipv6 ipv6 )
483 $(use_enable json json )
484 $(use_with kerberos kerberos "${EPREFIX}"/usr)
485 $(use_enable xml libxml )
486 $(use_with xml libxml-dir "${EPREFIX}"/usr)
487 $(use_enable unicode mbstring )
488 $(use_with crypt mcrypt "${EPREFIX}"/usr)
489 $(use_with mssql mssql "${EPREFIX}"/usr)
490 $(use_with unicode onig "${EPREFIX}"/usr)
491 $(use_with ssl openssl "${EPREFIX}"/usr)
492 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
493 $(use_enable pcntl pcntl )
494 $(use_enable phar phar )
495 $(use_enable pdo pdo )
496 $(use_with postgres pgsql "${EPREFIX}"/usr)
497 $(use_enable posix posix )
498 $(use_with spell pspell "${EPREFIX}"/usr)
499 $(use_with recode recode "${EPREFIX}"/usr)
500 $(use_enable simplexml simplexml )
501 $(use_enable sharedmem shmop )
502 $(use_with snmp snmp "${EPREFIX}"/usr)
503 $(use_enable soap soap )
504 $(use_enable sockets sockets )
505 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
506 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
507 $(use_enable sysvipc sysvmsg )
508 $(use_enable sysvipc sysvsem )
509 $(use_enable sysvipc sysvshm )
510 $(use_with tidy tidy "${EPREFIX}"/usr)
511 $(use_enable tokenizer tokenizer )
512 $(use_enable wddx wddx )
513 $(use_enable xml xml )
514 $(use_enable xmlreader xmlreader )
515 $(use_enable xmlwriter xmlwriter )
516 $(use_with xmlrpc xmlrpc)
517 $(use_with xsl xsl "${EPREFIX}"/usr)
518 $(use_enable zip zip )
519 $(use_with zlib zlib "${EPREFIX}"/usr)
520 $(use_enable debug debug )"
521
522 # DBA support
523 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
524 || use qdbm ; then
525 my_conf="${my_conf} --enable-dba${shared}"
526 fi
527
528 # DBA drivers support
529 my_conf+="
530 $(use_with cdb cdb)
531 $(use_with berkdb db4 ${EPREFIX}/usr)
532 $(use_enable flatfile flatfile )
533 $(use_with gdbm gdbm ${EPREFIX}/usr)
534 $(use_enable inifile inifile )
535 $(use_with qdbm qdbm ${EPREFIX}/usr)"
536
537 # Support for the GD graphics library
538 my_conf+="
539 $(use_with truetype freetype-dir ${EPREFIX}/usr)
540 $(use_with truetype t1lib ${EPREFIX}/usr)
541 $(use_enable cjk gd-jis-conv )
542 $(use_with gd jpeg-dir ${EPREFIX}/usr)
543 $(use_with gd png-dir ${EPREFIX}/usr)
544 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
545 # enable gd last, so configure can pick up the previous settings
546 my_conf+="
547 $(use_with gd gd)"
548
549 # IMAP support
550 if use imap ; then
551 my_conf+="
552 $(use_with imap imap ${EPREFIX}/usr)
553 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
554 fi
555
556 # Interbase/firebird support
557
558 if use firebird ; then
559 my_conf+="
560 $(use_with firebird interbase ${EPREFIX}/usr)"
561 fi
562
563 # LDAP support
564 if use ldap ; then
565 my_conf+="
566 $(use_with ldap ldap ${EPREFIX}/usr)
567 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
568 fi
569
570 # MySQL support
571 if use mysql ; then
572 if use mysqlnd ; then
573 my_conf+="
574 $(use_with mysql mysql mysqlnd)"
575 else
576 my_conf+="
577 $(use_with mysql mysql ${EPREFIX}/usr)"
578 fi
579 my_conf+="
580 $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
581 fi
582
583 # MySQLi support
584 if use mysqlnd ; then
585 my_conf+="
586 $(use_with mysqli mysqli mysqlnd)"
587 else
588 my_conf+="
589 $(use_with mysqli mysqli ${EPREFIX}/usr/bin/mysql_config)"
590 fi
591
592 # ODBC support
593 if use odbc ; then
594 my_conf+="
595 $(use_with odbc unixODBC ${EPREFIX}/usr)"
596 fi
597
598 if use iodbc ; then
599 my_conf+="
600 $(use_with iodbc iodbc ${EPREFIX}/usr)"
601 fi
602
603 # Oracle support
604 if use oci8-instant-client ; then
605 my_conf+="
606 $(use_with oci8-instant-client oci8)"
607 fi
608
609 # PDO support
610 if use pdo ; then
611 my_conf+="
612 $(use_with mssql pdo-dblib )"
613 if use mysqlnd ; then
614 my_conf+="
615 $(use_with mysql pdo-mysql mysqlnd)"
616 else
617 my_conf+="
618 $(use_with mysql pdo-mysql ${EPREFIX}/usr)"
619 fi
620 my_conf+="
621 $(use_with postgres pdo-pgsql )
622 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
623 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
624 if use oci8-instant-client ; then
625 my_conf+="
626 $(use_with oci8-instant-client pdo-oci)"
627 fi
628 fi
629
630 # readline/libedit support
631 my_conf+="
632 $(use_with readline readline ${EPREFIX}/usr)
633 $(use_with libedit libedit ${EPREFIX}/usr)"
634
635 # Session support
636 if use session ; then
637 my_conf+="
638 $(use_with sharedmem mm ${EPREFIX}/usr)"
639 else
640 my_conf+="
641 $(use_enable session session )"
642 fi
643
644 if use pic ; then
645 my_conf="${my_conf} --with-pic"
646 fi
647
648 # we use the system copy of pcre
649 # --with-pcre-regex affects ext/pcre
650 # --with-pcre-dir affects ext/filter and ext/zip
651 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
652
653 # Catch CFLAGS problems
654 # Fixes bug #14067.
655 # Changed order to run it in reverse for bug #32022 and #12021.
656 replace-cpu-flags "k6*" "i586"
657
658 # Support user-passed configuration parameters
659 my_conf="${my_conf} ${EXTRA_ECONF:-}"
660
661 # Support the Apache2 extras, they must be set globally for all
662 # SAPIs to work correctly, especially for external PHP extensions
663
664 mkdir -p "${WORKDIR}/sapis-build"
665 for one_sapi in $SAPIS ; do
666 use "${one_sapi}" || continue
667 php_set_ini_dir "${one_sapi}"
668
669 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
670 cd "${WORKDIR}/sapis-build/${one_sapi}"
671
672 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
673 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
674
675 for sapi in $SAPIS ; do
676 case "$sapi" in
677 cli|cgi|embed|fpm)
678 if [[ "${one_sapi}" == "${sapi}" ]] ; then
679 sapi_conf="${sapi_conf} --enable-${sapi}"
680 else
681 sapi_conf="${sapi_conf} --disable-${sapi}"
682 fi
683 ;;
684
685 apache2)
686 if [[ "${one_sapi}" == "${sapi}" ]] ; then
687 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
688 else
689 sapi_conf="${sapi_conf} --without-apxs2"
690 fi
691 ;;
692 esac
693 done
694
695 econf ${sapi_conf}
696 done
697 }
698
699 src_compile() {
700 # snmp seems to run during src_compile, too (bug #324739)
701 addpredict /usr/share/snmp/mibs/.index
702 addpredict /var/lib/net-snmp/mib_indexes
703
704 for sapi in ${SAPIS} ; do
705 if use "${sapi}"; then
706 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
707 emake || die "emake failed"
708 fi
709 done
710 }
711
712 src_install() {
713 # see bug #324739 for what happens when we don't have that
714 addpredict /usr/share/snmp/mibs/.index
715
716 # grab the first SAPI that got built and install common files from there
717 local first_sapi=""
718 for sapi in $SAPIS ; do
719 if use $sapi ; then
720 first_sapi=$sapi
721 break
722 fi
723 done
724
725 # Makefile forgets to create this before trying to write to it...
726 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
727
728 # Install php environment (without any sapis)
729 cd "${WORKDIR}/sapis-build/$first_sapi"
730 emake INSTALL_ROOT="${D}" \
731 install-build install-headers install-programs \
732 || die "emake install failed"
733
734 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
735
736 # Create the directory where we'll put version-specific php scripts
737 keepdir /usr/share/php${PHP_MV}
738
739 local sapi="", file=""
740 local sapi_list=""
741
742 for sapi in ${SAPIS}; do
743 if use "${sapi}" ; then
744 einfo "Installing SAPI: ${sapi}"
745 cd "${WORKDIR}/sapis-build/${sapi}"
746
747 if [[ "${sapi}" == "apache2" ]] ; then
748 # We're specifically not using emake install-sapi as libtool
749 # may cause unnecessary relink failures (see bug #351266)
750 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
751 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
752 keepdir "/usr/$(get_libdir)/apache2/modules"
753 else
754 # needed each time, php_install_ini would reset it
755 into "${PHP_DESTDIR#${EPREFIX}}"
756 case "$sapi" in
757 cli)
758 source="sapi/cli/php"
759 ;;
760 cgi)
761 source="sapi/cgi/php-cgi"
762 ;;
763 fpm)
764 source="sapi/fpm/php-fpm"
765 ;;
766 embed)
767 source="libs/libphp${PHP_MV}$(get_libname)"
768 ;;
769 *)
770 die "unhandled sapi in src_install"
771 ;;
772 esac
773
774 if [[ "${source}" == *"$(get_libname)" ]]; then
775 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
776 else
777 dobin "${source}" || die "Unable to install ${sapi} sapi"
778 fi
779 fi
780
781 php_install_ini "${sapi}"
782
783 # construct correct SAPI string for php-config
784 # thanks to ferringb for the bash voodoo
785 if [[ "${sapi}" == "apache2" ]]; then
786 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
787 else
788 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
789 fi
790 fi
791 done
792
793 # Install env.d files
794 newenvd "${FILESDIR}/20php5-envd" \
795 "20php${SLOT}"
796 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
797 "${ED}/etc/env.d/20php${SLOT}"
798 sed -e "s|php5|php${SLOT}|g" -i \
799 "${ED}/etc/env.d/20php${SLOT}"
800
801 # set php-config variable correctly (bug #278439)
802 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
803 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
804 }
805
806 src_test() {
807 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
808 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
809 if [[ ! -x "${PHP_BIN}" ]] ; then
810 ewarn "Test phase requires USE=cli, skipping"
811 return
812 else
813 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
814 fi
815
816 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
817 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
818 fi
819
820 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
821 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
822
823 for name in ${EXPECTED_TEST_FAILURES}; do
824 mv "${name}.out" "${name}.out.orig" 2>/dev/null
825 done
826
827 local failed="$(find -name '*.out')"
828 if [[ ${failed} != "" ]] ; then
829 ewarn "The following test cases failed unexpectedly:"
830 for name in ${failed}; do
831 ewarn " ${name/.out/}"
832 done
833 else
834 einfo "No unexpected test failures, all fine"
835 fi
836
837 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
838 local passed=""
839 for name in ${EXPECTED_TEST_FAILURES}; do
840 [[ -f "${name}.diff" ]] && continue
841 passed="${passed} ${name}"
842 done
843 if [[ ${passed} != "" ]] ; then
844 einfo "The following test cases passed unexpectedly:"
845 for name in ${passed}; do
846 ewarn " ${passed}"
847 done
848 else
849 einfo "None of the known-to-fail tests passed, all fine"
850 fi
851 fi
852 }
853
854 pkg_postinst() {
855 # Output some general info to the user
856 if use apache2 ; then
857 APACHE2_MOD_DEFINE="PHP5"
858 APACHE2_MOD_CONF="70_mod_php5"
859 apache-module_pkg_postinst
860 fi
861
862 # Create the symlinks for php
863 for m in ${SAPIS}; do
864 [[ ${m} == 'embed' ]] && continue;
865 if use $m ; then
866 local ci=$(eselect php show $m)
867 if [[ -z $ci ]]; then
868 eselect php set $m php${SLOT}
869 einfo "Switched ${m} to use php:${SLOT}"
870 einfo
871 elif [[ $ci != "php${SLOT}" ]] ; then
872 elog "To switch $m to use php:${SLOT}, run"
873 elog " eselect php set $m php${SLOT}"
874 elog
875 fi
876 fi
877 done
878
879 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
880 elog "to compile extensions for the ${SLOT} ABI"
881 elog
882 if ! use readline && use cli ; then
883 ewarn "Note that in order to use php interactivly, you need to enable"
884 ewarn "the readline USE flag or php -a will hang"
885 fi
886 elog
887 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
888 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
889 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
890 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
891
892 elog
893 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
894 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
895 elog
896
897 if ( [[ -z SUHOSIN_VERSION ]] && use suhosin && version_is_at_least 5.3.6_rc1 ) ; then
898 ewarn
899 ewarn "The suhosin USE flag now only installs the suhosin patch!"
900 ewarn "If you want the suhosin extension, make sure you install"
901 ewarn " dev-php/suhosin"
902 ewarn
903 fi
904 }
905
906 pkg_prerm() {
907 local sapi
908 local slot
909 for sapi in ${SAPIS}; do
910 slot=$(eselect php show $sapi 2> /dev/null)
911 slot=${slot/php/}
912 if [[ $slot == $SLOT ]]; then
913 ewarn "You have removed the active version of the $sapi SAPI"
914 ewarn "Fix the issue using \`eselect php\`"
915 fi
916 done
917 }
918
919
920
921 1.1 dev-lang/php/php-5.3.20.ebuild
922
923 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.3.20.ebuild?rev=1.1&view=markup
924 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.3.20.ebuild?rev=1.1&content-type=text/plain
925
926 Index: php-5.3.20.ebuild
927 ===================================================================
928 # Copyright 1999-2013 Gentoo Foundation
929 # Distributed under the terms of the GNU General Public License v2
930 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.3.20.ebuild,v 1.1 2013/01/01 13:44:17 olemarkus Exp $
931
932 EAPI=4
933
934 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool
935
936 SUHOSIN_VERSION=""
937 FPM_VERSION="builtin"
938 EXPECTED_TEST_FAILURES=""
939
940 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd"
941
942 function php_get_uri ()
943 {
944 case "${1}" in
945 "php-pre")
946 echo "http://downloads.php.net/johannes/${2}"
947 ;;
948 "php")
949 echo "http://www.php.net/distributions/${2}"
950 ;;
951 "suhosin")
952 echo "http://download.suhosin.org/${2}"
953 ;;
954 "olemarkus")
955 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
956 ;;
957 "gentoo")
958 echo "mirror://gentoo/${2}"
959 ;;
960 *)
961 die "unhandled case in php_get_uri"
962 ;;
963 esac
964 }
965
966 PHP_MV="$(get_major_version)"
967 SLOT="$(get_version_component_range 1-2)"
968
969 # alias, so we can handle different types of releases (finals, rcs, alphas,
970 # betas, ...) w/o changing the whole ebuild
971 PHP_PV="${PV/_rc/RC}"
972 PHP_PV="${PHP_PV/_alpha/alpha}"
973 PHP_PV="${PHP_PV/_beta/beta}"
974 PHP_RELEASE="php"
975 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
976 PHP_P="${PN}-${PHP_PV}"
977
978 PHP_PATCHSET_LOC="olemarkus"
979
980 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
981
982 PHP_PATCHSET="0"
983 PHP_PATCHSET_URI="
984 $(php_get_uri "${PHP_PATCHSET_LOC}" "php-patchset-${SLOT}-r${PHP_PATCHSET}.tar.bz2")"
985
986 PHP_FPM_INIT_VER="4"
987 PHP_FPM_CONF_VER="1"
988
989 if [[ ${SUHOSIN_VERSION} == *-gentoo ]]; then
990 # in some cases we use our own suhosin patch (very recent version,
991 # patch conflicts, etc.)
992 SUHOSIN_TYPE="olemarkus"
993 else
994 SUHOSIN_TYPE="suhosin"
995 fi
996
997 if [[ -n ${SUHOSIN_VERSION} ]]; then
998 SUHOSIN_PATCH="suhosin-patch-${SUHOSIN_VERSION}.patch";
999 SUHOSIN_URI="$(php_get_uri ${SUHOSIN_TYPE} ${SUHOSIN_PATCH}.gz )"
1000 fi
1001
1002 SRC_URI="
1003 ${PHP_SRC_URI}
1004 ${PHP_PATCHSET_URI}"
1005
1006 if [[ -n ${SUHOSIN_VERSION} ]]; then
1007 SRC_URI="${SRC_URI}
1008 suhosin? ( ${SUHOSIN_URI} )"
1009 fi
1010
1011 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
1012 HOMEPAGE="http://php.net/"
1013 LICENSE="PHP-3"
1014
1015 S="${WORKDIR}/${PHP_P}"
1016
1017 # We can build the following SAPIs in the given order
1018 SAPIS="embed cli cgi fpm apache2"
1019
1020 # Gentoo-specific, common features
1021 IUSE="kolab"
1022
1023 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
1024 IUSE="${IUSE}
1025 ${SAPIS/cli/+cli}
1026 threads"
1027
1028 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
1029 crypt +ctype curl curlwrappers debug doc
1030 enchant exif frontbase +fileinfo +filter firebird
1031 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
1032 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
1033 mssql mysql mysqlnd mysqli nls
1034 oci8-instant-client odbc pcntl pdo +phar pic +posix postgres qdbm
1035 readline recode selinux +session sharedmem
1036 +simplexml snmp soap sockets spell sqlite2 sqlite ssl
1037 sybase-ct sysvipc tidy +tokenizer truetype unicode wddx
1038 +xml xmlreader xmlwriter xmlrpc xpm xsl zip zlib"
1039
1040 # Enable suhosin if available
1041 [[ -n $SUHOSIN_VERSION ]] && IUSE="${IUSE} suhosin"
1042
1043 DEPEND="!dev-lang/php:5
1044 >=app-admin/eselect-php-0.6.2
1045 >=dev-libs/libpcre-8.12[unicode]
1046 apache2? ( www-servers/apache[threads=] )
1047 berkdb? ( =sys-libs/db-4* )
1048 bzip2? ( app-arch/bzip2 )
1049 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
1050 cjk? ( !gd? (
1051 virtual/jpeg
1052 media-libs/libpng
1053 sys-libs/zlib
1054 ) )
1055 crypt? ( >=dev-libs/libmcrypt-2.4 )
1056 curl? ( >=net-misc/curl-7.10.5 )
1057 enchant? ( app-text/enchant )
1058 exif? ( !gd? (
1059 virtual/jpeg
1060 media-libs/libpng
1061 sys-libs/zlib
1062 ) )
1063 firebird? ( dev-db/firebird )
1064 gd? ( virtual/jpeg media-libs/libpng sys-libs/zlib )
1065 gdbm? ( >=sys-libs/gdbm-1.8.0 )
1066 gmp? ( >=dev-libs/gmp-4.1.2 )
1067 iconv? ( virtual/libiconv )
1068 imap? ( virtual/imap-c-client[ssl=] )
1069 intl? ( dev-libs/icu )
1070 iodbc? ( dev-db/libiodbc )
1071 kerberos? ( virtual/krb5 )
1072 kolab? ( >=net-libs/c-client-2004g-r1 )
1073 ldap? ( >=net-nds/openldap-1.2.11 )
1074 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
1075 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
1076 mssql? ( dev-db/freetds[mssql] )
1077 !mysqlnd? (
1078 mysql? ( virtual/mysql )
1079 mysqli? ( >=virtual/mysql-4.1 )
1080 )
1081 nls? ( sys-devel/gettext )
1082 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
1083 odbc? ( >=dev-db/unixODBC-1.8.13 )
1084 postgres? ( dev-db/postgresql-base )
1085 qdbm? ( dev-db/qdbm )
1086 readline? ( sys-libs/readline )
1087 recode? ( app-text/recode )
1088 sharedmem? ( dev-libs/mm )
1089 simplexml? ( >=dev-libs/libxml2-2.6.8 )
1090 snmp? ( >=net-analyzer/net-snmp-5.2 )
1091 soap? ( >=dev-libs/libxml2-2.6.8 )
1092 spell? ( >=app-text/aspell-0.50 )
1093 sqlite2? ( =dev-db/sqlite-2* )
1094 sqlite? ( >=dev-db/sqlite-3.7.7.1 )
1095 ssl? ( >=dev-libs/openssl-0.9.7 )
1096 sybase-ct? ( dev-db/freetds )
1097 tidy? ( app-text/htmltidy )
1098 truetype? (
1099 =media-libs/freetype-2*
1100 >=media-libs/t1lib-5.0.0
1101 !gd? (
1102 virtual/jpeg media-libs/libpng sys-libs/zlib )
1103 )
1104 unicode? ( dev-libs/oniguruma )
1105 wddx? ( >=dev-libs/libxml2-2.6.8 )
1106 xml? ( >=dev-libs/libxml2-2.6.8 )
1107 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
1108 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
1109 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
1110 xpm? (
1111 x11-libs/libXpm
1112 virtual/jpeg
1113 media-libs/libpng sys-libs/zlib
1114 )
1115 xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
1116 zip? ( sys-libs/zlib )
1117 zlib? ( sys-libs/zlib )
1118 virtual/mta
1119 "
1120
1121 php="=${CATEGORY}/${PF}"
1122
1123 REQUIRED_USE="
1124 truetype? ( gd )
1125 cjk? ( gd )
1126 exif? ( gd )
1127
1128 xpm? ( gd )
1129 gd? ( zlib )
1130 simplexml? ( xml )
1131 soap? ( xml )
1132 wddx? ( xml )
1133 xmlrpc? ( || ( xml iconv ) )
1134 xmlreader? ( xml )
1135 xsl? ( xml )
1136 ldap-sasl? ( ldap )
1137 kolab? ( imap )
1138 mhash? ( hash )
1139 phar? ( hash )
1140 mysqlnd? ( || (
1141 mysql
1142 mysqli
1143 pdo
1144 ) )
1145
1146 qdbm? ( !gdbm )
1147 readline? ( !libedit )
1148 recode? ( !imap !mysql !mysqli )
1149 sharedmem? ( !threads )
1150
1151 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
1152
1153 RDEPEND="${DEPEND}"
1154
1155 [[ -n $SUHOSIN_VERSION ]] && RDEPEND="${RDEPEND} suhosin? ( =${CATEGORY}/${PN}-${SLOT}*[unicode] )"
1156
1157 RDEPEND="${RDEPEND} fpm? ( selinux? ( sec-policy/selinux-phpfpm ) )"
1158
1159 DEPEND="${DEPEND}
1160 sys-devel/flex
1161 >=sys-devel/m4-1.4.3
1162 >=sys-devel/libtool-1.5.18"
1163
1164 # They are in PDEPEND because we need PHP installed first!
1165 PDEPEND="doc? ( app-doc/php-docs )"
1166
1167 # No longer depend on the extension. The suhosin USE flag only installs the
1168 # patch
1169 #[[ -n $SUHOSIN_VERSION ]] && PDEPEND="${PDEPEND} suhosin? ( dev-php${PHP_MV}/suhosin )"
1170
1171 # Allow users to install production version if they want to
1172
1173 case "${PHP_INI_VERSION}" in
1174 production|development)
1175 ;;
1176 *)
1177 PHP_INI_VERSION="development"
1178 ;;
1179 esac
1180
1181 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
1182 PHP_INI_FILE="php.ini"
1183
1184 want_apache
1185
1186 pkg_setup() {
1187 depend.apache_pkg_setup
1188 }
1189
1190 php_install_ini() {
1191 local phpsapi="${1}"
1192
1193 # work out where we are installing the ini file
1194 php_set_ini_dir "${phpsapi}"
1195
1196 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
1197 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
1198
1199 # default to /tmp for save_path, bug #282768
1200 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
1201
1202 # Set the extension dir
1203 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
1204
1205 # Set the include path to point to where we want to find PEAR packages
1206 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
1207
1208 dodir "${PHP_INI_DIR#${EPREFIX}}"
1209 insinto "${PHP_INI_DIR#${EPREFIX}}"
1210 newins "${phpinisrc}" "${PHP_INI_FILE}"
1211
1212 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
1213 elog
1214
1215 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
1216 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
1217
1218 # SAPI-specific handling
1219 if [[ "${sapi}" == "apache2" ]] ; then
1220 insinto "${APACHE_MODULES_CONFDIR#${EPREFIX}}"
1221 newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
1222 "70_mod_php${PHP_MV}.conf"
1223 fi
1224
1225 if [[ "${sapi}" == "fpm" ]] ; then
1226 [[ -z ${PHP_FPM_INIT_VER} ]] && PHP_FPM_INIT_VER=3
1227 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
1228 einfo "Installing FPM CGI config file php-fpm.conf"
1229 insinto "${PHP_INI_DIR#${EPREFIX}}"
1230 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
1231 dodir "/etc/init.d"
1232 insinto "/etc/init.d"
1233 newinitd "${FILESDIR}/php-fpm-r${PHP_FPM_INIT_VER}.init" "php-fpm"
1234 # dosym "${PHP_DESTDIR#${EPREFIX}}/bin/php-fpm" "/usr/bin/php-fpm"
1235
1236 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
1237 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
1238 fi
1239
1240 # Install PHP ini files into /usr/share/php
1241
1242 dodoc php.ini-development
1243 dodoc php.ini-production
1244
1245 }
1246
1247 php_set_ini_dir() {
1248 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
1249 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
1250 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
1251 }
1252
1253 src_prepare() {
1254 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
1255 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
1256 # there is no easy way to circumvent that, all php calls during
1257 # install use -n, so no php.ini file will be used.
1258 # As such, this is the easiest way to get around
1259 addpredict /session_mm_cli250.sem
1260 addpredict /session_mm_cli0.sem
1261
1262 # kolab support (support for imap annotations)
1263 use kolab && epatch "${WORKDIR}/patches/opt/imap-kolab-annotations.patch"
1264
1265 # Change PHP branding
1266 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \
1267 -i configure.in || die "Unable to change PHP branding"
1268
1269 # Apply generic PHP patches
1270 EPATCH_SOURCE="${WORKDIR}/patches/generic" EPATCH_SUFFIX="patch" \
1271 EPATCH_FORCE="yes" \
1272 EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
1273
1274 # Patch PHP to show Gentoo as the server platform
1275 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
1276 -i configure.in || die "Failed to fix server platform name"
1277
1278 # Prevent PHP from activating the Apache config,
1279 # as we will do that ourselves
1280 sed -i \
1281 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
1282 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
1283 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
1284
1285 # Patch PHP to support heimdal instead of mit-krb5
1286 if has_version "app-crypt/heimdal" ; then
1287 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
1288 || die "Failed to fix heimdal libname"
1289 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
1290 || die "Failed to fix heimdal crypt library reference"
1291 fi
1292
1293 # Suhosin support
1294 if [[ -n $SUHOSIN_VERSION ]] ; then
1295 if use suhosin ; then
1296 epatch "${WORKDIR}/${SUHOSIN_PATCH}"
1297 fi
1298 else
1299 ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
1300 fi
1301
1302 #Add user patches #357637
1303 epatch_user
1304
1305 # rebuild the whole autotools stuff as we are heavily patching it
1306 # (suhosin, fastbuild, ...)
1307
1308 # eaclocal doesn't accept --force, so we try to force re-generation
1309 # this way
1310 rm aclocal.m4
1311
1312 # work around divert() issues with newer autoconf, bug #281697
1313 if has_version '>=sys-devel/autoconf-2.64' ; then
1314 sed -i -r \
1315 -e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
1316 $(grep -l divert $(find . -name '*.m4') configure.in) || die
1317 fi
1318 eautoreconf --force -W no-cross
1319 }
1320
1321 src_configure() {
1322 addpredict /usr/share/snmp/mibs/.index
1323 addpredict /var/lib/net-snmp/mib_indexes
1324
1325 PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
1326
1327 # This is a global variable and should be in caps. It isn't because the
1328 # phpconfutils eclass relies on exactly this name...
1329 # for --with-libdir see bug #327025
1330 my_conf="--prefix=${PHP_DESTDIR}
1331 --mandir=${PHP_DESTDIR}/man
1332 --infodir=${PHP_DESTDIR}/info
1333 --libdir=${PHP_DESTDIR}/lib
1334 --with-libdir=$(get_libdir)
1335 --without-pear
1336 $(use_enable threads maintainer-zts)"
1337
1338 # extension USE flag shared
1339 my_conf+="
1340 $(use_enable bcmath bcmath )
1341 $(use_with bzip2 bz2 )
1342 $(use_enable calendar calendar )
1343 $(use_enable ctype ctype )
1344 $(use_with curl curl )
1345 $(use_with curlwrappers curlwrappers )
1346 $(use_enable xml dom )
1347 $(use_with enchant enchant /usr)
1348 $(use_enable exif exif )
1349 $(use_enable fileinfo fileinfo )
1350 $(use_enable filter filter )
1351 $(use_enable ftp ftp )
1352 $(use_with nls gettext )
1353 $(use_with gmp gmp )
1354 $(use_enable hash hash )
1355 $(use_with mhash mhash )
1356 $(use_with iconv iconv )
1357 $(use_enable intl intl )
1358 $(use_enable ipv6 ipv6 )
1359 $(use_enable json json )
1360 $(use_with kerberos kerberos /usr)
1361 $(use_enable xml libxml )
1362 $(use_enable unicode mbstring )
1363 $(use_with crypt mcrypt )
1364 $(use_with mssql mssql )
1365 $(use_with unicode onig /usr)
1366 $(use_with ssl openssl )
1367 $(use_with ssl openssl-dir /usr)
1368 $(use_enable pcntl pcntl )
1369 $(use_enable phar phar )
1370 $(use_enable pdo pdo )
1371 $(use_with postgres pgsql )
1372 $(use_enable posix posix )
1373 $(use_with spell pspell )
1374 $(use_with recode recode )
1375 $(use_enable simplexml simplexml )
1376 $(use_enable sharedmem shmop )
1377 $(use_with snmp snmp )
1378 $(use_enable soap soap )
1379 $(use_enable sockets sockets )"
1380 if version_is_at_least 5.3.16-r2; then
1381 my_conf+=" $(use_with sqlite2 sqlite /usr) "
1382 use sqlite2 && my_conf+=" $(use_enable unicode sqlite-utf8)"
1383 else
1384 my_conf+=" $(use_with sqlite sqlite /usr) "
1385 use sqlite && my_conf+=" $(use_enable unicode sqlite-utf8)"
1386 fi
1387 my_conf+="
1388 $(use_with sqlite sqlite3 /usr)
1389 $(use_with sybase-ct sybase-ct /usr)
1390 $(use_enable sysvipc sysvmsg )
1391 $(use_enable sysvipc sysvsem )
1392 $(use_enable sysvipc sysvshm )
1393 $(use_with tidy tidy )
1394 $(use_enable tokenizer tokenizer )
1395 $(use_enable wddx wddx )
1396 $(use_enable xml xml )
1397 $(use_enable xmlreader xmlreader )
1398 $(use_enable xmlwriter xmlwriter )
1399 $(use_with xmlrpc xmlrpc )
1400 $(use_with xsl xsl )
1401 $(use_enable zip zip )
1402 $(use_with zlib zlib )
1403 $(use_enable debug debug )"
1404
1405 # DBA support
1406 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
1407 || use qdbm ; then
1408 my_conf="${my_conf} --enable-dba${shared}"
1409 fi
1410
1411 # DBA drivers support
1412 my_conf+="
1413 $(use_with cdb cdb )
1414 $(use_with berkdb db4 )
1415 $(use_enable flatfile flatfile )
1416 $(use_with gdbm gdbm )
1417 $(use_enable inifile inifile )
1418 $(use_with qdbm qdbm )"
1419
1420 # Support for the GD graphics library
1421 my_conf+="
1422 $(use_with truetype freetype-dir /usr)
1423 $(use_with truetype t1lib /usr)
1424 $(use_enable cjk gd-jis-conv )
1425 $(use_with gd jpeg-dir /usr)
1426 $(use_with gd png-dir /usr)
1427 $(use_with xpm xpm-dir /usr)"
1428 # enable gd last, so configure can pick up the previous settings
1429 my_conf+="
1430 $(use_with gd gd )"
1431
1432 # IMAP support
1433 if use imap ; then
1434 my_conf+="
1435 $(use_with imap imap )
1436 $(use_with ssl imap-ssl )"
1437 fi
1438
1439 # Interbase/firebird support
1440
1441 if use firebird ; then
1442 my_conf+="
1443 $(use_with firebird interbase /usr)"
1444 fi
1445
1446 # LDAP support
1447 if use ldap ; then
1448 my_conf+="
1449 $(use_with ldap ldap )
1450 $(use_with ldap-sasl ldap-sasl )"
1451 fi
1452
1453 # MySQL support
1454 if use mysql ; then
1455 if use mysqlnd ; then
1456 my_conf+="
1457 $(use_with mysql mysql mysqlnd)"
1458 else
1459 my_conf+="
1460 $(use_with mysql mysql /usr)"
1461 fi
1462 my_conf+="
1463 $(use_with mysql mysql-sock /var/run/mysqld/mysqld.sock)"
1464 fi
1465
1466 # MySQLi support
1467 if use mysqlnd ; then
1468 my_conf+="
1469 $(use_with mysqli mysqli mysqlnd)"
1470 else
1471 my_conf+="
1472 $(use_with mysqli mysqli /usr/bin/mysql_config)"
1473 fi
1474
1475 # ODBC support
1476 if use odbc ; then
1477 my_conf+="
1478 $(use_with odbc unixODBC /usr)"
1479 fi
1480
1481 if use iodbc ; then
1482 my_conf+="
1483 $(use_with iodbc iodbc /usr)"
1484 fi
1485
1486 # Oracle support
1487 if use oci8-instant-client ; then
1488 my_conf+="
1489 $(use_with oci8-instant-client oci8)"
1490 fi
1491
1492 # PDO support
1493 if use pdo ; then
1494 my_conf+="
1495 $(use_with mssql pdo-dblib )"
1496 if use mysqlnd ; then
1497 my_conf+="
1498 $(use_with mysql pdo-mysql mysqlnd)"
1499 else
1500 my_conf+="
1501 $(use_with mysql pdo-mysql /usr)"
1502 fi
1503 my_conf+="
1504 $(use_with postgres pdo-pgsql )
1505 $(use_with sqlite pdo-sqlite /usr)
1506 $(use_with odbc pdo-odbc unixODBC,/usr)"
1507 if use oci8-instant-client ; then
1508 my_conf+="
1509 $(use_with oci8-instant-client pdo-oci)"
1510 fi
1511 fi
1512
1513 # readline/libedit support
1514 my_conf+="
1515 $(use_with readline readline )
1516 $(use_with libedit libedit )"
1517
1518 # Session support
1519 if use session ; then
1520 my_conf+="
1521 $(use_with sharedmem mm )"
1522 else
1523 my_conf+="
1524 $(use_enable session session )"
1525 fi
1526
1527 if use pic ; then
1528 my_conf="${my_conf} --with-pic"
1529 fi
1530
1531 # we use the system copy of pcre
1532 # --with-pcre-regex affects ext/pcre
1533 # --with-pcre-dir affects ext/filter and ext/zip
1534 my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
1535
1536 # Catch CFLAGS problems
1537 # Fixes bug #14067.
1538 # Changed order to run it in reverse for bug #32022 and #12021.
1539 replace-cpu-flags "k6*" "i586"
1540
1541 # Support user-passed configuration parameters
1542 my_conf="${my_conf} ${EXTRA_ECONF:-}"
1543
1544 # Support the Apache2 extras, they must be set globally for all
1545 # SAPIs to work correctly, especially for external PHP extensions
1546
1547 mkdir -p "${WORKDIR}/sapis-build"
1548 for one_sapi in $SAPIS ; do
1549 use "${one_sapi}" || continue
1550 php_set_ini_dir "${one_sapi}"
1551
1552 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
1553 cd "${WORKDIR}/sapis-build/${one_sapi}"
1554
1555 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
1556 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
1557
1558 for sapi in $SAPIS ; do
1559 case "$sapi" in
1560 cli|cgi|embed|fpm)
1561 if [[ "${one_sapi}" == "${sapi}" ]] ; then
1562 sapi_conf="${sapi_conf} --enable-${sapi}"
1563 else
1564 sapi_conf="${sapi_conf} --disable-${sapi}"
1565 fi
1566 ;;
1567
1568 apache2)
1569 if [[ "${one_sapi}" == "${sapi}" ]] ; then
1570 sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
1571 else
1572 sapi_conf="${sapi_conf} --without-apxs2"
1573 fi
1574 ;;
1575 esac
1576 done
1577
1578 econf ${sapi_conf}
1579 done
1580 }
1581
1582 src_compile() {
1583 # snmp seems to run during src_compile, too (bug #324739)
1584 addpredict /usr/share/snmp/mibs/.index
1585 addpredict /var/lib/net-snmp/mibs/.index
1586
1587 SAPI_DIR="${WORKDIR}/sapis"
1588
1589 for sapi in ${SAPIS} ; do
1590 use "${sapi}" || continue
1591
1592 php_sapi_build "${sapi}"
1593 php_sapi_copy "${sapi}"
1594 done
1595 }
1596
1597 php_sapi_build() {
1598 mkdir -p "${SAPI_DIR}/$1"
1599
1600 cd "${WORKDIR}/sapis-build/$1"
1601 emake || die "emake failed"
1602 }
1603
1604 php_sapi_copy() {
1605 local sapi="$1"
1606 local source=""
1607
1608 case "$sapi" in
1609 cli)
1610 source="sapi/cli/php"
1611 ;;
1612 cgi)
1613 source="sapi/cgi/php-cgi"
1614 ;;
1615 fpm)
1616 source="sapi/fpm/php-fpm"
1617 ;;
1618 embed)
1619 source="libs/libphp${PHP_MV}.so"
1620 ;;
1621
1622 apache2)
1623 # apache2 is a special case; the necessary files
1624 # (yes, multiple) are copied by make install, not
1625 # by the ebuild; that's the reason, why apache2 has
1626 # to be the last sapi
1627 emake INSTALL_ROOT="${SAPI_DIR}/${sapi}/" install-sapi
1628 ;;
1629
1630 *)
1631 die "unhandled sapi in php_sapi_copy"
1632 ;;
1633 esac
1634
1635 if [[ "${source}" ]] ; then
1636 cp "$source" "${SAPI_DIR}/$sapi" || die "Unable to copy ${sapi} SAPI"
1637 fi
1638 }
1639
1640 src_install() {
1641 # see bug #324739 for what happens when we don't have that
1642 addpredict /usr/share/snmp/mibs/.index
1643
1644 # grab the first SAPI that got built and install common files from there
1645 local first_sapi=""
1646 for sapi in $SAPIS ; do
1647 if use $sapi ; then
1648 first_sapi=$sapi
1649 break
1650 fi
1651 done
1652
1653 # Makefile forgets to create this before trying to write to it...
1654 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
1655
1656 # Install php environment (without any sapis)
1657 cd "${WORKDIR}/sapis-build/$first_sapi"
1658 emake INSTALL_ROOT="${D}" \
1659 install-build install-headers install-programs \
1660 || die "emake install failed"
1661
1662 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
1663
1664 # Create the directory where we'll put version-specific php scripts
1665 keepdir /usr/share/php${PHP_MV}
1666
1667 local sapi="", file=""
1668 local sapi_list=""
1669
1670 for sapi in ${SAPIS}; do
1671 if use "${sapi}" ; then
1672 einfo "Installing SAPI: ${sapi}"
1673 cd "${WORKDIR}/sapis-build/${sapi}"
1674
1675 if [[ "${sapi}" == "apache2" ]] ; then
1676 # We're specifically not using emake install-sapi as libtool
1677 # may cause unnecessary relink failures (see bug #351266)
1678 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
1679 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
1680 keepdir "/usr/$(get_libdir)/apache2/modules"
1681 else
1682 # needed each time, php_install_ini would reset it
1683 into "${PHP_DESTDIR#${EPREFIX}}"
1684 case "$sapi" in
1685 cli)
1686 source="sapi/cli/php"
1687 ;;
1688 cgi)
1689 source="sapi/cgi/php-cgi"
1690 ;;
1691 fpm)
1692 source="sapi/fpm/php-fpm"
1693 ;;
1694 embed)
1695 source="libs/libphp${PHP_MV}$(get_libname)"
1696 ;;
1697 *)
1698 die "unhandled sapi in src_install"
1699 ;;
1700 esac
1701
1702 if [[ "${source}" == *"$(get_libname)" ]]; then
1703 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
1704 else
1705 dobin "${source}" || die "Unable to install ${sapi} sapi"
1706 fi
1707 fi
1708
1709 php_install_ini "${sapi}"
1710
1711 # construct correct SAPI string for php-config
1712 # thanks to ferringb for the bash voodoo
1713 if [[ "${sapi}" == "apache2" ]]; then
1714 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
1715 else
1716 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
1717 fi
1718 fi
1719 done
1720
1721 # Install env.d files
1722 newenvd "${FILESDIR}/20php5-envd" \
1723 "20php${SLOT}"
1724 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
1725 "${ED}/etc/env.d/20php${SLOT}"
1726 sed -e "s|php5|php${SLOT}|g" -i \
1727 "${ED}/etc/env.d/20php${SLOT}"
1728
1729 # set php-config variable correctly (bug #278439)
1730 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
1731 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
1732 }
1733
1734 src_test() {
1735 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1736 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
1737 if [[ ! -x "${PHP_BIN}" ]] ; then
1738 ewarn "Test phase requires USE=cli, skipping"
1739 return
1740 else
1741 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
1742 fi
1743
1744 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
1745 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
1746 fi
1747
1748 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
1749 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
1750
1751 for name in ${EXPECTED_TEST_FAILURES}; do
1752 mv "${name}.out" "${name}.out.orig" 2>/dev/null
1753 done
1754
1755 local failed="$(find -name '*.out')"
1756 if [[ ${failed} != "" ]] ; then
1757 ewarn "The following test cases failed unexpectedly:"
1758 for name in ${failed}; do
1759 ewarn " ${name/.out/}"
1760 done
1761 else
1762 einfo "No unexpected test failures, all fine"
1763 fi
1764
1765 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
1766 local passed=""
1767 for name in ${EXPECTED_TEST_FAILURES}; do
1768 [[ -f "${name}.diff" ]] && continue
1769 passed="${passed} ${name}"
1770 done
1771 if [[ ${passed} != "" ]] ; then
1772 einfo "The following test cases passed unexpectedly:"
1773 for name in ${passed}; do
1774 ewarn " ${passed}"
1775 done
1776 else
1777 einfo "None of the known-to-fail tests passed, all fine"
1778 fi
1779 fi
1780 }
1781
1782 #Do not use eblit for this because it will not get sourced when installing from
1783 #binary package (bug #380845)
1784 pkg_postinst() {
1785 # Output some general info to the user
1786 if use apache2 ; then
1787 APACHE2_MOD_DEFINE="PHP5"
1788 APACHE2_MOD_CONF="70_mod_php5"
1789 apache-module_pkg_postinst
1790 fi
1791
1792 # Create the symlinks for php
1793 for m in ${SAPIS}; do
1794 [[ ${m} == 'embed' ]] && continue;
1795 if use $m ; then
1796 local ci=$(eselect php show $m)
1797 if [[ -z $ci ]]; then
1798 eselect php set $m php${SLOT}
1799 einfo "Switched ${m} to use php:${SLOT}"
1800 einfo
1801 elif [[ $ci != "php${SLOT}" ]] ; then
1802 elog "To switch $m to use php:${SLOT}, run"
1803 elog " eselect php set $m php${SLOT}"
1804 elog
1805 fi
1806 fi
1807 done
1808
1809 elog "Make sure that PHP_TARGETS in /etc/make.conf includes php${SLOT/./-} in order"
1810 elog "to compile extensions for the ${SLOT} ABI"
1811 elog
1812 if ! use readline && use cli ; then
1813 ewarn "Note that in order to use php interactivly, you need to enable"
1814 ewarn "the readline USE flag or php -a will hang"
1815 fi
1816 elog
1817 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
1818 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
1819 elog "'production' or 'development' in /etc/make.conf"
1820 ewarn "Both versions of php.ini can be found in /usr/share/doc/${PF}"
1821
1822 # check for not yet migrated old style config dirs
1823 ls "${ROOT}"/etc/php/*-php5 &>/dev/null
1824 if [[ $? -eq 0 ]]; then
1825 ewarn "Make sure to migrate your config files, starting with php-5.3.4 and php-5.2.16 config"
1826 ewarn "files are now kept at ${ROOT}etc/php/{apache2,cli,cgi,fpm}-php5.x"
1827 fi
1828 elog
1829 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
1830 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
1831 elog
1832
1833 if ( [[ -z SUHOSIN_VERSION ]] && use suhosin && version_is_at_least 5.3.6_rc1 ) ; then
1834 ewarn "The suhosin USE flag now only installs the suhosin patch!"
1835 ewarn "If you want the suhosin extension, make sure you install"
1836 ewarn " dev-php5/suhosin"
1837 ewarn
1838 fi
1839 }
1840
1841
1842
1843 1.1 dev-lang/php/php-5.5.0_alpha2.ebuild
1844
1845 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.0_alpha2.ebuild?rev=1.1&view=markup
1846 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/php/php-5.5.0_alpha2.ebuild?rev=1.1&content-type=text/plain
1847
1848 Index: php-5.5.0_alpha2.ebuild
1849 ===================================================================
1850 # Copyright 1999-2013 Gentoo Foundation
1851 # Distributed under the terms of the GNU General Public License v2
1852 # $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.5.0_alpha2.ebuild,v 1.1 2013/01/01 13:44:17 olemarkus Exp $
1853
1854 EAPI=4
1855
1856 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool
1857
1858 SUHOSIN_VERSION=""
1859 FPM_VERSION="builtin"
1860 EXPECTED_TEST_FAILURES=""
1861
1862 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"
1863
1864 function php_get_uri ()
1865 {
1866 case "${1}" in
1867 "php-pre")
1868 echo "http://downloads.php.net/dsp/${2}"
1869 ;;
1870 "php")
1871 echo "http://www.php.net/distributions/${2}"
1872 ;;
1873 "suhosin")
1874 echo "http://download.suhosin.org/${2}"
1875 ;;
1876 "olemarkus")
1877 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
1878 ;;
1879 "gentoo")
1880 echo "mirror://gentoo/${2}"
1881 ;;
1882 *)
1883 die "unhandled case in php_get_uri"
1884 ;;
1885 esac
1886 }
1887
1888 PHP_MV="$(get_major_version)"
1889 SLOT="$(get_version_component_range 1-2)"
1890
1891 # alias, so we can handle different types of releases (finals, rcs, alphas,
1892 # betas, ...) w/o changing the whole ebuild
1893 PHP_PV="${PV/_rc/RC}"
1894 PHP_PV="${PHP_PV/_alpha/alpha}"
1895 PHP_PV="${PHP_PV/_beta/beta}"
1896 PHP_RELEASE="php"
1897 [[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
1898 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
1899 PHP_P="${PN}-${PHP_PV}"
1900
1901 PHP_PATCHSET_LOC="olemarkus"
1902
1903 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
1904
1905 PHP_PATCHSET="0"
1906 PHP_PATCHSET_URI="
1907 $(php_get_uri "${PHP_PATCHSET_LOC}" "php-patchset-${SLOT}-r${PHP_PATCHSET}.tar.bz2")"
1908
1909 PHP_FPM_INIT_VER="4"
1910 PHP_FPM_CONF_VER="1"
1911
1912 if [[ ${SUHOSIN_VERSION} == *-gentoo ]]; then
1913 # in some cases we use our own suhosin patch (very recent version,
1914 # patch conflicts, etc.)
1915 SUHOSIN_TYPE="olemarkus"
1916 else
1917 SUHOSIN_TYPE="suhosin"
1918 fi
1919
1920 if [[ -n ${SUHOSIN_VERSION} ]]; then
1921 SUHOSIN_PATCH="suhosin-patch-${SUHOSIN_VERSION}.patch";
1922 SUHOSIN_URI="$(php_get_uri ${SUHOSIN_TYPE} ${SUHOSIN_PATCH}.gz )"
1923 fi
1924
1925 SRC_URI="
1926 ${PHP_SRC_URI}
1927 ${PHP_PATCHSET_URI}"
1928
1929 if [[ -n ${SUHOSIN_VERSION} ]]; then
1930 SRC_URI="${SRC_URI}
1931 suhosin? ( ${SUHOSIN_URI} )"
1932 fi
1933
1934 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs."
1935 HOMEPAGE="http://php.net/"
1936 LICENSE="PHP-3"
1937
1938 S="${WORKDIR}/${PHP_P}"
1939
1940 # We can build the following SAPIs in the given order
1941 SAPIS="embed cli cgi fpm apache2"
1942
1943 # Gentoo-specific, common features
1944 IUSE="kolab"
1945
1946 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
1947 IUSE="${IUSE}
1948 ${SAPIS/cli/+cli}
1949 threads"
1950
1951 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
1952 crypt +ctype curl curlwrappers debug doc
1953 enchant exif frontbase +fileinfo +filter firebird
1954 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
1955 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
1956 mssql mysql mysqlnd mysqli nls
1957 oci8-instant-client odbc pcntl pdo +phar pic +posix postgres qdbm
1958 readline recode selinux +session sharedmem
1959 +simplexml snmp soap sockets spell sqlite ssl
1960 sybase-ct sysvipc tidy +tokenizer truetype unicode wddx
1961 +xml xmlreader xmlwriter xmlrpc xpm xsl zip zlib"
1962
1963 # Enable suhosin if available
1964 [[ -n $SUHOSIN_VERSION ]] && IUSE="${IUSE} suhosin"
1965
1966 DEPEND="
1967 >=app-admin/eselect-php-0.6.2
1968 >=dev-libs/libpcre-8.12[unicode]
1969 apache2? ( www-servers/apache[threads=] )
1970 berkdb? ( =sys-libs/db-4* )
1971 bzip2? ( app-arch/bzip2 )
1972 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
1973 cjk? ( !gd? (
1974 virtual/jpeg
1975 media-libs/libpng
1976 sys-libs/zlib
1977 ) )
1978 crypt? ( >=dev-libs/libmcrypt-2.4 )
1979 curl? ( >=net-misc/curl-7.10.5 )
1980 enchant? ( app-text/enchant )
1981 exif? ( !gd? (
1982 virtual/jpeg
1983 media-libs/libpng
1984 sys-libs/zlib
1985 ) )
1986 firebird? ( dev-db/firebird )
1987 gd? ( virtual/jpeg media-libs/libpng sys-libs/zlib )
1988 gdbm? ( >=sys-libs/gdbm-1.8.0 )
1989 gmp? ( >=dev-libs/gmp-4.1.2 )
1990 iconv? ( virtual/libiconv )
1991 imap? ( virtual/imap-c-client[ssl=] )
1992 intl? ( dev-libs/icu )
1993 iodbc? ( dev-db/libiodbc )
1994 kerberos? ( virtual/krb5 )
1995 kolab? ( >=net-libs/c-client-2004g-r1 )
1996 ldap? ( >=net-nds/openldap-1.2.11 )
1997 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
1998 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
1999 mssql? ( dev-db/freetds[mssql] )
2000 !mysqlnd? (
2001 mysql? ( virtual/mysql )
2002 mysqli? ( >=virtual/mysql-4.1 )
2003 )
2004 nls? ( sys-devel/gettext )
2005 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
2006 odbc? ( >=dev-db/unixODBC-1.8.13 )
2007 postgres? ( dev-db/postgresql-base )
2008 qdbm? ( dev-db/qdbm )
2009 readline? ( sys-libs/readline )
2010 recode? ( app-text/recode )
2011 sharedmem? ( dev-libs/mm )
2012 simplexml? ( >=dev-libs/libxml2-2.6.8 )
2013 snmp? ( >=net-analyzer/net-snmp-5.2 )
2014 soap? ( >=dev-libs/libxml2-2.6.8 )
2015 spell? ( >=app-text/aspell-0.50 )
2016 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
2017 ssl? ( >=dev-libs/openssl-0.9.7 )
2018 sybase-ct? ( dev-db/freetds )
2019 tidy? ( app-text/htmltidy )
2020 truetype? (
2021 =media-libs/freetype-2*
2022 >=media-libs/t1lib-5.0.0
2023 !gd? (
2024 virtual/jpeg media-libs/libpng sys-libs/zlib )
2025 )
2026 unicode? ( dev-libs/oniguruma )
2027 wddx? ( >=dev-libs/libxml2-2.6.8 )
2028 xml? ( >=dev-libs/libxml2-2.6.8 )
2029 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
2030 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
2031 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
2032 xpm? (
2033 x11-libs/libXpm
2034 virtual/jpeg
2035 media-libs/libpng sys-libs/zlib
2036 )
2037 xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
2038 zip? ( sys-libs/zlib )
2039 zlib? ( sys-libs/zlib )
2040 virtual/mta
2041 "
2042
2043 php="=${CATEGORY}/${PF}"
2044
2045 REQUIRED_USE="
2046 truetype? ( gd )
2047 cjk? ( gd )
2048 exif? ( gd )
2049
2050 xpm? ( gd )
2051 gd? ( zlib )
2052 simplexml? ( xml )
2053 soap? ( xml )
2054 wddx? ( xml )
2055 xmlrpc? ( || ( xml iconv ) )
2056 xmlreader? ( xml )
2057 xsl? ( xml )
2058 ldap-sasl? ( ldap )
2059 kolab? ( imap )
2060 mhash? ( hash )
2061 phar? ( hash )
2062 mysqlnd? ( || (
2063 mysql
2064 mysqli
2065 pdo
2066 ) )
2067
2068 qdbm? ( !gdbm )
2069 readline? ( !libedit )
2070 recode? ( !imap !mysql !mysqli )
2071 sharedmem? ( !threads )
2072
2073 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
2074
2075 RDEPEND="${DEPEND}"
2076
2077 [[ -n $SUHOSIN_VERSION ]] && RDEPEND="${RDEPEND} suhosin? (
2078 =${CATEGORY}/${PN}-${SLOT}*[unicode] )"
2079
2080 RDEPEND="${RDEPEND} fpm? ( selinux? ( sec-policy/selinux-phpfpm ) )"
2081
2082 DEPEND="${DEPEND}
2083 sys-devel/flex
2084 >=sys-devel/m4-1.4.3
2085 >=sys-devel/libtool-1.5.18"
2086
2087 # They are in PDEPEND because we need PHP installed first!
2088 PDEPEND="doc? ( app-doc/php-docs )"
2089
2090 # No longer depend on the extension. The suhosin USE flag only installs the
2091 # patch
2092 #[[ -n $SUHOSIN_VERSION ]] && PDEPEND="${PDEPEND} suhosin? ( dev-php${PHP_MV}/suhosin )"
2093
2094 # Allow users to install production version if they want to
2095
2096 case "${PHP_INI_VERSION}" in
2097 production|development)
2098 ;;
2099 *)
2100 PHP_INI_VERSION="development"
2101 ;;
2102 esac
2103
2104 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
2105 PHP_INI_FILE="php.ini"
2106
2107 want_apache
2108
2109 pkg_setup() {
2110 depend.apache_pkg_setup
2111 }
2112
2113 php_install_ini() {
2114 local phpsapi="${1}"
2115
2116 # work out where we are installing the ini file
2117 php_set_ini_dir "${phpsapi}"
2118
2119 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
2120 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
2121
2122 # default to /tmp for save_path, bug #282768
2123 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
2124
2125 # Set the extension dir
2126 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
2127
2128 # Set the include path to point to where we want to find PEAR packages
2129 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
2130
2131 dodir "${PHP_INI_DIR#${EPREFIX}}"
2132 insinto "${PHP_INI_DIR#${EPREFIX}}"
2133 newins "${phpinisrc}" "${PHP_INI_FILE}"
2134
2135 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
2136 elog
2137
2138 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
2139 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
2140
2141 # SAPI-specific handling
2142 if [[ "${sapi}" == "apache2" ]] ; then
2143 insinto "${APACHE_MODULES_CONFDIR#${EPREFIX}}"
2144 newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
2145 "70_mod_php${PHP_MV}.conf"
2146 fi
2147
2148 if [[ "${sapi}" == "fpm" ]] ; then
2149 [[ -z ${PHP_FPM_INIT_VER} ]] && PHP_FPM_INIT_VER=3
2150 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
2151 einfo "Installing FPM CGI config file php-fpm.conf"
2152 insinto "${PHP_INI_DIR#${EPREFIX}}"
2153 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
2154 dodir "/etc/init.d"
2155 insinto "/etc/init.d"
2156 newinitd "${FILESDIR}/php-fpm-r${PHP_FPM_INIT_VER}.init" "php-fpm"
2157 # dosym "${PHP_DESTDIR#${EPREFIX}}/bin/php-fpm" "/usr/bin/php-fpm"
2158
2159 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
2160 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
2161 fi
2162
2163 # Install PHP ini files into /usr/share/php
2164 if [[ ${SLOT} == '5.2' ]]; then
2165 newdoc php.ini-dist php.ini-development
2166 newdoc php.ini-recommended php.ini-production
2167 fi
2168
2169 if [[ ${SLOT} == '5.3' ]]; then
2170 dodoc php.ini-development
2171 dodoc php.ini-production
2172 fi
2173
2174 if [[ ${SLOT} == '5.4' ]]; then
2175 dodoc php.ini-development
2176 dodoc php.ini-production
2177 fi
2178
2179 }
2180
2181 php_set_ini_dir() {
2182 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
2183 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
2184 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
2185 }
2186
2187 src_prepare() {
2188 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
2189 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
2190 # there is no easy way to circumvent that, all php calls during
2191 # install use -n, so no php.ini file will be used.
2192 # As such, this is the easiest way to get around
2193 addpredict /session_mm_cli250.sem
2194 addpredict /session_mm_cli0.sem
2195
2196 # kolab support (support for imap annotations)
2197 use kolab && epatch "${WORKDIR}/patches/opt/imap-kolab-annotations.patch"
2198
2199 # Change PHP branding
2200 # Get the alpha/beta/rc version
2201 local ver=$(get_version_component_range 3)
2202 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
2203 -i configure.in || die "Unable to change PHP branding"
2204
2205 # Apply generic PHP patches
2206 EPATCH_SOURCE="${WORKDIR}/patches/generic" EPATCH_SUFFIX="patch" \
2207 EPATCH_FORCE="yes" \
2208 EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
2209
2210 # Patch PHP to show Gentoo as the server platform
2211 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
2212 -i configure.in || die "Failed to fix server platform name"
2213
2214 # Prevent PHP from activating the Apache config,
2215 # as we will do that ourselves
2216 sed -i \
2217 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
2218 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
2219 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
2220
2221 # Patch PHP to support heimdal instead of mit-krb5
2222 if has_version "app-crypt/heimdal" ; then
2223 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
2224 || die "Failed to fix heimdal libname"
2225 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
2226 || die "Failed to fix heimdal crypt library reference"
2227 fi
2228
2229 # Suhosin support
2230 if [[ -n $SUHOSIN_VERSION ]] ; then
2231 if use suhosin ; then
2232 epatch "${WORKDIR}/${SUHOSIN_PATCH}"
2233 fi
2234 else
2235 ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
2236 fi
2237
2238 #Add user patches #357637
2239 epatch_user
2240
2241 #force rebuilding aclocal.m4
2242 rm aclocal.m4
2243 eautoreconf
2244
2245 if [[ ${CHOST} == *-darwin* ]] ; then
2246 # http://bugs.php.net/bug.php?id=48795, bug #343481
2247 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
2248 fi
2249 }
2250
2251 src_configure() {
2252 addpredict /usr/share/snmp/mibs/.index
2253 addpredict /var/lib/net-snmp/mib_indexes
2254
2255 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
2256
2257 # This is a global variable and should be in caps. It isn't because the
2258 # phpconfutils eclass relies on exactly this name...
2259 # for --with-libdir see bug #327025
2260 my_conf="
2261 --prefix="${PHP_DESTDIR}"
2262 --mandir="${PHP_DESTDIR}"/man
2263 --infodir="${PHP_DESTDIR}"/info
2264 --libdir="${PHP_DESTDIR}"/lib
2265 --with-libdir=$(get_libdir)
2266 --without-pear
2267 $(use_enable threads maintainer-zts)"
2268
2269 # extension USE flag shared
2270 my_conf+="
2271 $(use_enable bcmath bcmath )
2272 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
2273 $(use_enable calendar calendar )
2274 $(use_enable ctype ctype )
2275 $(use_with curl curl "${EPREFIX}"/usr)
2276 $(use_with curlwrappers curlwrappers "${EPREFIX}"/usr)
2277 $(use_enable xml dom )
2278 $(use_with enchant enchant "${EPREFIX}"/usr)
2279 $(use_enable exif exif )
2280 $(use_enable fileinfo fileinfo )
2281 $(use_enable filter filter )
2282 $(use_enable ftp ftp )
2283 $(use_with nls gettext "${EPREFIX}"/usr)
2284 $(use_with gmp gmp "${EPREFIX}"/usr)
2285 $(use_enable hash hash )
2286 $(use_with mhash mhash "${EPREFIX}"/usr)
2287 $(use_with iconv iconv )
2288 $(use_enable intl intl )
2289 $(use_enable ipv6 ipv6 )
2290 $(use_enable json json )
2291 $(use_with kerberos kerberos "${EPREFIX}"/usr)
2292 $(use_enable xml libxml )
2293 $(use_with xml libxml-dir "${EPREFIX}"/usr)
2294 $(use_enable unicode mbstring )
2295 $(use_with crypt mcrypt "${EPREFIX}"/usr)
2296 $(use_with mssql mssql "${EPREFIX}"/usr)
2297 $(use_with unicode onig "${EPREFIX}"/usr)
2298 $(use_with ssl openssl "${EPREFIX}"/usr)
2299 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
2300 $(use_enable pcntl pcntl )
2301 $(use_enable phar phar )
2302 $(use_enable pdo pdo )
2303 $(use_with postgres pgsql "${EPREFIX}"/usr)
2304 $(use_enable posix posix )
2305 $(use_with spell pspell "${EPREFIX}"/usr)
2306 $(use_with recode recode "${EPREFIX}"/usr)
2307 $(use_enable simplexml simplexml )
2308 $(use_enable sharedmem shmop )
2309 $(use_with snmp snmp "${EPREFIX}"/usr)
2310 $(use_enable soap soap )
2311 $(use_enable sockets sockets )
2312 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
2313 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
2314 $(use_enable sysvipc sysvmsg )
2315 $(use_enable sysvipc sysvsem )
2316 $(use_enable sysvipc sysvshm )
2317 $(use_with tidy tidy "${EPREFIX}"/usr)
2318 $(use_enable tokenizer tokenizer )
2319 $(use_enable wddx wddx )
2320 $(use_enable xml xml )
2321 $(use_enable xmlreader xmlreader )
2322 $(use_enable xmlwriter xmlwriter )
2323 $(use_with xmlrpc xmlrpc)
2324 $(use_with xsl xsl "${EPREFIX}"/usr)
2325 $(use_enable zip zip )
2326 $(use_with zlib zlib "${EPREFIX}"/usr)
2327 $(use_enable debug debug )"
2328
2329 # DBA support
2330 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
2331 || use qdbm ; then
2332 my_conf="${my_conf} --enable-dba${shared}"
2333 fi
2334
2335 # DBA drivers support
2336 my_conf+="
2337 $(use_with cdb cdb)
2338 $(use_with berkdb db4 ${EPREFIX}/usr)
2339 $(use_enable flatfile flatfile )
2340 $(use_with gdbm gdbm ${EPREFIX}/usr)
2341 $(use_enable inifile inifile )
2342 $(use_with qdbm qdbm ${EPREFIX}/usr)"
2343
2344 # Support for the GD graphics library
2345 my_conf+="
2346 $(use_with truetype freetype-dir ${EPREFIX}/usr)
2347 $(use_with truetype t1lib ${EPREFIX}/usr)
2348 $(use_enable cjk gd-jis-conv )
2349 $(use_with gd jpeg-dir ${EPREFIX}/usr)
2350 $(use_with gd png-dir ${EPREFIX}/usr)
2351 $(use_with xpm xpm-dir ${EPREFIX}/usr)"
2352 # enable gd last, so configure can pick up the previous settings
2353 my_conf+="
2354 $(use_with gd gd)"
2355
2356 # IMAP support
2357 if use imap ; then
2358 my_conf+="
2359 $(use_with imap imap ${EPREFIX}/usr)
2360 $(use_with ssl imap-ssl ${EPREFIX}/usr)"
2361 fi
2362
2363 # Interbase/firebird support
2364
2365 if use firebird ; then
2366 my_conf+="
2367 $(use_with firebird interbase ${EPREFIX}/usr)"
2368 fi
2369
2370 # LDAP support
2371 if use ldap ; then
2372 my_conf+="
2373 $(use_with ldap ldap ${EPREFIX}/usr)
2374 $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
2375 fi
2376
2377 # MySQL support
2378 if use mysql ; then
2379 if use mysqlnd ; then
2380 my_conf+="
2381 $(use_with mysql mysql mysqlnd)"
2382 else
2383 my_conf+="
2384 $(use_with mysql mysql ${EPREFIX}/usr)"
2385 fi
2386 my_conf+="
2387 $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
2388 fi
2389
2390 # MySQLi support
2391 if use mysqlnd ; then
2392 my_conf+="
2393 $(use_with mysqli mysqli mysqlnd)"
2394 else
2395 my_conf+="
2396 $(use_with mysqli mysqli ${EPREFIX}/usr/bin/mysql_config)"
2397 fi
2398
2399 # ODBC support
2400 if use odbc ; then
2401 my_conf+="
2402 $(use_with odbc unixODBC ${EPREFIX}/usr)"
2403 fi
2404
2405 if use iodbc ; then
2406 my_conf+="
2407 $(use_with iodbc iodbc ${EPREFIX}/usr)"
2408 fi
2409
2410 # Oracle support
2411 if use oci8-instant-client ; then
2412 my_conf+="
2413 $(use_with oci8-instant-client oci8)"
2414 fi
2415
2416 # PDO support
2417 if use pdo ; then
2418 my_conf+="
2419 $(use_with mssql pdo-dblib )"
2420 if use mysqlnd ; then
2421 my_conf+="
2422 $(use_with mysql pdo-mysql mysqlnd)"
2423 else
2424 my_conf+="
2425 $(use_with mysql pdo-mysql ${EPREFIX}/usr)"
2426 fi
2427 my_conf+="
2428 $(use_with postgres pdo-pgsql )
2429 $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
2430 $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
2431 if use oci8-instant-client ; then
2432 my_conf+="
2433 $(use_with oci8-instant-client pdo-oci)"
2434 fi
2435 fi
2436
2437 # readline/libedit support
2438 my_conf+="
2439 $(use_with readline readline ${EPREFIX}/usr)
2440 $(use_with libedit libedit ${EPREFIX}/usr)"
2441
2442 # Session support
2443 if use session ; then
2444 my_conf+="
2445 $(use_with sharedmem mm ${EPREFIX}/usr)"
2446 else
2447 my_conf+="
2448 $(use_enable session session )"
2449 fi
2450
2451 if use pic ; then
2452 my_conf="${my_conf} --with-pic"
2453 fi
2454
2455 # we use the system copy of pcre
2456 # --with-pcre-regex affects ext/pcre
2457 # --with-pcre-dir affects ext/filter and ext/zip
2458 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
2459
2460 # Catch CFLAGS problems
2461 # Fixes bug #14067.
2462 # Changed order to run it in reverse for bug #32022 and #12021.
2463 replace-cpu-flags "k6*" "i586"
2464
2465 # Support user-passed configuration parameters
2466 my_conf="${my_conf} ${EXTRA_ECONF:-}"
2467
2468 # Support the Apache2 extras, they must be set globally for all
2469 # SAPIs to work correctly, especially for external PHP extensions
2470
2471 mkdir -p "${WORKDIR}/sapis-build"
2472 for one_sapi in $SAPIS ; do
2473 use "${one_sapi}" || continue
2474 php_set_ini_dir "${one_sapi}"
2475
2476 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
2477 cd "${WORKDIR}/sapis-build/${one_sapi}"
2478
2479 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
2480 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
2481
2482 for sapi in $SAPIS ; do
2483 case "$sapi" in
2484 cli|cgi|embed|fpm)
2485 if [[ "${one_sapi}" == "${sapi}" ]] ; then
2486 sapi_conf="${sapi_conf} --enable-${sapi}"
2487 else
2488 sapi_conf="${sapi_conf} --disable-${sapi}"
2489 fi
2490 ;;
2491
2492 apache2)
2493 if [[ "${one_sapi}" == "${sapi}" ]] ; then
2494 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
2495 else
2496 sapi_conf="${sapi_conf} --without-apxs2"
2497 fi
2498 ;;
2499 esac
2500 done
2501
2502 econf ${sapi_conf}
2503 done
2504 }
2505
2506 src_compile() {
2507 # snmp seems to run during src_compile, too (bug #324739)
2508 addpredict /usr/share/snmp/mibs/.index
2509 addpredict /var/lib/net-snmp/mib_indexes
2510
2511 for sapi in ${SAPIS} ; do
2512 if use "${sapi}"; then
2513 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
2514 emake || die "emake failed"
2515 fi
2516 done
2517 }
2518
2519 src_install() {
2520 # see bug #324739 for what happens when we don't have that
2521 addpredict /usr/share/snmp/mibs/.index
2522
2523 # grab the first SAPI that got built and install common files from there
2524 local first_sapi=""
2525 for sapi in $SAPIS ; do
2526 if use $sapi ; then
2527 first_sapi=$sapi
2528 break
2529 fi
2530 done
2531
2532 # Makefile forgets to create this before trying to write to it...
2533 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
2534
2535 # Install php environment (without any sapis)
2536 cd "${WORKDIR}/sapis-build/$first_sapi"
2537 emake INSTALL_ROOT="${D}" \
2538 install-build install-headers install-programs \
2539 || die "emake install failed"
2540
2541 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
2542
2543 # Create the directory where we'll put version-specific php scripts
2544 keepdir /usr/share/php${PHP_MV}
2545
2546 local sapi="", file=""
2547 local sapi_list=""
2548
2549 for sapi in ${SAPIS}; do
2550 if use "${sapi}" ; then
2551 einfo "Installing SAPI: ${sapi}"
2552 cd "${WORKDIR}/sapis-build/${sapi}"
2553
2554 if [[ "${sapi}" == "apache2" ]] ; then
2555 # We're specifically not using emake install-sapi as libtool
2556 # may cause unnecessary relink failures (see bug #351266)
2557 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
2558 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
2559 keepdir "/usr/$(get_libdir)/apache2/modules"
2560 else
2561 # needed each time, php_install_ini would reset it
2562 into "${PHP_DESTDIR#${EPREFIX}}"
2563 case "$sapi" in
2564 cli)
2565 source="sapi/cli/php"
2566 ;;
2567 cgi)
2568 source="sapi/cgi/php-cgi"
2569 ;;
2570 fpm)
2571 source="sapi/fpm/php-fpm"
2572 ;;
2573 embed)
2574 source="libs/libphp${PHP_MV}$(get_libname)"