add php with pcre fix
Hanno Böck

Hanno Böck commited on 2008-11-13 12:01:40
Zeige 10 geänderte Dateien mit 628 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,18 @@
1
+# ChangeLog for dev-lang/php
2
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
3
+# $Header: $
4
+
5
+  23 Oct 2008; Christian Hoffmann <hoffie@gentoo.org> php-5.2.6-r8.ebuild:
6
+  Yet another attempt at fixing bug 238127, I failed at build logic in the
7
+  previous attempt
8
+
9
+  18 Oct 2008; Christian Hoffmann <hoffie@gentoo.org> ++,
10
+  -php-5.2.6-r7.ebuild:
11
+  adding -r8 which uses external pcre, in preparation of a possible fix for
12
+  bug 238127; also patching ext/posix to check for __GLIBC__ instead of
13
+  _GNU_SOURCE, might fix building on *bsd (bug 217392)
14
+
15
+  11 Aug 2008; Christian Hoffmann <hoffie@gentoo.org> -files/20php4-envd,
16
+  -files/php4-ldvs, +php-5.2.6-r7.ebuild:
17
+  php-5.2.6-r7 (patchset-r8), including fixes for bug 234459 and bug 231528
18
+
... ...
@@ -0,0 +1,12 @@
1
+AUX 20php5-envd 145 RMD160 8c81fb7dc1d1ddf16fd956d748514db3bcb27603 SHA1 f1cef57c0def8e2c5422aaf136f40b4ff47801d2 SHA256 efaae9e6ae5f7010e073c2ab6d8a9dda009f0707c7d7b0c027e142c94f7041a4
2
+AUX 70_mod_php.conf-apache2 454 RMD160 7e99b278a010c958d698454a2aa43e1a351c69e8 SHA1 895e986f880a1dee9b0a45fdcd99ccce44999a6b SHA256 dd7116f3439e06ef2d6126403360c2722355f8481552fdce0cb601af331f81ee
3
+AUX 70_mod_php5.conf-apache2 490 RMD160 745bdb5db622577f473703d5ee8dc7f3c66f8f0c SHA1 7daf9c9ec2e6d108f850981853f9f4f599be0b71 SHA256 5667d06cb7a18c30d11decd28d55b87e36287c76c4d3a450b1cb37271e7fdcd1
4
+AUX 70_mod_php5_concurr.conf-apache2 414 RMD160 1783b6c830119f021c3fb6cb35a631f43c4fa70c SHA1 09f9076f35bc84994fc8c687b4befc0400475f1a SHA256 ccc3bc073eafc83f98049679a411801e80f84620bd51c37c36de2b9ee9492aa2
5
+AUX 70_mod_php_concurr.conf-apache2 329 RMD160 364e071b494b84b78881c566b7c1b46261f62c19 SHA1 9d775784993b46a8be1a7e31f02a3482542385df SHA256 092178aa0cf3272b6411abc85b3820665322598932d249c284a8fa4108d5835a
6
+AUX php5-ldvs 22 RMD160 5846dab2745b68a88175dd4e72d0b8cf4756dd46 SHA1 592398c92575adb14ec972847ce2aca28a7b9c2c SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79
7
+DIST php-5.2.6.tar.bz2 9571312 RMD160 27f730d4b1ceb1c42ff03618dbfa0dc87a00990b SHA1 2a2b1afa657a7739a23784c869d57c3e0a7ad6b4 SHA256 1892b2dd50b56ae2c9aec027fcd9035b76673f113555bc2bc1007bab8ae4db81
8
+DIST php-patchset-5.2.6-r8.tar.bz2 28070 RMD160 74a33ffb6f3437883510161fc7bd57fbfbff4310 SHA1 f57441d6b2e25256811f15a31d088b0c3e0505fc SHA256 58f6d4708c13eb2ff5800a96d7f8b9144bb824093cc444cee0399597e1138f7f
9
+DIST suhosin-patch-5.2.6-0.9.6.2-r1.patch.gz 22987 RMD160 9c7bc7441e16686382a2b91f68c6e56a84683304 SHA1 0869e555e722615881d6bf1f642d656c53b41bd0 SHA256 40fdd5b92c4e1595250ffc58f317887acd1ef6681e6b6fdca098110c4bfa5bbc
10
+EBUILD php-5.2.6-r8.ebuild 15968 RMD160 c7c90f688aa4ebb16fd8b39d9652cf3fe50f9dbf SHA1 db20f5ceb31e28f9a51daaabb6705a8365ff4dab SHA256 f66597b4892b67d5834bbe11f9007033ba91f4fdbed3735a95196765aec12b89
11
+MISC ChangeLog 762 RMD160 b818e6fb0426d9f416362a1da38b462de4509fb9 SHA1 5a80feca6f9d3023379692df76a59db597d3555e SHA256 793cfc202612dda37ea7e351ef71bf3ba896fea0970bd405da0d2d86617669d9
12
+MISC metadata.xml 157 RMD160 a98db3a086fae3c09a903dadbc05f60443ec4b1a SHA1 ddaa23cc35eb917bf8962b652442bebb1ce0f440 SHA256 54f8878ca0228e380abbaa4b529806b5533a6b9b51b3b16c0909e906586a91a1
... ...
@@ -0,0 +1,2 @@
1
+MANPATH="/usr/lib/php5/man/"
2
+CONFIG_PROTECT_MASK="/etc/php/cli-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/apache2-php5/ext-active/"
... ...
@@ -0,0 +1,17 @@
1
+<IfDefine PHP4>
2
+	# Load the module first
3
+	<IfModule !sapi_apache2.c>
4
+		LoadModule php4_module    modules/libphp4.so
5
+	</IfModule>
6
+
7
+	# Set it to handle the files
8
+	<IfModule mod_mime.c>
9
+		AddType application/x-httpd-php .php
10
+		AddType application/x-httpd-php .phtml
11
+		AddType application/x-httpd-php .php3
12
+		AddType application/x-httpd-php .php4
13
+		AddType application/x-httpd-php-source .phps
14
+	</IfModule>
15
+
16
+	DirectoryIndex index.php index.phtml
17
+</IfDefine>
... ...
@@ -0,0 +1,18 @@
1
+<IfDefine PHP5>
2
+	# Load the module first
3
+	<IfModule !mod_php5.c>
4
+		LoadModule php5_module    modules/libphp5.so
5
+	</IfModule>
6
+
7
+	# Set it to handle the files
8
+	<IfModule mod_mime.c>
9
+		AddType application/x-httpd-php .php
10
+		AddType application/x-httpd-php .phtml
11
+		AddType application/x-httpd-php .php3
12
+		AddType application/x-httpd-php .php4
13
+		AddType application/x-httpd-php .php5
14
+		AddType application/x-httpd-php-source .phps
15
+	</IfModule>
16
+
17
+	DirectoryIndex index.php index.phtml
18
+</IfDefine>
... ...
@@ -0,0 +1,16 @@
1
+<IfDefine PHP5>
2
+	# Load the module first
3
+	<IfModule !mod_php5.c>
4
+		LoadModule php5_module    modules/libphp5.so
5
+	</IfModule>
6
+
7
+	# Set it to handle the files
8
+	<IfModule mod_mime.c>
9
+		AddType application/x-httpd-php5 .php
10
+		AddType application/x-httpd-php5 .phtml
11
+		AddType application/x-httpd-php5 .php5
12
+		AddType application/x-httpd-php5-source .phps
13
+	</IfModule>
14
+
15
+	DirectoryIndex index.php index.phtml
16
+</IfDefine>
... ...
@@ -0,0 +1,14 @@
1
+<IfDefine PHP4>
2
+	# Load the module first
3
+	<IfModule !sapi_apache2.c>
4
+		LoadModule php4_module    modules/libphp4.so
5
+	</IfModule>
6
+
7
+	# Set it to handle the files
8
+	<IfModule mod_mime.c>
9
+		AddType application/x-httpd-php4 .php3
10
+		AddType application/x-httpd-php4 .php4
11
+	</IfModule>
12
+
13
+	DirectoryIndex index.php index.phtml
14
+</IfDefine>
... ...
@@ -0,0 +1 @@
1
+PHP_5 { global: *; };
... ...
@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3
+<pkgmetadata>
4
+	<herd>php</herd>
5
+</pkgmetadata>
... ...
@@ -0,0 +1,525 @@
1
+# Copyright 1999-2008 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.6-r6.ebuild,v 1.8 2008/08/08 19:22:11 dertobi123 Exp $
4
+
5
+CGI_SAPI_USE="discard-path force-cgi-redirect"
6
+APACHE2_SAPI_USE="concurrentmodphp threads"
7
+IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild"
8
+
9
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
10
+
11
+# NOTE: Portage doesn't support setting PROVIDE based on the USE flags
12
+#		that have been enabled, so we have to PROVIDE everything for now
13
+#		and hope for the best
14
+PROVIDE="virtual/php virtual/httpd-php"
15
+
16
+# php package settings
17
+SLOT="5"
18
+MY_PHP_PV="${PV}"
19
+MY_PHP_P="php-${MY_PHP_PV}"
20
+PHP_PACKAGE="1"
21
+
22
+# php patch settings, general
23
+PHP_PATCHSET_REV="8"
24
+SUHOSIN_PATCH="suhosin-patch-5.2.6-0.9.6.2-r1.patch.gz"
25
+MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch"
26
+# php patch settings, ebuild specific
27
+FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch"
28
+CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/concurrent_apache_modules.patch"
29
+# kolab patch - http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/php/
30
+# bugs about this go to wrobel@gentoo.org
31
+KOLAB_PATCH="${MY_PHP_PV}/opt/kolab-imap-annotations.patch"
32
+
33
+inherit versionator php5_2-sapi apache-module
34
+
35
+SRC_URI="http://home.hoffie.info/php-patchset-${PV}-r${PHP_PATCHSET_REV}.tar.bz2
36
+	${SRC_URI}"
37
+
38
+# Suhosin patch support
39
+[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )"
40
+
41
+DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs."
42
+
43
+DEPEND="app-admin/php-toolkit
44
+	imap? ( >=virtual/imap-c-client-2006k )
45
+	pcre? ( >=dev-libs/libpcre-7.8 )"
46
+RDEPEND="${DEPEND}"
47
+if [[ -n "${KOLAB_PATCH}" ]] ; then
48
+	IUSE="${IUSE} kolab"
49
+	DEPEND="${DEPEND}
50
+		kolab? ( >=net-libs/c-client-2004g-r1 )"
51
+fi
52
+
53
+want_apache
54
+
55
+pkg_setup() {
56
+	PHPCONFUTILS_AUTO_USE=""
57
+
58
+	# Make sure the user has specified at least one SAPI
59
+	einfo "Determining SAPI(s) to build"
60
+	phpconfutils_require_any "  Enabled  SAPI:" "  Disabled SAPI:" cli cgi apache2
61
+
62
+	# Threaded Apache2 support
63
+	if use apache2 ; then
64
+		has_apache_threads
65
+	fi
66
+
67
+	# Concurrent PHP Apache2 modules support
68
+	if use apache2 ; then
69
+		if use concurrentmodphp ; then
70
+			ewarn
71
+			ewarn "'concurrentmodphp' makes it possible to load multiple, differently"
72
+			ewarn "versioned mod_php's into the same Apache instance. This is done with"
73
+			ewarn "a few linker tricks and workarounds, and is not guaranteed to always"
74
+			ewarn "work correctly, so use it at your own risk. Especially, do not use"
75
+			ewarn "this in conjunction with PHP modules (PECL, ...) other than the ones"
76
+			ewarn "you may find in the Portage tree or the PHP Overlay!"
77
+			ewarn "This is an experimental feature, so please rebuild PHP"
78
+			ewarn "without the 'concurrentmodphp' USE flag if you experience"
79
+			ewarn "any problems, and then reproduce any bugs before filing"
80
+			ewarn "them in Gentoo's Bugzilla or bugs.php.net."
81
+			ewarn "If you have conclusive evidence that a bug directly"
82
+			ewarn "derives from 'concurrentmodphp', please file a bug in"
83
+			ewarn "Gentoo's Bugzilla only."
84
+			ewarn
85
+			ebeep 5
86
+		fi
87
+	fi
88
+
89
+	# fastbuild support
90
+	if use fastbuild ; then
91
+		ewarn
92
+		ewarn "'fastbuild' attempts to build all SAPIs in a single pass."
93
+		ewarn "This is an experimental feature, so please rebuild PHP"
94
+		ewarn "without the 'fastbuild' USE flag if you experience"
95
+		ewarn "any problems, and then reproduce any bugs before filing"
96
+		ewarn "them in Gentoo's Bugzilla or bugs.php.net."
97
+		ewarn "If you have conclusive evidence that a bug directly"
98
+		ewarn "derives from 'fastbuild', please file a bug in"
99
+		ewarn "Gentoo's Bugzilla only."
100
+		ewarn
101
+	fi
102
+
103
+	php5_2-sapi_pkg_setup
104
+}
105
+
106
+php_determine_sapis() {
107
+	# holds the list of sapis that we want to build
108
+	PHPSAPIS=
109
+
110
+	if use cli || phpconfutils_usecheck cli ; then
111
+		PHPSAPIS="${PHPSAPIS} cli"
112
+	fi
113
+
114
+	if use cgi ; then
115
+		PHPSAPIS="${PHPSAPIS} cgi"
116
+	fi
117
+
118
+	# note - apache SAPI comes after the simpler cli/cgi sapis
119
+	if use apache2 ; then
120
+		PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}"
121
+	fi
122
+}
123
+
124
+src_unpack() {
125
+	if [[ "${PHP_PACKAGE}" == 1 ]] ; then
126
+		unpack ${A}
127
+	fi
128
+
129
+	cd "${S}"
130
+
131
+	# Concurrent PHP Apache2 modules support
132
+	if use apache2 ; then
133
+		if use concurrentmodphp ; then
134
+			if [[ -n "${CONCURRENTMODPHP_PATCH}" ]] && [[ -f "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" ]] ; then
135
+				epatch "${WORKDIR}/${CONCURRENTMODPHP_PATCH}"
136
+			else
137
+				ewarn "There is no concurrent mod_php patch available for this PHP release yet!"
138
+			fi
139
+		fi
140
+	fi
141
+
142
+	# fastbuild support
143
+	if use fastbuild ; then
144
+		if [[ -n "${FASTBUILD_PATCH}" ]] && [[ -f "${WORKDIR}/${FASTBUILD_PATCH}" ]] ; then
145
+			epatch "${WORKDIR}/${FASTBUILD_PATCH}"
146
+		else
147
+			ewarn "There is no fastbuild patch available for this PHP release yet!"
148
+		fi
149
+	fi
150
+
151
+	# kolab support
152
+	if [[ -n "${KOLAB_PATCH}" ]] ; then
153
+		use kolab && epatch "${WORKDIR}/${KOLAB_PATCH}"
154
+	fi
155
+
156
+	# pretend to not have flex, bug 221357
157
+	sed -re 's:( +)PHP_SUBST\(LEX\):\1LEX="exit 0;"\n\0:' -i acinclude.m4
158
+
159
+	# Now let the eclass do the rest and regenerate the configure
160
+	php5_2-sapi_src_unpack
161
+
162
+	# Fix Makefile.global:test to consider the CGI SAPI if present
163
+	if use cgi ; then
164
+		sed -e "s|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\"|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\" \&\& test \! -z \"\$(top_builddir)/php-cgi\" \&\& test -x \"\$(top_builddir)/php-cgi\"|g" -i Makefile.global
165
+		sed -e "s|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\"|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\" TEST_PHP_CGI_EXECUTABLE=\"\$(top_builddir)/php-cgi\"|g" -i Makefile.global
166
+	fi
167
+
168
+	# bug 217392 (autconf-2.62 behavior changes)
169
+	sed s:_GNU_SOURCE:__GLIBC__: -i ext/posix/posix.c
170
+
171
+	# try to fix some test cases which fail because of sandbox otherwise
172
+	sed -e 's:/no/such/:.\0:' -i ext/standard/tests/file/005_error.phpt \
173
+		ext/standard/tests/file/006_error.phpt \
174
+		ext/standard/tests/file/touch.phpt
175
+
176
+	# REMOVING BROKEN TESTS:
177
+	# removing this test as it has been broken for ages and is not easily
178
+	# fixable (depends on a lot of factors)
179
+	rm ext/standard/tests/general_functions/phpinfo.phpt
180
+
181
+	# never worked properly, no easy fix
182
+	rm ext/iconv/tests/bug16069.phpt ext/iconv/tests/iconv_stream_filter.phpt
183
+
184
+	# needs write access to /tmp and others
185
+	rm ext/session/tests/session_save_path_variation5.phpt
186
+
187
+	# sandbox-related (sandbox checks for permissions before even looking
188
+	# at the fs, but the tests expect "No such file or directory"
189
+	sed -e 's:/blah:./bla:' -i \
190
+		ext/session/tests/session_save_path_variation{2,3}.phpt
191
+
192
+	# these tests behave differently with suhosin enabled, adapting them...
193
+	use suhosin && sed -e 's:File(\.\./):File(..):g' -i \
194
+		ext/standard/tests/file/open_basedir*{.inc,.phpt}
195
+}
196
+
197
+src_compile() {
198
+	# bug 217392 (autconf-2.62 behavior changes)
199
+	export CFLAGS="${CFLAGS} -D_GNU_SOURCE"
200
+	export CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE"
201
+	if use fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then
202
+		src_compile_fastbuild
203
+	else
204
+		src_compile_normal
205
+	fi
206
+}
207
+
208
+src_compile_fastbuild() {
209
+	php_determine_sapis
210
+
211
+	build_cli=0
212
+	build_cgi=0
213
+	build_apache2=0
214
+	my_conf=""
215
+
216
+	for x in ${PHPSAPIS} ; do
217
+		case ${x} in
218
+			cli)
219
+				build_cli=1
220
+				;;
221
+			cgi)
222
+				build_cgi=1
223
+				;;
224
+			apache2)
225
+				build_apache2=1
226
+				;;
227
+		esac
228
+	done
229
+
230
+	if [[ ${build_cli} = 1 ]] ; then
231
+		my_conf="${my_conf} --enable-cli"
232
+	else
233
+		my_conf="${my_conf} --disable-cli"
234
+	fi
235
+
236
+	if [[ ${build_cgi} = 1 ]] ; then
237
+		my_conf="${my_conf} --enable-cgi --enable-fastcgi"
238
+		phpconfutils_extension_enable "discard-path" "discard-path" 0
239
+		phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0
240
+	else
241
+		my_conf="${my_conf} --disable-cgi"
242
+	fi
243
+
244
+	if [[ ${build_apache2} = 1 ]] ; then
245
+		my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2"
246
+
247
+		# Threaded Apache2 support
248
+		if use threads ; then
249
+			my_conf="${my_conf} --enable-maintainer-zts"
250
+			ewarn "Enabling ZTS for Apache2 MPM"
251
+		fi
252
+
253
+		# Concurrent PHP Apache2 modules support
254
+		if use concurrentmodphp ; then
255
+			append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs"
256
+		fi
257
+	fi
258
+
259
+	if use pcre || phpconfutils_usecheck pcre ; then
260
+		myconf="${my_conf} --with-pcre-dir=/usr"
261
+		phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr"
262
+	fi
263
+
264
+	# Now we know what we are building, build it
265
+	php5_2-sapi_src_compile
266
+
267
+	# To keep the separate php.ini files for each SAPI, we change the
268
+	# build-defs.h and recompile
269
+
270
+	if [[ ${build_cli} = 1 ]] ; then
271
+		einfo
272
+		einfo "Building CLI SAPI"
273
+		einfo
274
+
275
+		sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cli-php5"|g;' -i main/build-defs.h
276
+		sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php5/ext-active"|g;' -i main/build-defs.h
277
+		for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
278
+			[[ -f ${x} ]] && rm -f ${x}
279
+		done
280
+		make sapi/cli/php || die "Unable to make CLI SAPI"
281
+		cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI"
282
+	fi
283
+
284
+	if [[ ${build_cgi} = 1 ]] ; then
285
+		einfo
286
+		einfo "Building CGI SAPI"
287
+		einfo
288
+
289
+		sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cgi-php5"|g;' -i main/build-defs.h
290
+		sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php5/ext-active"|g;' -i main/build-defs.h
291
+		for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
292
+			[[ -f ${x} ]] && rm -f ${x}
293
+		done
294
+		make sapi/cgi/php-cgi || die "Unable to make CGI SAPI"
295
+		cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI"
296
+	fi
297
+
298
+	if [[ ${build_apache2} = 1 ]] ; then
299
+		einfo
300
+		einfo "Building apache${APACHE_VERSION} SAPI"
301
+		einfo
302
+
303
+		sed -e "s|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH \"/etc/php/apache${APACHE_VERSION}-php5\"|g;" -i main/build-defs.h
304
+		sed -e "s|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR \"/etc/php/apache${APACHE_VERSION}-php5/ext-active\"|g;" -i main/build-defs.h
305
+		for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do
306
+			[[ -f ${x} ]] && rm -f ${x}
307
+		done
308
+		make || die "Unable to make apache${APACHE_VERSION} SAPI"
309
+	fi
310
+}
311
+
312
+src_compile_normal() {
313
+	php_determine_sapis
314
+
315
+	CLEAN_REQUIRED=0
316
+	my_conf=""
317
+
318
+	# Support the Apache2 extras, they must be set globally for all
319
+	# SAPIs to work correctly, especially for external PHP extensions
320
+	if use apache2 ; then
321
+		# Concurrent PHP Apache2 modules support
322
+		if use concurrentmodphp ; then
323
+			append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs"
324
+		fi
325
+	fi
326
+
327
+	for x in ${PHPSAPIS} ; do
328
+		if use pcre || phpconfutils_usecheck pcre ; then
329
+			myconf="${my_conf} --with-pcre-dir=/usr"
330
+			phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr"
331
+		fi
332
+
333
+		# Support the Apache2 extras, they must be set globally for all
334
+		# SAPIs to work correctly, especially for external PHP extensions
335
+		if use apache2 ; then
336
+			# Threaded Apache2 support
337
+			if use threads ; then
338
+				my_conf="${my_conf} --enable-maintainer-zts"
339
+				ewarn "Enabling ZTS for Apache2 MPM"
340
+			fi
341
+		fi
342
+
343
+		if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then
344
+			make clean
345
+		fi
346
+
347
+		PHPSAPI="${x}"
348
+
349
+		case ${x} in
350
+			cli)
351
+				my_conf="${my_conf} --enable-cli --disable-cgi"
352
+				php5_2-sapi_src_compile
353
+				cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI"
354
+				;;
355
+			cgi)
356
+				my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi"
357
+				phpconfutils_extension_enable "discard-path" "discard-path" 0
358
+				phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0
359
+				php5_2-sapi_src_compile
360
+				cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI"
361
+				;;
362
+			apache2)
363
+				my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2"
364
+				php5_2-sapi_src_compile
365
+				;;
366
+		esac
367
+
368
+		CLEAN_REQUIRED=1
369
+		my_conf=""
370
+	done
371
+}
372
+
373
+src_install() {
374
+	php_determine_sapis
375
+
376
+	destdir=/usr/$(get_libdir)/php5
377
+
378
+	# Let the eclass do the common work
379
+	php5_2-sapi_src_install
380
+
381
+	einfo
382
+	einfo "Installing SAPI(s) ${PHPSAPIS}"
383
+	einfo
384
+
385
+	for x in ${PHPSAPIS} ; do
386
+
387
+		PHPSAPI="${x}"
388
+
389
+		case ${x} in
390
+			cli)
391
+				einfo "Installing CLI SAPI"
392
+				into ${destdir}
393
+				newbin php-cli php || die "Unable to install ${x} sapi"
394
+				php5_2-sapi_install_ini
395
+				;;
396
+			cgi)
397
+				einfo "Installing CGI SAPI"
398
+				into ${destdir}
399
+				dobin php-cgi || die "Unable to install ${x} sapi"
400
+				php5_2-sapi_install_ini
401
+				;;
402
+			apache2)
403
+				einfo "Installing Apache${APACHE_VERSION} SAPI"
404
+				make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI"
405
+				if use concurrentmodphp ; then
406
+					einfo "Installing Apache${APACHE_VERSION} config file for PHP5-concurrent (70_mod_php5_concurr.conf)"
407
+					insinto ${APACHE_MODULES_CONFDIR}
408
+					newins "${FILESDIR}/70_mod_php5_concurr.conf-apache2" "70_mod_php5_concurr.conf"
409
+
410
+					# Put the ld version script in the right place so it's always accessible
411
+					insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/"
412
+					doins "${FILESDIR}/php5-ldvs"
413
+
414
+					# Redefine the extension dir to have the modphp suffix
415
+					PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned"
416
+				else
417
+					einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)"
418
+					insinto ${APACHE_MODULES_CONFDIR}
419
+					newins "${FILESDIR}/70_mod_php5.conf-apache2" "70_mod_php5.conf"
420
+				fi
421
+				php5_2-sapi_install_ini
422
+				;;
423
+		esac
424
+	done
425
+
426
+	# Install env.d files
427
+	newenvd "${FILESDIR}/20php5-envd" "20php5"
428
+	sed -e "s|/lib/|/$(get_libdir)/|g" -i "${D}/etc/env.d/20php5"
429
+}
430
+
431
+pkg_postinst() {
432
+	# Output some general info to the user
433
+	if use apache2 ; then
434
+		APACHE2_MOD_DEFINE="PHP5"
435
+		if use concurrentmodphp ; then
436
+			APACHE2_MOD_CONF="70_mod_php5_concurr"
437
+		else
438
+			APACHE2_MOD_CONF="70_mod_php5"
439
+		fi
440
+		apache-module_pkg_postinst
441
+	fi
442
+
443
+	# Update Apache2 to use mod_php
444
+	if use apache2 ; then
445
+		"${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1
446
+		exitStatus=$?
447
+		if [[ ${exitStatus} == 2 ]] ; then
448
+			php-select apache2 php5
449
+		elif [[ ${exitStatus} == 4 ]] ; then
450
+			ewarn
451
+			ewarn "Apache2 is configured to load a different version of PHP."
452
+			ewarn "To make Apache2 use PHP v5, use php-select:"
453
+			ewarn
454
+			ewarn "    php-select apache2 php5"
455
+			ewarn
456
+		fi
457
+	fi
458
+
459
+	# Create the symlinks for php-cli
460
+	if use cli || phpconfutils_usecheck cli ; then
461
+		"${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1
462
+		exitStatus=$?
463
+		if [[ ${exitStatus} == 5 ]] ; then
464
+			php-select php php5
465
+		elif [[ ${exitStatus} == 4 ]] ; then
466
+			ewarn
467
+			ewarn "/usr/bin/php links to a different version of PHP."
468
+			ewarn "To make /usr/bin/php point to PHP v5, use php-select:"
469
+			ewarn
470
+			ewarn "    php-select php php5"
471
+			ewarn
472
+		fi
473
+	fi
474
+
475
+	# Create the symlinks for php-cgi
476
+	if use cgi ; then
477
+		"${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1
478
+		exitStatus=$?
479
+		if [[ ${exitStatus} == 5 ]] ; then
480
+			php-select php-cgi php5
481
+		elif [[ ${exitStatus} == 4 ]] ; then
482
+			ewarn
483
+			ewarn "/usr/bin/php-cgi links to a different version of PHP."
484
+			ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:"
485
+			ewarn
486
+			ewarn "    php-select php-cgi php5"
487
+			ewarn
488
+		fi
489
+	fi
490
+
491
+	# Create the symlinks for php-devel
492
+	"${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1
493
+	exitStatus=$?
494
+	if [[ $exitStatus == 5 ]] ; then
495
+		php-select php-devel php5
496
+	elif [[ $exitStatus == 4 ]] ; then
497
+		ewarn
498
+		ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a"
499
+		ewarn "different version of PHP. To make them point to PHP v5, use"
500
+		ewarn "php-select:"
501
+		ewarn
502
+		ewarn "    php-select php-devel php5"
503
+		ewarn
504
+	fi
505
+
506
+	php5_2-sapi_pkg_postinst
507
+}
508
+
509
+src_test() {
510
+	vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
511
+	if [[ ! -x "${S}"/php-cli ]]; then
512
+		ewarn "Running the php test suite requires USE=cli"
513
+		return
514
+	fi
515
+
516
+	export TEST_PHP_EXECUTABLE="${S}"/php-cli
517
+	if [[ -x "${S}"/php-cgi ]]; then
518
+		export TEST_PHP_CGI_EXECUTABLE="${S}"/php-cgi
519
+	fi
520
+	REPORT_EXIT_STATUS=1 "${S}"/php-cli -n "${S}"/run-tests.php -n
521
+
522
+	if [[ $? != 0 ]] ; then
523
+		eerror "Not all tests were successful!"
524
+	fi
525
+}
0 526