summaryrefslogtreecommitdiffstats
path: root/dev-lang/php/files/eblits/src_prepare-v4.eblit
blob: cab740f4a60c69c97b96f082102e737e23489be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v4.eblit,v 1.1 2011/06/29 06:38:38 olemarkus Exp $

eblit-php-src_prepare() {
	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
	# there is no easy way to circumvent that, all php calls during
	# install use -n, so no php.ini file will be used.
	# As such, this is the easiest way to get around
	addpredict /session_mm_cli250.sem
	addpredict /session_mm_cli0.sem

	# kolab support (support for imap annotations)
	use kolab && epatch "${WORKDIR}/patches/opt/imap-kolab-annotations.patch"

	# Change PHP branding
	# Get the alpha/beta/rc version
	local ver=$(get_version_component_range 4)
	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-${ver}-pl${PR/r/}-gentoo\2|g" \
		-i configure.in || die "Unable to change PHP branding"

	# Apply generic PHP patches
		EPATCH_SOURCE="${WORKDIR}/patches/generic" EPATCH_SUFFIX="patch" \
		EPATCH_FORCE="yes" \
		EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch

	# Patch PHP to show Gentoo as the server platform
	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"

	# Prevent PHP from activating the Apache config,
	# as we will do that ourselves
	sed -i \
		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
	configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4

	# Patch PHP to support heimdal instead of mit-krb5
	if has_version "app-crypt/heimdal" ; then
		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
			|| die "Failed to fix heimdal libname"
		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
			|| die "Failed to fix heimdal crypt library reference"
	fi

	# Suhosin support
	if [[ -n $SUHOSIN_VERSION ]] ; then
		if use suhosin ; then
			epatch "${WORKDIR}/${SUHOSIN_PATCH}"
		fi
	else
		ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
	fi

	#Add user patches #357637
	epatch_user
	
	#force rebuilding aclocal.m4
	rm aclocal.m4
	eautoreconf
}