add 5.2 eclass
Hanno Böck

Hanno Böck commited on 2010-08-11 01:00:30
Zeige 1 geänderte Dateien mit 734 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,734 @@
1
+# Copyright 1999-2007 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/eclass/php5_2-sapi.eclass,v 1.34 2010/07/23 19:53:30 ssuominen Exp $
4
+
5
+# ========================================================================
6
+# Based on robbat2's work on the php4 sapi eclass
7
+#
8
+# Author: Stuart Herbert <stuart@gentoo.org>
9
+# Author: Luca Longinotti <chtekk@gentoo.org>
10
+#
11
+# ========================================================================
12
+
13
+# @ECLASS: php5_2-sapi.eclass
14
+# @MAINTAINER:
15
+# Gentoo PHP team <php-bugs@gentoo.org>
16
+# @BLURB: Eclass for building different php-5.2 SAPI instances.
17
+# @DESCRIPTION:
18
+# Eclass for building different php-5.2 SAPI instances. Use it for the
19
+# new-style =dev-lang/php-5.2* ebuilds.
20
+
21
+
22
+PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase interbase msql oci8 sapdb solid sybase sybase-ct"
23
+
24
+WANT_AUTOCONF="latest"
25
+WANT_AUTOMAKE="latest"
26
+
27
+inherit db-use flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils php-common-r1
28
+
29
+# @ECLASS-VARIABLE: MY_PHP_P
30
+# @DESCRIPTION:
31
+# Set MY_PHP_P in the ebuild as needed to match tarball version.
32
+
33
+# @ECLASS-VARIABLE: PHP_PACKAGE
34
+# @DESCRIPTION:
35
+# We only set this variable if we are building a copy of php which can be
36
+# installed as a package in its own.
37
+# Copies of php which are compiled into other packages (e.g. php support
38
+# for the thttpd web server) don't need this variable.
39
+if [[ "${PHP_PACKAGE}" == 1 ]] ; then
40
+	HOMEPAGE="http://www.php.net/"
41
+	LICENSE="PHP-3"
42
+	SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2"
43
+	S="${WORKDIR}/${MY_PHP_P}"
44
+fi
45
+
46
+IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filter firebird flatfile ftp gd gd-external gdbm gmp hash iconv imap inifile interbase iodbc ipv6 java-external json kerberos ldap ldap-sasl libedit mcve mhash msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pic posix postgres qdbm readline reflection recode sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib"
47
+
48
+# these USE flags should have the correct dependencies
49
+DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 )
50
+		berkdb? ( =sys-libs/db-4* )
51
+		birdstep? ( >=dev-db/unixODBC-1.8.13 )
52
+		bzip2? ( app-arch/bzip2 )
53
+		cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
54
+		cjk? ( !gd? ( !gd-external? ( virtual/jpeg media-libs/libpng sys-libs/zlib ) ) )
55
+		crypt? ( >=dev-libs/libmcrypt-2.4 )
56
+		curl? ( >=net-misc/curl-7.10.5 )
57
+		db2? ( >=dev-db/unixODBC-1.8.13 )
58
+		dbmaker? ( >=dev-db/unixODBC-1.8.13 )
59
+		empress? ( >=dev-db/unixODBC-1.8.13 )
60
+		empress-bcs? ( >=dev-db/unixODBC-1.8.13 )
61
+		esoob? ( >=dev-db/unixODBC-1.8.13 )
62
+		exif? ( !gd? ( !gd-external? ( virtual/jpeg media-libs/libpng sys-libs/zlib ) ) )
63
+		fdftk? ( app-text/fdftk )
64
+		firebird? ( dev-db/firebird )
65
+		gd? ( virtual/jpeg media-libs/libpng sys-libs/zlib )
66
+		gd-external? ( media-libs/gd )
67
+		gdbm? ( >=sys-libs/gdbm-1.8.0 )
68
+		gmp? ( >=dev-libs/gmp-4.1.2 )
69
+		iconv? ( virtual/libiconv )
70
+		imap? ( virtual/imap-c-client )
71
+		iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 )
72
+		kerberos? ( virtual/krb5 )
73
+		ldap? ( !oci8? ( >=net-nds/openldap-1.2.11 ) )
74
+		ldap-sasl? ( !oci8? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) )
75
+		libedit? ( dev-libs/libedit )
76
+		mcve? ( >=dev-libs/openssl-0.9.7 )
77
+		mhash? ( app-crypt/mhash )
78
+		mssql? ( dev-db/freetds )
79
+		mysql? ( virtual/mysql )
80
+		mysqli? ( >=virtual/mysql-4.1 )
81
+		ncurses? ( sys-libs/ncurses )
82
+		nls? ( sys-devel/gettext )
83
+		oci8-instant-client? ( dev-db/oracle-instantclient-basic )
84
+		odbc? ( >=dev-db/unixODBC-1.8.13 )
85
+		postgres? ( || ( >=dev-db/libpq-7.1 ( app-admin/eselect-postgresql
86
+			>=dev-db/postgresql-base-7.1 ) ) )
87
+		qdbm? ( dev-db/qdbm )
88
+		readline? ( sys-libs/readline )
89
+		recode? ( app-text/recode )
90
+		sapdb? ( >=dev-db/unixODBC-1.8.13 )
91
+		sharedmem? ( dev-libs/mm )
92
+		simplexml? ( >=dev-libs/libxml2-2.6.8 )
93
+		snmp? ( >=net-analyzer/net-snmp-5.2 )
94
+		soap? ( >=dev-libs/libxml2-2.6.8 )
95
+		solid? ( >=dev-db/unixODBC-1.8.13 )
96
+		spell? ( >=app-text/aspell-0.50 )
97
+		sqlite? ( =dev-db/sqlite-2* pdo? ( =dev-db/sqlite-3* ) )
98
+		ssl? ( >=dev-libs/openssl-0.9.7 )
99
+		sybase? ( dev-db/freetds )
100
+		tidy? ( app-text/htmltidy )
101
+		truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 !gd? ( !gd-external? ( virtual/jpeg media-libs/libpng sys-libs/zlib ) ) )
102
+		wddx? ( >=dev-libs/libxml2-2.6.8 )
103
+		xml? ( >=dev-libs/libxml2-2.6.8 )
104
+		xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
105
+		xmlreader? ( >=dev-libs/libxml2-2.6.8 )
106
+		xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
107
+		xpm? ( x11-libs/libXpm virtual/jpeg media-libs/libpng sys-libs/zlib )
108
+		xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
109
+		zip? ( sys-libs/zlib )
110
+		zlib? ( sys-libs/zlib )
111
+		virtual/mta"
112
+
113
+# libswf conflicts with ming and should not
114
+# be installed with the new PHP ebuilds
115
+DEPEND="${DEPEND}
116
+		!media-libs/libswf"
117
+
118
+# simplistic for now
119
+RDEPEND="${DEPEND}"
120
+
121
+# those are only needed at compile-time
122
+DEPEND="${DEPEND}
123
+		>=sys-devel/m4-1.4.3
124
+		>=sys-devel/libtool-1.5.18"
125
+
126
+# Additional features
127
+#
128
+# They are in PDEPEND because we need PHP installed first!
129
+PDEPEND="doc? ( app-doc/php-docs )
130
+		filter? ( !dev-php5/pecl-filter )
131
+		java-external? ( dev-php5/php-java-bridge )
132
+		json? ( !dev-php5/pecl-json )
133
+		mcve? ( dev-php5/pecl-mcve )
134
+		pdo? ( !dev-php5/pecl-pdo )
135
+		suhosin? ( dev-php5/suhosin )
136
+		yaz? ( dev-php5/pecl-yaz )"
137
+
138
+# ========================================================================
139
+# php.ini Support
140
+# ========================================================================
141
+
142
+PHP_INI_FILE="php.ini"
143
+PHP_INI_UPSTREAM="php.ini-dist"
144
+
145
+# ========================================================================
146
+
147
+# @ECLASS-VARIABLE: PHP_PATCHSET_REV
148
+# @DESCRIPTION:
149
+# Provides PHP patchsets support.
150
+# This condition will help non php maintainers in fixing bugs and let them to
151
+# upload patchset tarballs somewhere else.
152
+if [[ ! -n ${PHP_PATCHSET_URI} ]]; then
153
+	SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2"
154
+else
155
+	SRC_URI="${SRC_URI} ${PHP_PATCHSET_URI}"
156
+fi
157
+
158
+# @ECLASS-VARIABLE: SUHOSIN_PATCH
159
+# @DESCRIPTION:
160
+# Tarball name for Suhosin patch (see http://www.suhosin.org/).
161
+# This feature will not be available in php if unset.
162
+[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )"
163
+
164
+
165
+# ========================================================================
166
+
167
+EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst
168
+
169
+# ========================================================================
170
+# INTERNAL FUNCTIONS
171
+# ========================================================================
172
+
173
+php5_2-sapi_check_use_flags() {
174
+	# Multiple USE dependencies
175
+	phpconfutils_use_depend_any "truetype" "gd" "gd" "gd-external"
176
+	phpconfutils_use_depend_any "cjk" "gd" "gd" "gd-external"
177
+	phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external"
178
+
179
+	# Simple USE dependencies
180
+	phpconfutils_use_depend_all "xpm"			"gd"
181
+	phpconfutils_use_depend_all "gd"			"zlib"
182
+	phpconfutils_use_depend_all "simplexml"			"xml"
183
+	phpconfutils_use_depend_all "soap"			"xml"
184
+	phpconfutils_use_depend_all "wddx"			"xml"
185
+	phpconfutils_use_depend_all "xmlrpc"			"xml"
186
+	phpconfutils_use_depend_all "xmlreader"			"xml"
187
+	phpconfutils_use_depend_all "xmlwriter"			"xml"
188
+	phpconfutils_use_depend_all "xsl"			"xml"
189
+	phpconfutils_use_depend_all "filter"			"pcre"
190
+	phpconfutils_use_depend_all "xmlrpc"			"iconv"
191
+	phpconfutils_use_depend_all "java-external"		"session"
192
+	phpconfutils_use_depend_all "ldap-sasl"			"ldap"
193
+	phpconfutils_use_depend_all "mcve"			"ssl"
194
+	phpconfutils_use_depend_all "suhosin"			"unicode"
195
+	phpconfutils_use_depend_all "adabas"			"odbc"
196
+	phpconfutils_use_depend_all "birdstep"			"odbc"
197
+	phpconfutils_use_depend_all "dbmaker"			"odbc"
198
+	phpconfutils_use_depend_all "empress-bcs"		"odbc" "empress"
199
+	phpconfutils_use_depend_all "empress"			"odbc"
200
+	phpconfutils_use_depend_all "esoob"			"odbc"
201
+	phpconfutils_use_depend_all "db2"			"odbc"
202
+	phpconfutils_use_depend_all "iodbc"			"odbc"
203
+	phpconfutils_use_depend_all "sapdb"			"odbc"
204
+	phpconfutils_use_depend_all "solid"			"odbc"
205
+	phpconfutils_use_depend_all "kolab"			"imap"
206
+
207
+	# Direct USE conflicts
208
+	phpconfutils_use_conflict "gd" "gd-external"
209
+	phpconfutils_use_conflict "oci8" "oci8-instant-client"
210
+	phpconfutils_use_conflict "oci8" "ldap-sasl"
211
+	phpconfutils_use_conflict "qdbm" "gdbm"
212
+	phpconfutils_use_conflict "readline" "libedit"
213
+	phpconfutils_use_conflict "recode" "mysql" "imap" "yaz" "kolab"
214
+	phpconfutils_use_conflict "sharedmem" "threads"
215
+	phpconfutils_use_conflict "firebird" "interbase"
216
+
217
+	# IMAP support
218
+	php_check_imap
219
+
220
+	# Mail support
221
+	php_check_mta
222
+
223
+	# PostgreSQL support
224
+	php_check_pgsql
225
+
226
+	# Oracle support
227
+	php_check_oracle_8
228
+
229
+	phpconfutils_warn_about_external_deps
230
+
231
+	export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}"
232
+}
233
+
234
+php5_2-sapi_set_php_ini_dir() {
235
+	PHP_INI_DIR="/etc/php52/${PHPSAPI}-php5"
236
+	PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
237
+	PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
238
+}
239
+
240
+php5_2-sapi_install_ini() {
241
+	destdir=/usr/$(get_libdir)/php52
242
+
243
+	# get the extension dir, if not already defined
244
+	[[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
245
+
246
+	# work out where we are installing the ini file
247
+	php5_2-sapi_set_php_ini_dir
248
+
249
+	cp "${PHP_INI_UPSTREAM}" "${PHP_INI_UPSTREAM}-${PHPSAPI}"
250
+	local phpinisrc="${PHP_INI_UPSTREAM}-${PHPSAPI}"
251
+
252
+	# Set the extension dir
253
+	einfo "Setting extension_dir in php.ini"
254
+	sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc}
255
+
256
+	# A patch for PHP for security
257
+	einfo "Securing fopen wrappers"
258
+	sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc}
259
+
260
+	# Set the include path to point to where we want to find PEAR packages
261
+	einfo "Setting correct include_path"
262
+	sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc}
263
+
264
+	# Add needed MySQL extensions charset configuration
265
+	local phpmycnfcharset=""
266
+
267
+	if [[ "${PHPSAPI}" == "cli" ]] ; then
268
+		phpmycnfcharset="`php_get_mycnf_charset cli`"
269
+		einfo "MySQL extensions charset for 'cli' SAPI is: ${phpmycnfcharset}"
270
+	elif [[ "${PHPSAPI}" == "cgi" ]] ; then
271
+		phpmycnfcharset="`php_get_mycnf_charset cgi-fcgi`"
272
+		einfo "MySQL extensions charset for 'cgi' SAPI is: ${phpmycnfcharset}"
273
+	elif [[ "${PHPSAPI}" == "apache2" ]] ; then
274
+		phpmycnfcharset="`php_get_mycnf_charset apache2handler`"
275
+		einfo "MySQL extensions charset for 'apache2' SAPI is: ${phpmycnfcharset}"
276
+	else
277
+		einfo "No supported SAPI found for which to get the MySQL charset."
278
+	fi
279
+
280
+	if [[ -n "${phpmycnfcharset}" ]] && [[ "${phpmycnfcharset}" != "empty" ]] ; then
281
+		einfo "Setting MySQL extensions charset to ${phpmycnfcharset}"
282
+		echo "" >> ${phpinisrc}
283
+		echo "; MySQL extensions default connection charset settings" >> ${phpinisrc}
284
+		echo "mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc}
285
+		echo "mysqli.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc}
286
+		echo "pdo_mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc}
287
+	else
288
+		echo "" >> ${phpinisrc}
289
+		echo "; MySQL extensions default connection charset settings" >> ${phpinisrc}
290
+		echo ";mysql.connect_charset = utf8" >> ${phpinisrc}
291
+		echo ";mysqli.connect_charset = utf8" >> ${phpinisrc}
292
+		echo ";pdo_mysql.connect_charset = utf8" >> ${phpinisrc}
293
+	fi
294
+
295
+	dodir ${PHP_INI_DIR}
296
+	insinto ${PHP_INI_DIR}
297
+	newins ${phpinisrc} ${PHP_INI_FILE}
298
+
299
+	dodir ${PHP_EXT_INI_DIR}
300
+	dodir ${PHP_EXT_INI_DIR_ACTIVE}
301
+
302
+	# Install any extensions built as shared objects
303
+	if use sharedext ; then
304
+		for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do
305
+			inifilename=${x/.so/.ini}
306
+			inifilename=`basename ${inifilename}`
307
+			echo "extension=`basename ${x}`" >> "${D}/${PHP_EXT_INI_DIR}/${inifilename}"
308
+			dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}"
309
+		done
310
+	fi
311
+}
312
+
313
+# ========================================================================
314
+# EXPORTED FUNCTIONS
315
+# ========================================================================
316
+
317
+# @FUNCTION: php5_2-sapi_pkg_setup
318
+# @DESCRIPTION:
319
+# Performs all the USE flag testing and magic before we do anything else.
320
+# This way saves a lot of time.
321
+php5_2-sapi_pkg_setup() {
322
+	php5_2-sapi_check_use_flags
323
+}
324
+
325
+# @FUNCTION: php5_2-sapi_src_unpack
326
+# @DESCRIPTION:
327
+# Takes care of unpacking, patching and autotools magic and disables
328
+# interactive tests.
329
+
330
+# @VARIABLE: PHP_EXTRA_BRANDING
331
+# @DESCRIPTION:
332
+# This variable allows an ebuild to add additional information like
333
+# snapshot dates to the version line.
334
+php5_2-sapi_src_unpack() {
335
+	cd "${S}"
336
+
337
+	[[ -z "${PHP_EXTRA_BRANDING}" ]] && PHP_EXTRA_BRANDING=""
338
+
339
+	# Change PHP branding
340
+	PHPPR=${PR/r/}
341
+	# >=php-5.2.4 has PHP_EXTRA_VERSION, previous had EXTRA_VERSION
342
+	sed -re "s|^(PHP_)?EXTRA_VERSION=\".*\"|\1EXTRA_VERSION=\"${PHP_EXTRA_BRANDING}-pl${PHPPR}-gentoo\"|g" -i configure.in \
343
+		|| die "Unable to change PHP branding to ${PHP_EXTRA_BRANDING}-pl${PHPPR}-gentoo"
344
+
345
+	# multilib-strict support
346
+	if [[ -n "${MULTILIB_PATCH}" ]] && [[ -f "${WORKDIR}/${MULTILIB_PATCH}" ]] ; then
347
+		epatch "${WORKDIR}/${MULTILIB_PATCH}"
348
+	else
349
+		ewarn "There is no multilib-strict patch available for this PHP release yet!"
350
+	fi
351
+
352
+	# Apply general PHP5 patches
353
+	if [[ -d "${WORKDIR}/${MY_PHP_PV}/php5" ]] ; then
354
+		EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/php5" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch
355
+	fi
356
+
357
+	# Apply version-specific PHP patches
358
+	if [[ -d "${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" ]] ; then
359
+		EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch
360
+	fi
361
+
362
+	# Patch PHP to show Gentoo as the server platform
363
+	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"
364
+
365
+	# Disable interactive make test
366
+	sed -e 's/'`echo "\!getenv('NO_INTERACTION')"`'/false/g' -i run-tests.php
367
+
368
+	# Stop PHP from activating the Apache config, as we will do that ourselves
369
+	for i in configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do
370
+		sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i}
371
+		sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i}
372
+	done
373
+
374
+	# Patch PHP to support heimdal instead of mit-krb5
375
+	if has_version "app-crypt/heimdal" ; then
376
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 || die "Failed to fix heimdal libname"
377
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 || die "Failed to fix heimdal crypt library reference"
378
+	fi
379
+
380
+	# Patch for PostgreSQL support
381
+	if use postgres ; then
382
+		sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths"
383
+	fi
384
+
385
+	# Suhosin support
386
+	if use suhosin ; then
387
+		if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then
388
+			epatch "${DISTDIR}/${SUHOSIN_PATCH}"
389
+		else
390
+			ewarn "There is no Suhosin patch available for this PHP release yet!"
391
+		fi
392
+	fi
393
+
394
+	# We are heavily patching autotools base files (configure.in) because
395
+	# of suhosin etc., so let's regenerate the whole stuff now
396
+
397
+	# work around divert() issues with newer autoconf #281697
398
+	if has_version '>=sys-devel/autoconf-2.64' ; then
399
+		sed -i -r \
400
+			-e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
401
+			$(grep -l divert $(find . -name '*.m4') configure.in) || die
402
+	fi
403
+
404
+	# eaclocal doesn't accept --force, so we try to force re-generation
405
+	# this way
406
+	rm aclocal.m4
407
+	eautoreconf --force -W no-cross
408
+
409
+}
410
+
411
+# @FUNCTION: php5_2-sapi_src_compile
412
+# @DESCRIPTION:
413
+# Takes care of compiling php according to USE flags set by user (and those automagically
414
+# enabled via phpconfutils eclass if unavoidable).
415
+php5_2-sapi_src_compile() {
416
+	destdir=/usr/$(get_libdir)/php52
417
+
418
+	php5_2-sapi_set_php_ini_dir
419
+
420
+	cd "${S}"
421
+
422
+	phpconfutils_init
423
+
424
+	my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE} --without-pear"
425
+
426
+	#				extension		USE flag		shared support?
427
+	phpconfutils_extension_enable	"bcmath"		"bcmath"		1
428
+	phpconfutils_extension_with	"bz2"			"bzip2"			1
429
+	phpconfutils_extension_enable	"calendar"		"calendar"		1
430
+	phpconfutils_extension_disable	"ctype"			"ctype"			0
431
+	phpconfutils_extension_with	"curl"			"curl"			1
432
+	phpconfutils_extension_with	"curlwrappers"		"curlwrappers"		0
433
+	phpconfutils_extension_enable	"dbase"			"dbase"			1
434
+	phpconfutils_extension_disable	"dom"			"xml"			0
435
+	phpconfutils_extension_enable	"exif"			"exif"			1
436
+	phpconfutils_extension_with	"fbsql"			"frontbase"		1
437
+	phpconfutils_extension_with	"fdftk"			"fdftk"			1 "/opt/fdftk-6.0"
438
+	phpconfutils_extension_disable	"filter"		"filter"		0
439
+	phpconfutils_extension_enable	"ftp"			"ftp"			1
440
+	phpconfutils_extension_with	"gettext"		"nls"			1
441
+	phpconfutils_extension_with	"gmp"			"gmp"			1
442
+	phpconfutils_extension_disable	"hash"			"hash"			0
443
+	phpconfutils_extension_without	"iconv"			"iconv"			0
444
+	phpconfutils_extension_disable	"ipv6"			"ipv6"			0
445
+	phpconfutils_extension_disable	"json"			"json"			0
446
+	phpconfutils_extension_with	"kerberos"		"kerberos"		0 "/usr"
447
+	phpconfutils_extension_disable	"libxml"		"xml"			0
448
+	phpconfutils_extension_enable	"mbstring"		"unicode"		1
449
+	phpconfutils_extension_with	"mcrypt"		"crypt"			1
450
+	phpconfutils_extension_with	"mhash"			"mhash"			1
451
+	phpconfutils_extension_with	"msql"			"msql"			1
452
+	phpconfutils_extension_with	"mssql"			"mssql"			1
453
+	phpconfutils_extension_with	"ncurses"		"ncurses"		1
454
+	phpconfutils_extension_with	"openssl"		"ssl"			0
455
+	phpconfutils_extension_with	"openssl-dir"		"ssl"			0 "/usr"
456
+	phpconfutils_extension_enable	"pcntl" 		"pcntl" 		1
457
+	phpconfutils_extension_without	"pcre-regex"		"pcre"			0
458
+	phpconfutils_extension_disable	"pdo"			"pdo"			0
459
+	phpconfutils_extension_with	"pgsql"			"postgres"		1
460
+	phpconfutils_extension_disable	"posix"			"posix"			0
461
+	phpconfutils_extension_with	"pspell"		"spell"			1
462
+	phpconfutils_extension_with	"recode"		"recode"		1
463
+	phpconfutils_extension_disable	"reflection"		"reflection"		0
464
+	phpconfutils_extension_disable	"simplexml"		"simplexml"		0
465
+	phpconfutils_extension_enable	"shmop"			"sharedmem"		0
466
+	phpconfutils_extension_with	"snmp"			"snmp"			1
467
+	phpconfutils_extension_enable	"soap"			"soap"			1
468
+	phpconfutils_extension_enable	"sockets"		"sockets"		1
469
+	phpconfutils_extension_disable	"spl"			"spl"			0
470
+	phpconfutils_extension_with	"sybase"		"sybase"		1
471
+	phpconfutils_extension_with	"sybase-ct"		"sybase-ct"		1
472
+	phpconfutils_extension_enable	"sysvmsg"		"sysvipc"		1
473
+	phpconfutils_extension_enable	"sysvsem"		"sysvipc"		1
474
+	phpconfutils_extension_enable	"sysvshm"		"sysvipc"		1
475
+	phpconfutils_extension_with	"tidy"			"tidy"			1
476
+	phpconfutils_extension_disable	"tokenizer"		"tokenizer"		0
477
+	phpconfutils_extension_enable	"wddx"			"wddx"			1
478
+	phpconfutils_extension_disable	"xml"			"xml"			0
479
+	phpconfutils_extension_disable	"xmlreader"		"xmlreader"		0
480
+	phpconfutils_extension_disable	"xmlwriter"		"xmlwriter"		0
481
+	phpconfutils_extension_with	"xmlrpc"		"xmlrpc"		1
482
+	phpconfutils_extension_with	"xsl"			"xsl"			1
483
+	phpconfutils_extension_enable	"zip"			"zip"			1
484
+	phpconfutils_extension_with	"zlib"			"zlib"			1
485
+	phpconfutils_extension_enable	"debug"			"debug"			0
486
+
487
+	# DBA support
488
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile || use qdbm ; then
489
+		my_conf="${my_conf} --enable-dba${shared}"
490
+	fi
491
+
492
+	# Tell PHP where the db.h is on FreeBSD
493
+#	if use berkdb ; then
494
+#		append-cppflags "-I$(db_includedir)"
495
+#	fi
496
+
497
+	# DBA drivers support
498
+	phpconfutils_extension_with 	"cdb"			"cdb"			0
499
+	phpconfutils_extension_with 	"db4"			"berkdb"		0
500
+	phpconfutils_extension_disable 	"flatfile"		"flatfile"		0
501
+	phpconfutils_extension_with 	"gdbm"			"gdbm"			0
502
+	phpconfutils_extension_disable 	"inifile"		"inifile"		0
503
+	phpconfutils_extension_with	"qdbm"			"qdbm"			0
504
+
505
+	# Support for the GD graphics library
506
+	if use gd-external || phpconfutils_usecheck gd-external ; then
507
+		phpconfutils_extension_with	"freetype-dir"	"truetype"		0 "/usr"
508
+		phpconfutils_extension_with	"t1lib"		"truetype"		0 "/usr"
509
+		phpconfutils_extension_enable	"gd-jis-conv"	"cjk" 			0
510
+		phpconfutils_extension_with 	"gd" 		"gd-external"		1 "/usr"
511
+	else
512
+		phpconfutils_extension_with	"freetype-dir"	"truetype"		0 "/usr"
513
+		phpconfutils_extension_with	"t1lib"		"truetype"		0 "/usr"
514
+		phpconfutils_extension_enable	"gd-jis-conv"	"cjk"			0
515
+		phpconfutils_extension_with	"jpeg-dir"	"gd"			0 "/usr"
516
+		phpconfutils_extension_with 	"png-dir" 	"gd" 			0 "/usr"
517
+		phpconfutils_extension_with 	"xpm-dir" 	"xpm" 			0 "/usr"
518
+		# enable gd last, so configure can pick up the previous settings
519
+		phpconfutils_extension_with 	"gd" 		"gd" 			0
520
+	fi
521
+
522
+	# IMAP support
523
+	if use imap || phpconfutils_usecheck imap ; then
524
+		phpconfutils_extension_with	"imap"		"imap"			1
525
+		phpconfutils_extension_with	"imap-ssl"	"ssl"			0
526
+	fi
527
+
528
+	# Interbase support
529
+	if use interbase ; then
530
+		my_conf="${my_conf} --with-interbase=/opt"
531
+	fi
532
+
533
+	# Firebird support - see Bug 186791
534
+	if use firebird ; then
535
+		my_conf="${my_conf} --with-interbase=/usr"
536
+	fi
537
+
538
+	# LDAP support
539
+	if use ldap || phpconfutils_usecheck ldap ; then
540
+		if use oci8 ; then
541
+			phpconfutils_extension_with	"ldap"		"ldap"		1 "${ORACLE_HOME}"
542
+		else
543
+			phpconfutils_extension_with	"ldap"		"ldap"		1
544
+			phpconfutils_extension_with	"ldap-sasl"	"ldap-sasl"	0
545
+		fi
546
+	fi
547
+
548
+	# MySQL support
549
+	if use mysql ; then
550
+		phpconfutils_extension_with	"mysql"			"mysql"		1 "/usr"
551
+		phpconfutils_extension_with	"mysql-sock"		"mysql"		0 "/var/run/mysqld/mysqld.sock"
552
+	fi
553
+
554
+	# MySQLi support
555
+	phpconfutils_extension_with		"mysqli"		"mysqli"	1 "/usr/bin/mysql_config"
556
+
557
+	# ODBC support
558
+	if use odbc || phpconfutils_usecheck odbc ; then
559
+		phpconfutils_extension_with	"unixODBC"		"odbc"		1 "/usr"
560
+
561
+		phpconfutils_extension_with	"adabas"		"adabas"	1
562
+		phpconfutils_extension_with	"birdstep"		"birdstep"	1
563
+		phpconfutils_extension_with	"dbmaker"		"dbmaker"	1
564
+		phpconfutils_extension_with	"empress"		"empress"	1
565
+		if use empress || phpconfutils_usecheck empress ; then
566
+			phpconfutils_extension_with	"empress-bcs"	"empress-bcs"	0
567
+		fi
568
+		phpconfutils_extension_with	"esoob"			"esoob"		1
569
+		phpconfutils_extension_with	"ibm-db2"		"db2"		1
570
+		phpconfutils_extension_with	"iodbc"			"iodbc"		1 "/usr"
571
+		phpconfutils_extension_with	"sapdb"			"sapdb"		1
572
+		phpconfutils_extension_with	"solid"			"solid"		1
573
+	fi
574
+
575
+	# Oracle support
576
+	if use oci8 ; then
577
+		phpconfutils_extension_with	"oci8"			"oci8"		1
578
+	fi
579
+	if use oci8-instant-client ; then
580
+		OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`"
581
+		OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`"
582
+		phpconfutils_extension_with	"oci8"			"oci8-instant-client"	1	"instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib"
583
+	fi
584
+
585
+	# PDO support
586
+	if use pdo || phpconfutils_usecheck pdo ; then
587
+		phpconfutils_extension_with		"pdo-dblib"	"mssql"		1
588
+		# The PDO-Firebird driver is broken and unmaintained upstream
589
+		# phpconfutils_extension_with	"pdo-firebird"	"firebird"		1
590
+		phpconfutils_extension_with		"pdo-mysql"	"mysql"		1 "/usr"
591
+		if use oci8 ; then
592
+			phpconfutils_extension_with	"pdo-oci"	"oci8"		1
593
+		fi
594
+		if use oci8-instant-client ; then
595
+			OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`"
596
+			OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`"
597
+			phpconfutils_extension_with	"pdo-oci"	"oci8-instant-client"	1	"instantclient,/usr,${OCI8IC_PKG}"
598
+		fi
599
+		phpconfutils_extension_with		"pdo-odbc"	"odbc"		1 "unixODBC,/usr"
600
+		phpconfutils_extension_with		"pdo-pgsql"	"postgres"	1
601
+		phpconfutils_extension_with		"pdo-sqlite"	"sqlite"	1 "/usr"
602
+	fi
603
+
604
+	# readline/libedit support
605
+	# You can use readline or libedit, but you can't use both
606
+	phpconfutils_extension_with			"readline"	"readline"	0
607
+	phpconfutils_extension_with			"libedit"	"libedit"	0
608
+
609
+	# Session support
610
+	if ! use session && ! phpconfutils_usecheck session ; then
611
+		phpconfutils_extension_disable		"session"	"session"	0
612
+	else
613
+		phpconfutils_extension_with		"mm"		"sharedmem"	0
614
+	fi
615
+
616
+	# SQLite support
617
+	if ! use sqlite && ! phpconfutils_usecheck sqlite ; then
618
+		phpconfutils_extension_without		"sqlite"	"sqlite"	0
619
+	else
620
+		phpconfutils_extension_with		"sqlite"	"sqlite"	0 "/usr"
621
+		phpconfutils_extension_enable		"sqlite-utf8"	"unicode"	0
622
+	fi
623
+
624
+	# Fix ELF-related problems
625
+	if use pic || phpconfutils_usecheck pic ; then
626
+		einfo "Enabling PIC support"
627
+		my_conf="${my_conf} --with-pic"
628
+	fi
629
+
630
+	# Catch CFLAGS problems
631
+	php_check_cflags
632
+
633
+	# multilib support
634
+	if [[ $(get_libdir) != lib ]] ; then
635
+		my_conf="--with-libdir=$(get_libdir) ${my_conf}"
636
+	fi
637
+
638
+	# Support user-passed configuration parameters
639
+	[[ -z "${EXTRA_ECONF}" ]] && EXTRA_ECONF=""
640
+
641
+	# Set the correct compiler for cross-compilation
642
+	tc-export CC
643
+
644
+	# We don't use econf, because we need to override all of its settings
645
+	./configure --prefix=${destdir} --host=${CHOST} --mandir=${destdir}/man --infodir=${destdir}/info --sysconfdir=/etc --cache-file=./config.cache ${my_conf} ${EXTRA_ECONF} || die "configure failed"
646
+	emake || die "make failed"
647
+}
648
+
649
+# @FUNCTION: php5_2-sapi_src_install
650
+# @DESCRIPTION:
651
+# Takes care of installing php (and its shared extensions if enabled).
652
+php5_2-sapi_src_install() {
653
+	destdir=/usr/$(get_libdir)/php52
654
+
655
+	cd "${S}"
656
+
657
+	addpredict /usr/share/snmp/mibs/.index
658
+
659
+	# Install PHP
660
+	emake -j1 INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed"
661
+
662
+	# Install missing header files
663
+	if use unicode || phpconfutils_usecheck unicode ; then
664
+		dodir ${destdir}/include/php/ext/mbstring
665
+		insinto ${destdir}/include/php/ext/mbstring
666
+		for x in `ls "${S}/ext/mbstring/"*.h` ; do
667
+			file=`basename ${x}`
668
+			doins ext/mbstring/${file}
669
+		done
670
+		dodir ${destdir}/include/php/ext/mbstring/oniguruma
671
+		insinto ${destdir}/include/php/ext/mbstring/oniguruma
672
+		for x in `ls "${S}/ext/mbstring/oniguruma/"*.h` ; do
673
+			file=`basename ${x}`
674
+			doins ext/mbstring/oniguruma/${file}
675
+		done
676
+		dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
677
+		insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl
678
+		for x in `ls "${S}/ext/mbstring/libmbfl/mbfl/"*.h` ; do
679
+			file=`basename ${x}`
680
+			doins ext/mbstring/libmbfl/mbfl/${file}
681
+		done
682
+	fi
683
+
684
+	# Get the extension dir, if not already defined
685
+	[[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`"
686
+
687
+	# And install the modules to it
688
+	if use sharedext ; then
689
+		for x in `ls "${S}/modules/"*.so | sort` ; do
690
+			module=`basename ${x}`
691
+			modulename=${module/.so/}
692
+			insinto "${PHPEXTDIR}"
693
+			einfo "Installing PHP ${modulename} extension"
694
+			doins "modules/${module}"
695
+		done
696
+	fi
697
+
698
+	# Generate the USE file for PHP
699
+	phpconfutils_generate_usefile
700
+
701
+	# Create the directory where we'll put php5-only php scripts
702
+	keepdir /usr/share/php5
703
+}
704
+
705
+# @FUNCTION: php5_2-sapi_pkg_postinst
706
+# @DESCRIPTION:
707
+# Provides important information to users after install is finished.
708
+php5_2-sapi_pkg_postinst() {
709
+	ewarn "If you have additional third party PHP extensions (such as"
710
+	ewarn "dev-php5/phpdbg) you may need to recompile them now."
711
+	ewarn
712
+
713
+	if use sharedext ; then
714
+		ewarn "Make sure to use etc-update or dispatch-conf so that extension-specific"
715
+		ewarn "ini files get merged properly"
716
+		ewarn
717
+	fi
718
+
719
+	if has kolab ${IUSE} && use kolab ; then
720
+		ewarn "Please note that kolab support is still experimental!"
721
+		ewarn "Issues specific to USE=kolab must be reported to Gentoo bugzilla only!"
722
+		ewarn
723
+		ewarn "Kolab groupware server requires annotations support for IMAP, which is enabled"
724
+		ewarn "by a third-party patch. Please do NOT report issues with the imap extension"
725
+		ewarn "to bugs.php.net until you have recompiled both PHP and net-libs/c-client"
726
+		ewarn "with USE=\"-kolab\" and confirmed that those issues still exist!"
727
+		ewarn
728
+	fi
729
+
730
+		ewarn "USE=\"pic\" slows down PHP but has to be enabled on setups where TEXTRELs"
731
+		ewarn "are disabled (e.g. when using PaX in the kernel). On hardened profiles this"
732
+		ewarn "USE flag is enabled automatically"
733
+		ewarn
734
+}
0 735