/[gentoo-alt]/trunk/prefix/eclass/php5_0-sapi.eclass
Gentoo

Contents of /trunk/prefix/eclass/php5_0-sapi.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 24140 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/php5_0-sapi.eclass,v 1.14 2006/01/28 01:35:11 chtekk Exp $
4 #
5 # ########################################################################
6 #
7 # eclass/php5_0-sapi.eclass
8 # Eclass for building different php5.0 SAPI instances
9 #
10 # USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES
11 #
12 # Based on robbat2's work on the php4 sapi eclass
13 #
14 # Author(s) Stuart Herbert
15 # <stuart@gentoo.org>
16 #
17 # Luca Longinotti
18 # <chtekk@gentoo.org>
19 #
20 # ========================================================================
21
22 CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase mnogosearch msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct"
23 EBUILD_SUPPORTS_SHAREDEXT=1
24
25 inherit flag-o-matic eutils confutils libtool php-common-r1
26
27 # set MY_PHP_P in the ebuild
28
29 # we only set these variables if we're building a copy of php which can be
30 # installed as a package in its own right
31 #
32 # copies of php which are compiled into other packages (e.g. php support
33 # for the thttpd web server) don't need these variables
34
35 if [ "${PHP_PACKAGE}" = 1 ]; then
36 HOMEPAGE="http://www.php.net/"
37 LICENSE="PHP-3"
38 SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2"
39 S="${WORKDIR}/${MY_PHP_P}"
40 fi
41
42 IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dba dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external kerberos ldap libedit mcve memlimit mhash ming mnogosearch msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc oracle7 ovrimos pcntl pcre pdo-external pfpro pic posix postgres qdbm readline recode sapdb sasl session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl sybase sybase-ct sysvipc threads tidy tiff tokenizer truetype wddx xml xmlrpc xpm xsl yaz zip zlib"
43
44 # these USE flags should have the correct dependencies
45 DEPEND="${DEPEND}
46 !dev-php/php
47 !dev-php/php-cgi
48 !dev-php/mod_php
49 >=sys-devel/m4-1.4.3
50 >=sys-devel/libtool-1.5.18
51 >=sys-devel/automake-1.9.6
52 sys-devel/automake-wrapper
53 >=sys-devel/autoconf-2.59
54 sys-devel/autoconf-wrapper
55 berkdb? ( =sys-libs/db-4* )
56 bzip2? ( app-arch/bzip2 )
57 cdb? ( dev-db/cdb )
58 crypt? ( >=dev-libs/libmcrypt-2.4 )
59 curl? ( >=net-misc/curl-7.10.5 )
60 fdftk? ( app-text/fdftk )
61 firebird? ( dev-db/firebird )
62 gd? ( >=media-libs/jpeg-6b media-libs/libpng )
63 gd-external? ( media-libs/gd )
64 gdbm? ( >=sys-libs/gdbm-1.8.0 )
65 gmp? ( dev-libs/gmp )
66 imap? ( virtual/imap-c-client )
67 iodbc? ( dev-db/libiodbc )
68 kerberos? ( virtual/krb5 )
69 ldap? ( >=net-nds/openldap-1.2.11 )
70 libedit? ( dev-libs/libedit )
71 mhash? ( app-crypt/mhash )
72 ming? ( media-libs/ming )
73 mssql? ( dev-db/freetds )
74 mysql? ( dev-db/mysql )
75 mysqli? ( >=dev-db/mysql-4.1 )
76 ncurses? ( sys-libs/ncurses )
77 nls? ( sys-devel/gettext )
78 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
79 odbc? ( >=dev-db/unixODBC-1.8.13 )
80 postgres? ( >=dev-db/libpq-7.1 )
81 qdbm? ( dev-db/qdbm )
82 readline? ( sys-libs/readline )
83 recode? ( app-text/recode )
84 sasl? ( dev-libs/cyrus-sasl )
85 sharedmem? ( dev-libs/mm )
86 simplexml? ( >=dev-libs/libxml2-2.6.8 )
87 snmp? ( >=net-analyzer/net-snmp-5.2 )
88 soap? ( >=dev-libs/libxml2-2.6.8 )
89 spell? ( >=app-text/aspell-0.50 )
90 ssl? ( >=dev-libs/openssl-0.9.7 )
91 sybase? ( dev-db/freetds )
92 tidy? ( app-text/htmltidy )
93 tiff? ( media-libs/tiff )
94 truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 )
95 wddx? ( >=dev-libs/libxml2-2.6.8 )
96 xml? ( >=dev-libs/libxml2-2.6.8 )
97 xmlrpc? ( >=dev-libs/libxml2-2.6.8 )
98 xpm? ( || ( x11-libs/libXpm virtual/x11 ) )
99 xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
100 zlib? ( sys-libs/zlib )
101 virtual/mta"
102
103 # libswf conflicts with ming and should not
104 # be installed with the new PHP ebuilds
105 DEPEND="${DEPEND} !media-libs/libswf"
106
107 # simplistic for now
108 RDEPEND="${RDEPEND} ${DEPEND}"
109
110 # Additional features
111 #
112 # They are in PDEPEND because we need PHP installed first!
113 PDEPEND="${PDEPEND}
114 doc? ( app-doc/php-docs )
115 java-external? ( dev-php5/php-java-bridge )
116 mcve? ( dev-php5/pecl-mcve )
117 pdo-external? ( dev-php5/pecl-pdo )
118 yaz? ( dev-php5/pecl-yaz )
119 zip? ( dev-php5/pecl-zip )"
120
121 # ========================================================================
122 # php.ini Support
123 # ========================================================================
124
125 PHP_INI_FILE="php.ini"
126
127 # ========================================================================
128 # Hardened-PHP Support
129 # ========================================================================
130
131 [ -n "${HARDENEDPHP_PATCH}" ] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )"
132
133 # ========================================================================
134
135 EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst
136
137 # ========================================================================
138 # INTERNAL FUNCTIONS
139 # ========================================================================
140
141 php5_0-sapi_check_awkward_uses() {
142 # ------------------------------------
143 # Rules for things unexpectedly broken
144 # go below here
145 #
146 # These rules override the "normal"
147 # rules listed later on
148 # ------------------------------------
149
150 # No special rules at the moment
151
152 # ------------------------------------
153 # Normal rules go below here
154 # ------------------------------------
155
156 # A variety of extensions need DBA
157 confutils_use_depend_all "berkdb" "dba"
158 confutils_use_depend_all "cdb" "dba"
159 confutils_use_depend_all "flatfile" "dba"
160 confutils_use_depend_all "gdbm" "dba"
161 confutils_use_depend_all "inifile" "dba"
162 confutils_use_depend_all "qdbm" "dba"
163
164 # EXIF only gets built if we support a file format that uses it
165 confutils_use_depend_any "exif" "gd" "gd-external" "tiff"
166
167 # support for the GD graphics library
168 confutils_use_conflict "gd" "gd-external"
169 confutils_use_depend_any "truetype" "gd" "gd-external"
170 confutils_use_depend_any "cjk" "gd" "gd-external"
171 confutils_use_depend_all "tiff" "gd"
172 confutils_use_depend_all "xpm" "gd"
173 confutils_use_depend_all "gd" "zlib"
174
175 # XML related extensions
176 confutils_use_depend_all "soap" "xml"
177 confutils_use_depend_all "simplexml" "xml"
178 confutils_use_depend_all "xsl" "xml"
179 confutils_use_depend_all "wddx" "xml"
180
181 # IMAP support
182 php_check_imap
183
184 # Java-external support
185 confutils_use_depend_all "java-external" "session"
186
187 # Mail support
188 php_check_mta
189
190 # Oracle support
191 confutils_use_conflict "oci8" "oci8-instant-client"
192 php_check_oracle_all
193
194 # LDAP-sasl support
195 confutils_use_depend_all "sasl" "ldap"
196
197 # MCVE needs OpenSSL
198 confutils_use_depend_all "mcve" "ssl"
199
200 # ODBC support
201 confutils_use_depend_all "adabas" "odbc"
202 confutils_use_depend_all "birdstep" "odbc"
203 confutils_use_depend_all "dbmaker" "odbc"
204 confutils_use_depend_all "empress" "odbc"
205 confutils_use_depend_all "empress-bcs" "odbc" "empress"
206 confutils_use_depend_all "esoob" "odbc"
207 confutils_use_depend_all "db2" "odbc"
208 confutils_use_depend_all "iodbc" "odbc"
209 confutils_use_depend_all "sapdb" "odbc"
210 confutils_use_depend_all "solid" "odbc"
211
212 # QDBM doesn't play nicely with GDBM
213 confutils_use_conflict "qdbm" "gdbm"
214
215 # Readline and libedit do the same thing; you can't have both
216 confutils_use_conflict "readline" "libedit"
217
218 # Recode is not liked
219 confutils_use_conflict "recode" "mysql" "imap" "nis"
220
221 # the MM extension isn't thread-safe
222 confutils_use_conflict "sharedmem" "threads"
223
224 confutils_warn_about_missing_deps
225 }
226
227 # ========================================================================
228 # EXPORTED FUNCTIONS
229 # ========================================================================
230
231 php5_0-sapi_pkg_setup() {
232 # let's do all the USE flag testing before we do anything else
233 # this way saves a lot of time
234
235 php5_0-sapi_check_awkward_uses
236 }
237
238 php5_0-sapi_src_unpack() {
239 if [ "${PHP_PACKAGE}" == 1 ] ; then
240 unpack ${A}
241 fi
242
243 cd "${S}"
244
245 # lib64 support
246 if [ -n "${LIB64_PATCH}" ] ; then
247 epatch "${WORKDIR}/${LIB64_PATCH}"
248 else
249 ewarn "There is no lib64 patch available for this PHP release yet!"
250 fi
251
252 # Patch PHP to show Gentoo as the server platform
253 sed -e "s/PHP_UNAME=\`uname -a | xargs\`/PHP_UNAME=\`uname -s -n -r -v | xargs\`/g" -i configure.in || die "Failed to fix server platform name"
254
255 # Patch PHP to support heimdal instead of mit-krb5
256 if has_version "app-crypt/heimdal" ; then
257 sed -e "s|gssapi_krb5|gssapi|g" -i acinclude.m4 || die "Failed to fix heimdal libname"
258 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 || die "Failed to fix heimdal crypt lib"
259 fi
260
261 # Patch for PostgreSQL support
262 if use postgres ; then
263 sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths"
264 fi
265
266 # Disable interactive make test
267 sed -e 's/'`echo "\!getenv('NO_INTERACTION')"`'/false/g' -i run-tests.php
268
269 # Patch for session persistence bug
270 epatch "${FILESDIR}/5.0-any/php5-soap_persistence_session.diff"
271
272 # stop php from activating the apache config, as we will do that ourselves
273 for i in configure sapi/apache/config.m4 sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do
274 sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i}
275 sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i}
276 done
277
278 # imap support
279 use imap && epatch "${FILESDIR}/5.0-any/php5-imap-symlink.diff"
280
281 # iodbc support
282 use iodbc && epatch "${FILESDIR}/5.0-any/php5-iodbc-config.diff"
283 use iodbc && epatch "${FILESDIR}/5.0-any/php5-with-iodbc.diff"
284
285 # hardenedphp support
286 if use hardenedphp ; then
287 if [ -n "${HARDENEDPHP_PATCH}" ] ; then
288 epatch "${DISTDIR}/${HARDENEDPHP_PATCH}"
289 else
290 ewarn "There is no Hardened-PHP available for this PHP release yet!"
291 fi
292 fi
293
294 # fix problems compiling with apache2
295 if useq apache2 && ! useq threads ; then
296 epatch "${FILESDIR}/5.0-any/php5-prefork.patch"
297 fi
298
299 # fix configure scripts to correctly support HardenedPHP
300 # and patch PHP to support libtool 1.5
301 epatch "${FILESDIR}/5.0-any/php5-libtool-1.5.patch"
302 einfo "Running aclocal"
303 WANT_AUTOMAKE=1.9 aclocal --force || die "Unable to run aclocal successfully"
304 einfo "Running libtoolize"
305 libtoolize --copy --force || die "Unable to run libtoolize successfully"
306
307 # rebuild configure to make sure it's up to date
308 einfo "Rebuilding configure script"
309 WANT_AUTOCONF=2.5 autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully"
310
311 # run elibtoolize
312 elibtoolize
313
314 # Just in case ;-)
315 chmod 755 configure || die "Failed to chmod configure to 755"
316 }
317
318 set_php_ini_dir() {
319 PHP_INI_DIR="/etc/php/${PHPSAPI}-php5"
320 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
321 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
322 }
323
324 php5_0-sapi_src_compile() {
325 destdir=/usr/$(get_libdir)/php5
326 set_php_ini_dir
327
328 cd "${S}"
329 confutils_init
330
331 my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE} --without-pear"
332
333 # extension USE flag shared support?
334 enable_extension_enable "bcmath" "bcmath" 1
335 enable_extension_with "bz2" "bzip2" 1
336 enable_extension_enable "calendar" "calendar" 1
337 enable_extension_disable "ctype" "ctype" 0
338 enable_extension_with "curl" "curl" 1
339 enable_extension_with "curlwrappers" "curlwrappers" 1
340 enable_extension_enable "dbase" "dbase" 1
341 enable_extension_disable "dom" "xml" 0
342 enable_extension_enable "exif" "exif" 1
343 enable_extension_with "fbsql" "frontbase" 1
344 enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0"
345 enable_extension_enable "filepro" "filepro" 1
346 enable_extension_enable "ftp" "ftp" 1
347 enable_extension_with "gettext" "nls" 1
348 enable_extension_with "gmp" "gmp" 1
349 enable_extension_with "hwapi" "hyperwave-api" 1
350 enable_extension_without "iconv" "iconv" 0
351 enable_extension_with "informix" "informix" 1
352 enable_extension_disable "ipv6" "ipv6" 0
353 # ircg extension not supported on Gentoo at this time
354 enable_extension_with "kerberos" "kerberos" 0 "/usr"
355 enable_extension_disable "libxml" "xml" 0
356 enable_extension_enable "mbstring" "nls" 1
357 enable_extension_with "mcrypt" "crypt" 1
358 enable_extension_enable "memory-limit" "memlimit" 0
359 enable_extension_with "mhash" "mhash" 1
360 enable_extension_with "ming" "ming" 1
361 enable_extension_with "mnogosearch" "mnogosearch" 1
362 enable_extension_with "msql" "msql" 1
363 enable_extension_with "mssql" "mssql" 1
364 enable_extension_with "ncurses" "ncurses" 1
365 enable_extension_with "oci8" "oci8" 1
366 enable_extension_with "oci8-instant-client" "oci8-instant-client" 1
367 enable_extension_with "oracle" "oracle7" 1
368 enable_extension_with "openssl" "ssl" 1
369 enable_extension_with "openssl-dir" "ssl" 0 "/usr"
370 enable_extension_with "ovrimos" "ovrimos" 1
371 enable_extension_enable "pcntl" "pcntl" 1
372 enable_extension_without "pcre-regex" "pcre" 0
373 enable_extension_with "pfpro" "pfpro" 1
374 enable_extension_with "pgsql" "postgres" 1
375 enable_extension_disable "posix" "posix" 1
376 enable_extension_with "pspell" "spell" 1
377 enable_extension_with "recode" "recode" 1
378 enable_extension_disable "simplexml" "simplexml" 1
379 enable_extension_enable "shmop" "sharedmem" 0
380 enable_extension_with "snmp" "snmp" 1
381 enable_extension_enable "soap" "soap" 1
382 enable_extension_enable "sockets" "sockets" 1
383 enable_extension_disable "spl" "spl" 1
384 enable_extension_with "sybase" "sybase" 1
385 enable_extension_with "sybase-ct" "sybase-ct" 1
386 enable_extension_enable "sysvmsg" "sysvipc" 1
387 enable_extension_enable "sysvsem" "sysvipc" 1
388 enable_extension_enable "sysvshm" "sysvipc" 1
389 enable_extension_with "tidy" "tidy" 1
390 enable_extension_disable "tokenizer" "tokenizer" 1
391 enable_extension_enable "wddx" "wddx" 1
392 enable_extension_disable "xml" "xml" 0
393 enable_extension_with "xmlrpc" "xmlrpc" 1
394 enable_extension_with "xsl" "xsl" 1
395 enable_extension_with "zlib" "zlib" 1
396 enable_extension_enable "debug" "debug" 0
397
398 # DBA support
399 enable_extension_enable "dba" "dba" 1
400
401 if useq dba ; then
402 enable_extension_with "cdb" "cdb" 1
403 enable_extension_with "db4" "berkdb" 1
404 enable_extension_with "flatfile" "flatfile" 1
405 enable_extension_with "gdbm" "gdbm" 1
406 enable_extension_with "inifile" "inifile" 1
407 enable_extension_with "qdbm" "qdbm" 1
408 fi
409
410 # support for the GD graphics library
411 if useq gd-external ; then
412 enable_extension_with "freetype-dir" "truetype" 0 "/usr"
413 enable_extension_with "t1lib" "truetype" 0 "/usr"
414 enable_extension_enable "gd-jis-conv" "cjk" 0
415 enable_extension_enable "gd-native-ttf" "truetype" 0
416 enable_extension_with "gd" "gd-external" 1 "/usr"
417 else
418 enable_extension_with "freetype-dir" "truetype" 0 "/usr"
419 enable_extension_with "t1lib" "truetype" 0 "/usr"
420 enable_extension_enable "gd-jis-conv" "cjk" 0
421 enable_extension_enable "gd-native-ttf" "truetype" 0
422 enable_extension_with "jpeg-dir" "gd" 0 "/usr"
423 enable_extension_with "png-dir" "gd" 0 "/usr"
424 enable_extension_with "tiff-dir" "tiff" 0 "/usr"
425 enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6"
426 # enable gd last, so configure can pick up the previous settings
427 enable_extension_with "gd" "gd" 0
428 fi
429
430 # IMAP support
431 if useq imap ; then
432 enable_extension_with "imap" "imap" 1
433 enable_extension_with "imap-ssl" "ssl" 0
434 fi
435
436 # Interbase support
437 if useq firebird || useq interbase ; then
438 my_conf="${my_conf} --with-interbase"
439 fi
440
441 # LDAP support
442 if useq ldap ; then
443 enable_extension_with "ldap" "ldap" 1
444 enable_extension_with "ldap-sasl" "sasl" 0
445 fi
446
447 # MySQL support
448 if useq mysql ; then
449 enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql"
450 enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
451 fi
452
453 # MySQLi support
454 enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
455
456 # ODBC support
457 if useq odbc ; then
458 enable_extension_with "unixODBC" "odbc" 1 "/usr"
459
460 enable_extension_with "adabas" "adabas" 1
461 enable_extension_with "birdstep" "birdstep" 1
462 enable_extension_with "dbmaker" "dbmaker" 1
463 enable_extension_with "empress" "empress" 1
464 if useq empress ; then
465 enable_extension_with "empress-bcs" "empress-bcs" 0
466 fi
467 enable_extension_with "esoob" "esoob" 1
468 enable_extension_with "ibm-db2" "db2" 1
469 enable_extension_with "iodbc" "iodbc" 1 "/usr"
470 enable_extension_with "sapdb" "sapdb" 1
471 enable_extension_with "solid" "solid" 1
472 fi
473
474 # readline/libedit support
475 # you can use readline or libedit, but you can't use both
476 enable_extension_with "readline" "readline" 0
477 enable_extension_with "libedit" "libedit" 1
478
479 # session support
480 if ! useq session ; then
481 enable_extension_disable "session" "session" 1
482 else
483 enable_extension_with "mm" "sharedmem" 0
484 fi
485
486 # sqlite support
487 if ! useq sqlite ; then
488 enable_extension_without "sqlite" "sqlite" 0
489 else
490 enable_extension_enable "sqlite-utf8" "nls" 0
491 fi
492
493 # fix ELF-related problems
494 if useq pic ; then
495 einfo "Enabling PIC support"
496 my_conf="${my_conf} --with-pic"
497 fi
498
499 # apache2 & threads support
500 if useq apache2 && useq threads ; then
501 my_conf="${my_conf} --enable-maintainer-zts --enable-experimental-zts"
502 ewarn "Enabling ZTS for Apache2 MPM"
503 fi
504
505 # catch cflag problems
506 php_check_cflags
507
508 # multilib support
509 if [[ $(get_libdir) != lib ]] ; then
510 my_conf="--with-libdir=$(get_libdir) ${my_conf}"
511 fi
512
513 # all done
514
515 # we don't use econf, because we need to override all of its settings
516 ./configure --prefix=${destdir} --sysconfdir=/etc --cache-file=./config.cache ${my_conf} || die "configure failed"
517 emake || die "make failed"
518 }
519
520 php5_0-sapi_src_install() {
521 destdir=/usr/$(get_libdir)/php5
522
523 cd "${S}"
524 addpredict /usr/share/snmp/mibs/.index
525
526 PHP_INSTALLTARGETS="install-build install-headers install-programs"
527 useq sharedext && PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules"
528 make INSTALL_ROOT="${D}" ${PHP_INSTALLTARGETS} || die "install failed"
529
530 # install missing header files
531 if useq nls ; then
532 dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
533 insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
534 for x in mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h ; do
535 doins ext/mbstring/libmbfl/mbfl/${x}
536 done
537 fi
538
539 # get the extension dir
540 PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
541
542 # don't forget the php.ini file
543 local phpinisrc=php.ini-dist
544 einfo "Setting extension_dir in php.ini"
545 sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc}
546
547 # A patch for PHP for security. PHP-CLI interface is exempt, as it cannot be
548 # fed bad data from outside.
549 einfo "Securing fopen wrappers"
550 sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc}
551
552 # Set the include path to point to where we want to find PEAR packages
553 einfo "Setting correct include_path"
554 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc}
555
556 # create the directory where we'll put php5-only php scripts
557 keepdir /usr/share/php5
558 }
559
560 php5_0-sapi_install_ini() {
561 destdir=/usr/$(get_libdir)/php5
562
563 # get the extension dir
564 PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
565
566 # work out where we are installing the ini file
567 set_php_ini_dir
568
569 local phpinisrc=php.ini-dist
570
571 dodir ${PHP_INI_DIR}
572 insinto ${PHP_INI_DIR}
573 newins ${phpinisrc} ${PHP_INI_FILE}
574
575 dodir ${PHP_EXT_INI_DIR}
576 dodir ${PHP_EXT_INI_DIR_ACTIVE}
577
578 # Install any extensions built as shared objects
579 if useq sharedext ; then
580 for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do
581 inifilename=${x/.so/.ini}
582 inifilename=`basename ${inifilename}`
583 echo "extension=`basename ${x}`" >> "${D}/${PHP_EXT_INI_DIR}/${inifilename}"
584 dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}"
585 done
586 fi
587 }
588
589 php5_0-sapi_pkg_postinst() {
590 # Update Apache1 to use mod_php
591 if useq apache ; then
592 "${ROOT}/usr/sbin/php-select" -t apache1 php5 > /dev/null 2>&1
593 exitStatus=$?
594 if [[ ${exitStatus} == 2 ]] ; then
595 php-select apache1 php5
596 elif [[ ${exitStatus} == 4 ]] ; then
597 ewarn
598 ewarn "Apache 1 is configured to load a different version of PHP."
599 ewarn "To make Apache 1 use PHP v5, use php-select:"
600 ewarn
601 ewarn " php-select apache1 php5"
602 ewarn
603 fi
604 fi
605
606 # Update Apache2 to use mod_php
607 if useq apache2 ; then
608 "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1
609 exitStatus=$?
610 if [[ ${exitStatus} == 2 ]] ; then
611 php-select apache2 php5
612 elif [[ ${exitStatus} == 4 ]] ; then
613 ewarn
614 ewarn "Apache 2 is configured to load a different version of PHP."
615 ewarn "To make Apache 2 use PHP v5, use php-select:"
616 ewarn
617 ewarn " php-select apache2 php5"
618 ewarn
619 fi
620 fi
621
622 # Create the symlinks for php-cli
623 if useq cli ; then
624 "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1
625 exitStatus=$?
626 if [[ ${exitStatus} == 5 ]] ; then
627 php-select php php5
628 elif [[ ${exitStatus} == 4 ]] ; then
629 ewarn
630 ewarn "/usr/bin/php links to a different version of PHP."
631 ewarn "To make /usr/bin/php point to PHP v5, use php-select:"
632 ewarn
633 ewarn " php-select php php5"
634 ewarn
635 fi
636 fi
637
638 # Create the symlinks for php-cgi
639 if useq cgi ; then
640 "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1
641 exitStatus=$?
642 if [[ ${exitStatus} == 5 ]] ; then
643 php-select php-cgi php5
644 elif [[ ${exitStatus} == 4 ]] ; then
645 ewarn
646 ewarn "/usr/bin/php-cgi links to a different version of PHP."
647 ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:"
648 ewarn
649 ewarn " php-select php-cgi php5"
650 ewarn
651 fi
652 fi
653
654 # Create the symlinks for php-devel
655 "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1
656 exitStatus=$?
657 if [[ $exitStatus == 5 ]] ; then
658 php-select php-devel php5
659 elif [[ $exitStatus == 4 ]] ; then
660 ewarn
661 ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a"
662 ewarn "different version of PHP. To make them point to PHP v5, use"
663 ewarn "php-select:"
664 ewarn
665 ewarn " php-select php-devel php5"
666 ewarn
667 fi
668
669 ewarn "If you have additional third party PHP extensions (such as"
670 ewarn "dev-php5/phpdbg) you may need to recompile them now."
671 ewarn "A new way of enabling/disabling PHP extensions was introduced"
672 ewarn "with the newer PHP packages releases, so please reemerge any"
673 ewarn "PHP extensions you have installed to automatically adapt to"
674 ewarn "the new configuration layout."
675 if useq sharedext ; then
676 ewarn "The core PHP extensions are now loaded through external"
677 ewarn ".ini files, not anymore using a 'extension=name.so' line"
678 ewarn "in the php.ini file. Portage will take care of this by"
679 ewarn "creating new, updated config-files, please make sure to"
680 ewarn "install those using etc-update or dispatch-conf."
681 fi
682 ewarn
683
684 if useq curl; then
685 ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions."
686 ewarn "This can be a security risk!"
687 ewarn
688 fi
689
690 ewarn "The 'pic' USE flag was added to newer releases of dev-lang/php."
691 ewarn "With PIC enabled, your PHP installation may become slower, but"
692 ewarn "PIC is required on Hardened-Gentoo platforms (where the USE flag"
693 ewarn "is enabled automatically). You may also need this on other"
694 ewarn "configurations where you disabled TEXTRELs, for example using"
695 ewarn "PaX in the kernel."
696 ewarn
697
698 ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE"
699 ewarn "flag. To get the features that were once controlled by the 'xml2'"
700 ewarn "USE flag, turn the 'xml' USE flag on."
701 ewarn
702 }

  ViewVC Help
Powered by ViewVC 1.1.20