summaryrefslogtreecommitdiffstats
path: root/dev-lang/php/files/eblits/src_prepare-v3.eblit
blob: 7e270f97d27c6b556baa7767dccdfdc42e8295a5 (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
63
64
65
66
67
68
69
70
71
72
73
# 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-v3.eblit,v 1.1 2011/03/13 09:48:06 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}/${PV}/opt/imap-kolab-annotations.patch"

	# Change PHP branding
	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \
		-i configure.in || die "Unable to change PHP branding"

	# Apply generic PHP patches
	EPATCH_SOURCE="${WORKDIR}/${PV}/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

	# rebuild the whole autotools stuff as we are heavily patching it
	# (suhosin, fastbuild, ...)

	# eaclocal doesn't accept --force, so we try to force re-generation
	# this way
	rm aclocal.m4

	# work around divert() issues with newer autoconf, bug #281697
	if has_version '>=sys-devel/autoconf-2.64' ; then
		sed -i -r \
			-e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
			$(grep -l divert $(find . -name '*.m4') configure.in) || die
	fi
	eautoreconf --force -W no-cross
}