--- ghc-6.2.2.ebuild.orig 2004-10-19 13:34:37.000000000 +0200 +++ ghc-6.2.2.ebuild 2004-10-19 15:27:34.000000000 +0200 @@ -61,20 +61,16 @@ SUPPORTED_CFLAGS="" # Setup supported CFLAGS. -setup_cflag() { +check_cflags() { OLD_CFLAGS="${CFLAGS}" - CFLAGS="${CFLAGS} $1" + CFLAGS="$1" strip-unsupported-flags - - if [ "${OLD_CFLAGS}" != "${CFLAGS}" ]; - then - SUPPORTED_CFLAGS="$1 ${SUPPORTED_CFLAGS}" - fi + SUPPORTED_CFLAGS="${SUPPORTED_CFLAGS} ${CFLAGS}" + CFLAGS="${OLD_CFLAGS}" } setup_cflags() { - setup_cflag "-fno-pic" - setup_cflag "-fno-stack-protector" + check_cflags "-nopie -fno-stack-protector -fno-stack-protector-all" } src_unpack() { @@ -86,9 +82,10 @@ cd ${S}/ghc pushd driver setup_cflags + epatch ${FILESDIR}/${PN}-6.2.hardened.patch - sed -i -e "s|@GHC_CFLAGS@|${SUPPORTED_CFLAGS//-f/-optc-f}|" ghc/ghc.sh - sed -i -e "s|@GHC_CFLAGS@|${SUPPORTED_CFLAGS//-f/-optc-f}|" ghci/ghci.sh + sed -i -e "s|@GHC_CFLAGS@|${SUPPORTED_CFLAGS// -/ -optc-}|" ghc/ghc.sh + sed -i -e "s|@GHC_CFLAGS@|${SUPPORTED_CFLAGS// -/ -optc-}|" ghci/ghci.sh popd } @@ -105,7 +102,7 @@ # patch included) setup_cflags echo "SRC_CC_OPTS+=${SUPPORTED_CFLAGS}" >> mk/build.mk - echo "SRC_HC_OPTS+=${SUPPORTED_CFLAGS//-f/-optc-f}" >> mk/build.mk + echo "SRC_HC_OPTS+=${SUPPORTED_CFLAGS// -/ -optc-}" >> mk/build.mk # force the config variable ArSupportsInput to be unset; # ar in binutils >= 2.14.90.0.8-r1 seems to be classified