--- dev-php/roadsend-php/roadsend-php-2.9.9_p1.ebuild 2010-02-23 04:49:40.000000000 +0100 +++ dev-php/roadsend-php/roadsend-php-2.9.9_p1.ebuild 2010-02-24 02:31:19.686576160 +0100 @@ -3,7 +3,7 @@ # $Header: /var/cvsroot/gentoo-x86/dev-php/roadsend-php/roadsend-php-2.9.9_p1.ebuild,v 1.1 2010/02/23 03:49:40 yngwin Exp $ EAPI=2 -inherit eutils +inherit autotools eutils MY_PV=${PV/_/-} MY_P=${PN}-${MY_PV} @@ -29,6 +29,67 @@ S="${WORKDIR}/${MY_P}" +src_prepare() { + # respect CFLAGS/LDFLAGS + # Upstream bugs: http://code.roadsend.com/pcc/ticket/3495 + # http://code.roadsend.com/pcc/ticket/3531 + # note the ugly ^M gremlins and make the patch not fail + # with DOS line endings depending on sys-devel/patch version installed + edos2unix bigloo-rules.mk || die "failed to sanitize bigloo-rules.mk" + for i in runtime/Makefile compiler/Makefile tools/c-interface/Makefile \ + tools/profiler/Makefile tools/readline/Makefile webconnect/fastcgi/Makefile \ + webconnect/micro/Makefile ; do + mv -f ${i} ${i}.in || die "mv ${i} failed" + done + epatch "${FILESDIR}/${P}-flags.patch" + # Bigloo needs -copt/-ldopt prefixed before *each* of CFLAGS/LDFLAGS + # Without this you get flooded with tons of "Don't know what to do with arguments" messages + local bcflags bldflags pcccflags pccldflags pccpropercflags pccproperldflags + if [[ -n ${CFLAGS} ]] ; then + for x in ${CFLAGS}; do + bcflags="${bcflags} -copt ${x}" + done + sed -i -e "s:@@CFLAGS@@:${bcflags}:g" bigloo-rules.mk || die "sed failed" + else + sed -i -e "s:@@CFLAGS@@::g" bigloo-rules.mk || die "sed failed" + fi + if [[ -n ${LDFLAGS} ]] ; then + for x in ${LDFLAGS} ; do + bldflags="${bldflags} -ldopt ${x}" + done + sed -i -e "s:@@LDFLAGS@@:${bldflags}:g" bigloo-rules.mk || die "sed failed" + else + sed -i -e "s:@@LDFLAGS@@::g" bigloo-rules.mk || die "sed failed" + fi + + # See http://code.roadsend.com/pcc/ticket/3523 for reasons for this madness + # Also, pcc itself only accepts --copt/--ldopt instead of -copt/-ldopt used for bigloo + if [[ -n ${CFLAGS} ]] ; then + for x in ${CFLAGS}; do + pcccflags="${pcccflags} --bopt -copt --bopt ${x}" + pccpropercflags="${pccpropercflags} --copt ${x}" + done + sed -i -e "s:@@CFLAGS@@:${pcccflags}:" runtime/php-ext/php-extensions.mk || die "sed failed" + sed -i -e "s:@@PCCCFLAGS@@:${pccpropercflags}:" runtime/php-ext/php-extensions.mk || die "sed failed" + else + sed -i -e "s:@@CFLAGS@@::" runtime/php-ext/php-extensions.mk || die "sed failed" + sed -i -e "s:@@PCCCFLAGS@@::" runtime/php-ext/php-extensions.mk || die "sed failed" + fi + if [[ -n ${LDFLAGS} ]] ; then + for x in ${LDFLAGS}; do + pccldflags="${pccldflags} --bopt -ldopt --bopt ${x}" + pccproperldflags="${pccproperldflags} --ldopt ${x}" + done + sed -i -e "s:@@LDFLAGS@@:${pccldflags}:" runtime/php-ext/php-extensions.mk || die "sed failed" + sed -i -e "s:@@PCCLDFLAGS@@:${pccproperldflags}:" runtime/php-ext/php-extensions.mk || die "sed failed" + else + sed -i -e "s:@@LDFLAGS@@::" runtime/php-ext/php-extensions.mk || die "sed failed" + sed -i -e "s:@@PCCLDFLAGS@@::" runtime/php-ext/php-extensions.mk || die "sed failed" + fi + + eautoreconf +} + src_configure() { econf $(use_with pcre) \ $(use_with fastcgi fcgi) \