Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2010 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: $ |
4 |
|
5 |
eblit-php-src_compile() { |
6 |
|
7 |
SAPIS="${WORKDIR}/sapis" |
8 |
|
9 |
# set compile order |
10 |
local PHP_SAPIS="cli cgi embed apache2" |
11 |
|
12 |
local -A PHP_SAPI_TYPE=([cli]="static" [cgi]="static" [embed]="dynamic" [apache2]="dynamic") |
13 |
local PREV_SAPI="" |
14 |
|
15 |
for x in ${PHP_SAPIS}; do |
16 |
if use ${x} ; then |
17 |
|
18 |
# Possible problems with some SAPIs, which are linked as dynamic libraries. For example, |
19 |
# apache2 SAPI ignores-prefer-no-pic, and trying to use when linking PIC and non PIC |
20 |
# objects and build the wrong libphp5.so. So make full clean, for avoid that. |
21 |
if [[ ! -z "${PREV_SAPI}" ]] ; then |
22 |
if [[ "${PHP_SAPI_TYPE[${x}]}" != "${PHP_SAPI_TYPE[${PREV_SAPI}]}" ]] ; then |
23 |
make clean |
24 |
else |
25 |
rm -f main/main.o main/main.lo main/php_ini.o \ |
26 |
main/php_ini.lo 2>/dev/null |
27 |
fi |
28 |
fi |
29 |
|
30 |
case ${x} in |
31 |
cli) |
32 |
php_sapi_build ${x} |
33 |
cp sapi/cli/php "${SAPIS}/${x}/" \ |
34 |
|| die "Unable to copy ${x} SAPI" |
35 |
;; |
36 |
cgi) |
37 |
php_sapi_build ${x} |
38 |
cp sapi/cgi/php-cgi "${SAPIS}/${x}/" \ |
39 |
|| die "Unable to copy {$x} SAPI" |
40 |
;; |
41 |
embed) |
42 |
php_sapi_build ${x} |
43 |
cp libs/libphp${PHP_MV}.so "${SAPIS}/${x}/" \ |
44 |
|| die "Unable to copy ${x} SAPI" |
45 |
;; |
46 |
apache2) |
47 |
php_sapi_build ${x} |
48 |
# apache2 is a special case; the necessary files (yes, multiple) |
49 |
# are copied by make install, not by the ebuild; that's the reason, |
50 |
# why apache2 has to be the last sapi |
51 |
;; |
52 |
esac |
53 |
|
54 |
PREV_SAPI="${x}" |
55 |
fi |
56 |
done |
57 |
} |
58 |
|
59 |
php_sapi_build() { |
60 |
local sapi="$1" |
61 |
php_set_ini_dir ${sapi} |
62 |
|
63 |
mkdir -p "${SAPIS}/${sapi}" |
64 |
|
65 |
sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} |
66 |
--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}" |
67 |
|
68 |
for available_sapi in cli cgi embed ; do |
69 |
if [[ $sapi == $available_sapi ]] ; then |
70 |
sapi_conf="${sapi_conf} --enable-${available_sapi}" |
71 |
else |
72 |
sapi_conf="${sapi_conf} --disable-${available_sapi}" |
73 |
fi |
74 |
done |
75 |
|
76 |
if [[ $sapi == "apache2" ]] ; then |
77 |
sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs" |
78 |
else |
79 |
sapi_conf="${sapi_conf} --without-apxs2" |
80 |
fi |
81 |
|
82 |
econf ${sapi_conf} |
83 |
emake || die "emake failed" |
84 |
} |
85 |
|
86 |
|