linamh/dev-lang/php/files/eblits/src_compile-v1.eblit
2010-07-27 09:43:07 +00:00

91 lines
1.9 KiB
Plaintext

# 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.4 2010/07/26 13:42:12 mabi Exp $
eblit-php-src_compile() {
SAPI_DIR="${WORKDIR}/sapis"
local is_first_sapi=1
for sapi in ${SAPIS} ; do
use "${sapi}" || continue
if [[ ${is_first_sapi} == 1 ]]; then
is_first_sapi=0
else
emake clean
fi
php_sapi_build "${sapi}"
php_sapi_copy "${sapi}"
done
}
php_sapi_build() {
local sapi="$1"
php_set_ini_dir "${sapi}"
mkdir -p "${SAPI_DIR}/${sapi}"
sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
for one_sapi in $SAPIS ; do
case "$one_sapi" in
cli|cgi|embed|fpm)
if [[ "${one_sapi}" == "${sapi}" ]] ; then
sapi_conf="${sapi_conf} --enable-${one_sapi}"
else
sapi_conf="${sapi_conf} --disable-${one_sapi}"
fi
;;
apache2)
if [[ "${one_sapi}" == "${sapi}" ]] ; then
sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
else
sapi_conf="${sapi_conf} --without-apxs2"
fi
;;
esac
done
econf ${sapi_conf}
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
}