summaryrefslogtreecommitdiffstats
path: root/dev-lang/php/files/eblits/src_compile-v1.eblit
blob: cb0d56cdeabe0d4fe215d2a927596d9c72e9cdf2 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_compile-v1.eblit,v 1.6 2010/08/14 19:37:31 mabi Exp $

eblit-php-src_compile() {
	# snmp seems to run during src_compile, too (bug #324739)
	addpredict /usr/share/snmp/mibs/.index

	SAPI_DIR="${WORKDIR}/sapis"

	for sapi in ${SAPIS} ; do
		use "${sapi}" || continue

		php_sapi_build "${sapi}"
		php_sapi_copy "${sapi}"
	done
}

php_sapi_build() {
	mkdir -p "${SAPI_DIR}/$1"

	cd "${WORKDIR}/sapis-build/$1"
	emake || die "emake failed"
}

php_sapi_copy() {
	local sapi="$1"
	local source=""

	case "$sapi" in
		cli)
			source="sapi/cli/php"
			;;
		cgi)
			source="sapi/cgi/php-cgi"
			;;
		fpm)
			source="sapi/fpm/php-fpm"
			;;
		embed)
			source="libs/libphp${PHP_MV}.so"
			;;

		apache2)
			# apache2 is a special case; the necessary files
			# (yes, multiple) are copied by make install, not
			# by the ebuild; that's the reason, why apache2 has
			# to be the last sapi
			emake INSTALL_ROOT="${SAPI_DIR}/${sapi}/" install-sapi
			;;

		*)
			die "unhandled sapi in php_sapi_copy"
			;;
	esac

	if [[ "${source}" ]] ; then
		cp "$source" "${SAPI_DIR}/$sapi" || die "Unable to copy ${sapi} SAPI"
	fi
}