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

Contents of /trunk/prefix/eclass/php5_1-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: 25733 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_1-sapi.eclass,v 1.16 2006/01/28 15:49:28 chtekk Exp $
4 #
5 # ########################################################################
6 #
7 # eclass/php5_1-sapi.eclass
8 # Eclass for building different php5.1 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 msql oci8 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 fastbuild 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 msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pdo-external 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 tokenizer truetype vm-goto vm-switch wddx xml xmlreader 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 truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 )
94 wddx? ( >=dev-libs/libxml2-2.6.8 )
95 xml? ( >=dev-libs/libxml2-2.6.8 )
96 xmlreader? ( >=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_1-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"
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 "xpm" "gd"
172 confutils_use_depend_all "gd" "zlib"
173
174 # XML related extensions
175 confutils_use_depend_all "soap" "xml"
176 confutils_use_depend_all "simplexml" "xml"
177 confutils_use_depend_all "xsl" "xml"
178 confutils_use_depend_all "wddx" "xml"
179 confutils_use_depend_all "xmlreader" "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_8
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 # PDO can be built using the bundled code or the external PECL
213 # packages (dev-php5/pecl-pdo), but not both
214 confutils_use_conflict "pdo" "pdo-external"
215
216 # QDBM doesn't play nicely with GDBM
217 confutils_use_conflict "qdbm" "gdbm"
218
219 # Readline and libedit do the same thing; you can't have both
220 confutils_use_conflict "readline" "libedit"
221
222 # Recode is not liked
223 confutils_use_conflict "recode" "mysql" "imap" "nis"
224
225 # the MM extension isn't thread-safe
226 confutils_use_conflict "sharedmem" "threads"
227
228 # We can only have one Zend-VM option enabled at a time
229 confutils_use_conflict "vm-goto" "vm-switch"
230
231 confutils_warn_about_missing_deps
232 }
233
234 # ========================================================================
235 # EXPORTED FUNCTIONS
236 # ========================================================================
237
238 php5_1-sapi_pkg_setup() {
239 # let's do all the USE flag testing before we do anything else
240 # this way saves a lot of time
241
242 php5_1-sapi_check_awkward_uses
243 }
244
245 php5_1-sapi_src_unpack() {
246 if [ "${PHP_PACKAGE}" == 1 ] ; then
247 unpack ${A}
248 fi
249
250 cd "${S}"
251
252 # lib64 support
253 if [ -n "${LIB64_PATCH}" ] ; then
254 epatch "${WORKDIR}/${LIB64_PATCH}"
255 else
256 ewarn "There is no lib64 patch available for this PHP release yet!"
257 fi
258
259 # Patch PHP to show Gentoo as the server platform
260 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"
261
262 # Patch PHP to support heimdal instead of mit-krb5
263 if has_version "app-crypt/heimdal" ; then
264 sed -e "s|gssapi_krb5|gssapi|g" -i acinclude.m4 || die "Failed to fix heimdal libname"
265 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 || die "Failed to fix heimdal crypt lib"
266 fi
267
268 # Patch for PostgreSQL support
269 if use postgres ; then
270 sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths"
271 fi
272
273 # Disable interactive make test
274 sed -e 's/'`echo "\!getenv('NO_INTERACTION')"`'/false/g' -i run-tests.php
275
276 # Patch for session persistence bug
277 epatch "${FILESDIR}/5.1-any/php5-soap_persistence_session.diff"
278
279 # stop php from activating the apache config, as we will do that ourselves
280 for i in configure sapi/apache/config.m4 sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do
281 sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i}
282 sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i}
283 done
284
285 # imap support
286 use imap && epatch "${FILESDIR}/5.1-any/php5-imap-symlink.diff"
287
288 # iodbc support
289 use iodbc && epatch "${FILESDIR}/5.1-any/php5-iodbc-config.diff"
290 use iodbc && epatch "${FILESDIR}/5.1-any/php5-with-iodbc.diff"
291
292 # hardenedphp support
293 if use hardenedphp ; then
294 if [ -n "${HARDENEDPHP_PATCH}" ] ; then
295 epatch "${DISTDIR}/${HARDENEDPHP_PATCH}"
296 else
297 ewarn "There is no Hardened-PHP available for this PHP release yet!"
298 fi
299 fi
300
301 # fastbuild support
302 use fastbuild && epatch "${FILESDIR}/5.1-any/php5-fastbuild.patch"
303
304 # fix problems compiling with apache2
305 if useq apache2 && ! useq threads ; then
306 epatch "${FILESDIR}/5.1-any/php5-prefork.patch"
307 fi
308
309 # fix configure scripts to correctly support HardenedPHP
310 einfo "Running aclocal"
311 WANT_AUTOMAKE=1.9 aclocal --force || die "Unable to run aclocal successfully"
312 einfo "Running libtoolize"
313 libtoolize --copy --force || die "Unable to run libtoolize successfully"
314
315 # rebuild configure to make sure it's up to date
316 einfo "Rebuilding configure script"
317 WANT_AUTOCONF=2.5 autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully"
318
319 # run elibtoolize
320 elibtoolize
321
322 # Just in case ;-)
323 chmod 755 configure || die "Failed to chmod configure to 755"
324 }
325
326 set_php_ini_dir() {
327 PHP_INI_DIR="/etc/php/${PHPSAPI}-php5"
328 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
329 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
330 }
331
332 php5_1-sapi_src_compile() {
333 destdir=/usr/$(get_libdir)/php5
334 set_php_ini_dir
335
336 cd "${S}"
337 confutils_init
338
339 my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE} --without-pear"
340
341 # extension USE flag shared support?
342 enable_extension_enable "bcmath" "bcmath" 1
343 enable_extension_with "bz2" "bzip2" 1
344 enable_extension_enable "calendar" "calendar" 1
345 enable_extension_disable "ctype" "ctype" 0
346 enable_extension_with "curl" "curl" 1
347 enable_extension_with "curlwrappers" "curlwrappers" 1
348 enable_extension_enable "dbase" "dbase" 1
349 enable_extension_disable "dom" "xml" 0
350 enable_extension_enable "exif" "exif" 1
351 enable_extension_with "fbsql" "frontbase" 1
352 enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0"
353 enable_extension_enable "filepro" "filepro" 1
354 enable_extension_enable "ftp" "ftp" 1
355 enable_extension_with "gettext" "nls" 1
356 enable_extension_with "gmp" "gmp" 1
357 enable_extension_with "hwapi" "hyperwave-api" 1
358 enable_extension_without "iconv" "iconv" 0
359 enable_extension_with "informix" "informix" 1
360 enable_extension_disable "ipv6" "ipv6" 0
361 # ircg extension not supported on Gentoo at this time
362 enable_extension_with "kerberos" "kerberos" 0 "/usr"
363 enable_extension_disable "libxml" "xml" 0
364 enable_extension_enable "mbstring" "nls" 1
365 enable_extension_with "mcrypt" "crypt" 1
366 enable_extension_enable "memory-limit" "memlimit" 0
367 enable_extension_with "mhash" "mhash" 1
368 enable_extension_with "ming" "ming" 1
369 enable_extension_with "msql" "msql" 1
370 enable_extension_with "mssql" "mssql" 1
371 enable_extension_with "ncurses" "ncurses" 1
372 enable_extension_with "oci8" "oci8" 1
373 enable_extension_with "oci8-instant-client" "oci8-instant-client" 1
374 enable_extension_with "openssl" "ssl" 1
375 enable_extension_with "openssl-dir" "ssl" 0 "/usr"
376 enable_extension_enable "pcntl" "pcntl" 1
377 enable_extension_without "pcre-regex" "pcre" 0
378 enable_extension_disable "pdo" "pdo" 1
379 enable_extension_with "pgsql" "postgres" 1
380 enable_extension_disable "posix" "posix" 1
381 enable_extension_with "pspell" "spell" 1
382 enable_extension_with "recode" "recode" 1
383 enable_extension_disable "simplexml" "simplexml" 1
384 enable_extension_enable "shmop" "sharedmem" 0
385 enable_extension_with "snmp" "snmp" 1
386 enable_extension_enable "soap" "soap" 1
387 enable_extension_enable "sockets" "sockets" 1
388 enable_extension_disable "spl" "spl" 1
389 enable_extension_with "sybase" "sybase" 1
390 enable_extension_with "sybase-ct" "sybase-ct" 1
391 enable_extension_enable "sysvmsg" "sysvipc" 1
392 enable_extension_enable "sysvsem" "sysvipc" 1
393 enable_extension_enable "sysvshm" "sysvipc" 1
394 enable_extension_with "tidy" "tidy" 1
395 enable_extension_disable "tokenizer" "tokenizer" 1
396 enable_extension_enable "wddx" "wddx" 1
397 enable_extension_disable "xml" "xml" 0
398 enable_extension_with "xmlreader" "xmlreader" 1
399 enable_extension_with "xmlrpc" "xmlrpc" 1
400 enable_extension_with "xsl" "xsl" 1
401 enable_extension_with "zlib" "zlib" 1
402 enable_extension_enable "debug" "debug" 0
403
404 # DBA support
405 enable_extension_enable "dba" "dba" 1
406
407 if useq dba ; then
408 enable_extension_with "cdb" "cdb" 1
409 enable_extension_with "db4" "berkdb" 1
410 enable_extension_with "flatfile" "flatfile" 1
411 enable_extension_with "gdbm" "gdbm" 1
412 enable_extension_with "inifile" "inifile" 1
413 enable_extension_with "qdbm" "qdbm" 1
414 fi
415
416 # support for the GD graphics library
417 if useq gd-external ; then
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 "gd" "gd-external" 1 "/usr"
423 else
424 enable_extension_with "freetype-dir" "truetype" 0 "/usr"
425 enable_extension_with "t1lib" "truetype" 0 "/usr"
426 enable_extension_enable "gd-jis-conv" "cjk" 0
427 enable_extension_enable "gd-native-ttf" "truetype" 0
428 enable_extension_with "jpeg-dir" "gd" 0 "/usr"
429 enable_extension_with "png-dir" "gd" 0 "/usr"
430 enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6"
431 # enable gd last, so configure can pick up the previous settings
432 enable_extension_with "gd" "gd" 0
433 fi
434
435 # IMAP support
436 if useq imap ; then
437 enable_extension_with "imap" "imap" 1
438 enable_extension_with "imap-ssl" "ssl" 0
439 fi
440
441 # Interbase support
442 if useq firebird || useq interbase ; then
443 my_conf="${my_conf} --with-interbase"
444 fi
445
446 # LDAP support
447 if useq ldap ; then
448 enable_extension_with "ldap" "ldap" 1
449 enable_extension_with "ldap-sasl" "sasl" 0
450 fi
451
452 # MySQL support
453 if useq mysql ; then
454 enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql"
455 enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
456 fi
457
458 # MySQLi support
459 enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
460
461 # ODBC support
462 if useq odbc ; then
463 enable_extension_with "unixODBC" "odbc" 1 "/usr"
464
465 enable_extension_with "adabas" "adabas" 1
466 enable_extension_with "birdstep" "birdstep" 1
467 enable_extension_with "dbmaker" "dbmaker" 1
468 enable_extension_with "empress" "empress" 1
469 if useq empress ; then
470 enable_extension_with "empress-bcs" "empress-bcs" 0
471 fi
472 enable_extension_with "esoob" "esoob" 1
473 enable_extension_with "ibm-db2" "db2" 1
474 enable_extension_with "iodbc" "iodbc" 1 "/usr"
475 enable_extension_with "sapdb" "sapdb" 1
476 enable_extension_with "solid" "solid" 1
477 fi
478
479 # PDO support
480 if useq pdo ; then
481 enable_extension_with "pdo-dblib" "mssql" 1
482 enable_extension_with "pdo-firebird" "firebird" 1
483 enable_extension_with "pdo-mysql" "mysql" 1 "/usr"
484 enable_extension_with "pdo-oci" "oci8" 1
485 if useq oci8-instant-client ; then
486 OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`"
487 OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`"
488 fi
489 enable_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}"
490 enable_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr"
491 enable_extension_with "pdo-pgsql" "postgres" 1
492 enable_extension_without "pdo-sqlite" "sqlite" 1
493 fi
494
495 # readline/libedit support
496 # you can use readline or libedit, but you can't use both
497 enable_extension_with "readline" "readline" 0
498 enable_extension_with "libedit" "libedit" 1
499
500 # session support
501 if ! useq session ; then
502 enable_extension_disable "session" "session" 1
503 else
504 enable_extension_with "mm" "sharedmem" 0
505 fi
506
507 # sqlite support
508 if ! useq sqlite ; then
509 enable_extension_without "sqlite" "sqlite" 0
510 else
511 enable_extension_enable "sqlite-utf8" "nls" 0
512 fi
513
514 # Zend-GOTO-VM support
515 if useq vm-goto ; then
516 my_conf="${my_conf} --with-zend-vm=GOTO"
517 fi
518
519 # Zend-SWITCH-VM support
520 if useq vm-switch ; then
521 my_conf="${my_conf} --with-zend-vm=SWITCH"
522 fi
523
524 # fix ELF-related problems
525 if useq pic ; then
526 einfo "Enabling PIC support"
527 my_conf="${my_conf} --with-pic"
528 fi
529
530 # apache2 & threads support
531 if useq apache2 && useq threads ; then
532 my_conf="${my_conf} --enable-maintainer-zts --enable-experimental-zts"
533 ewarn "Enabling ZTS for Apache2 MPM"
534 fi
535
536 # catch cflag problems
537 php_check_cflags
538
539 # multilib support
540 if [[ $(get_libdir) != lib ]] ; then
541 my_conf="--with-libdir=$(get_libdir) ${my_conf}"
542 fi
543
544 # all done
545
546 # we don't use econf, because we need to override all of its settings
547 ./configure --prefix=${destdir} --sysconfdir=/etc --cache-file=./config.cache ${my_conf} || die "configure failed"
548 emake || die "make failed"
549 }
550
551 php5_1-sapi_src_install() {
552 destdir=/usr/$(get_libdir)/php5
553
554 cd "${S}"
555 addpredict /usr/share/snmp/mibs/.index
556
557 PHP_INSTALLTARGETS="install-build install-headers install-programs"
558 useq sharedext && PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules"
559 make INSTALL_ROOT="${D}" ${PHP_INSTALLTARGETS} || die "install failed"
560
561 # install missing header files
562 if useq nls ; then
563 dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
564 insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
565 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
566 doins ext/mbstring/libmbfl/mbfl/${x}
567 done
568 fi
569
570 # get the extension dir
571 PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
572
573 # don't forget the php.ini file
574 local phpinisrc=php.ini-dist
575 einfo "Setting extension_dir in php.ini"
576 sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc}
577
578 # A patch for PHP for security. PHP-CLI interface is exempt, as it cannot be
579 # fed bad data from outside.
580 einfo "Securing fopen wrappers"
581 sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc}
582
583 # Set the include path to point to where we want to find PEAR packages
584 einfo "Setting correct include_path"
585 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc}
586
587 # create the directory where we'll put php5-only php scripts
588 keepdir /usr/share/php5
589 }
590
591 php5_1-sapi_install_ini() {
592 destdir=/usr/$(get_libdir)/php5
593
594 # get the extension dir
595 PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
596
597 # work out where we are installing the ini file
598 set_php_ini_dir
599
600 local phpinisrc=php.ini-dist
601
602 dodir ${PHP_INI_DIR}
603 insinto ${PHP_INI_DIR}
604 newins ${phpinisrc} ${PHP_INI_FILE}
605
606 dodir ${PHP_EXT_INI_DIR}
607 dodir ${PHP_EXT_INI_DIR_ACTIVE}
608
609 # Install any extensions built as shared objects
610 if useq sharedext ; then
611 for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do
612 inifilename=${x/.so/.ini}
613 inifilename=`basename ${inifilename}`
614 echo "extension=`basename ${x}`" >> "${D}/${PHP_EXT_INI_DIR}/${inifilename}"
615 dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}"
616 done
617 fi
618 }
619
620 php5_1-sapi_pkg_postinst() {
621 # Update Apache1 to use mod_php
622 if useq apache ; then
623 "${ROOT}/usr/sbin/php-select" -t apache1 php5 > /dev/null 2>&1
624 exitStatus=$?
625 if [[ ${exitStatus} == 2 ]] ; then
626 php-select apache1 php5
627 elif [[ ${exitStatus} == 4 ]] ; then
628 ewarn
629 ewarn "Apache 1 is configured to load a different version of PHP."
630 ewarn "To make Apache 1 use PHP v5, use php-select:"
631 ewarn
632 ewarn " php-select apache1 php5"
633 ewarn
634 fi
635 fi
636
637 # Update Apache2 to use mod_php
638 if useq apache2 ; then
639 "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1
640 exitStatus=$?
641 if [[ ${exitStatus} == 2 ]] ; then
642 php-select apache2 php5
643 elif [[ ${exitStatus} == 4 ]] ; then
644 ewarn
645 ewarn "Apache 2 is configured to load a different version of PHP."
646 ewarn "To make Apache 2 use PHP v5, use php-select:"
647 ewarn
648 ewarn " php-select apache2 php5"
649 ewarn
650 fi
651 fi
652
653 # Create the symlinks for php-cli
654 if useq cli ; then
655 "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1
656 exitStatus=$?
657 if [[ ${exitStatus} == 5 ]] ; then
658 php-select php php5
659 elif [[ ${exitStatus} == 4 ]] ; then
660 ewarn
661 ewarn "/usr/bin/php links to a different version of PHP."
662 ewarn "To make /usr/bin/php point to PHP v5, use php-select:"
663 ewarn
664 ewarn " php-select php php5"
665 ewarn
666 fi
667 fi
668
669 # Create the symlinks for php-cgi
670 if useq cgi ; then
671 "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1
672 exitStatus=$?
673 if [[ ${exitStatus} == 5 ]] ; then
674 php-select php-cgi php5
675 elif [[ ${exitStatus} == 4 ]] ; then
676 ewarn
677 ewarn "/usr/bin/php-cgi links to a different version of PHP."
678 ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:"
679 ewarn
680 ewarn " php-select php-cgi php5"
681 ewarn
682 fi
683 fi
684
685 # Create the symlinks for php-devel
686 "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1
687 exitStatus=$?
688 if [[ $exitStatus == 5 ]] ; then
689 php-select php-devel php5
690 elif [[ $exitStatus == 4 ]] ; then
691 ewarn
692 ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a"
693 ewarn "different version of PHP. To make them point to PHP v5, use"
694 ewarn "php-select:"
695 ewarn
696 ewarn " php-select php-devel php5"
697 ewarn
698 fi
699
700 ewarn "If you have additional third party PHP extensions (such as"
701 ewarn "dev-php5/phpdbg) you may need to recompile them now."
702 ewarn "A new way of enabling/disabling PHP extensions was introduced"
703 ewarn "with the newer PHP packages releases, so please reemerge any"
704 ewarn "PHP extensions you have installed to automatically adapt to"
705 ewarn "the new configuration layout."
706 if useq sharedext ; then
707 ewarn "The core PHP extensions are now loaded through external"
708 ewarn ".ini files, not anymore using a 'extension=name.so' line"
709 ewarn "in the php.ini file. Portage will take care of this by"
710 ewarn "creating new, updated config-files, please make sure to"
711 ewarn "install those using etc-update or dispatch-conf."
712 fi
713 ewarn
714
715 if useq curl; then
716 ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions."
717 ewarn "This can be a security risk!"
718 ewarn
719 fi
720
721 ewarn "The 'pic' USE flag was added to newer releases of dev-lang/php."
722 ewarn "With PIC enabled, your PHP installation may become slower, but"
723 ewarn "PIC is required on Hardened-Gentoo platforms (where the USE flag"
724 ewarn "is enabled automatically). You may also need this on other"
725 ewarn "configurations where you disabled TEXTRELs, for example using"
726 ewarn "PaX in the kernel."
727 ewarn
728
729 ewarn "With PHP 5.1, some extensions were removed from PHP because"
730 ewarn "they were unmaintained or moved to PECL. Our ebuilds reflect"
731 ewarn "this: the Oracle extension was removed ('oracle7' USE flag),"
732 ewarn "please use the 'oci8' USE flag for Oracle support now and/or"
733 ewarn "the PDO OCI8 driver, enabled if you set both the 'oci8' and"
734 ewarn "'pdo' USE flags. Also, the MCVE extension was moved to PECL"
735 ewarn "and thus can now be found in dev-php5/pecl-mcve. The Ovrimos"
736 ewarn "and Pfpro extensions were removed altogether and have no"
737 ewarn "available substitute."
738
739 ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE"
740 ewarn "flag. To get the features that were once controlled by the 'xml2'"
741 ewarn "USE flag, turn the 'xml' USE flag on."
742 ewarn
743 }

  ViewVC Help
Powered by ViewVC 1.1.20