--- ebuild.sh.orig 2010-09-03 14:23:46.000000000 +0200 +++ ebuild.sh 2010-09-03 14:44:29.400038418 +0200 @@ -453,6 +453,33 @@ # should be preserved. find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \ ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w + + # New implementation with profiling on compilation support + # source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null + PROFILE_DIR="${PROF_DIR:-/var/tmp/profile}" + PROFILE_SUBDIR="${PROFILE_DIR}/${CATEGORY}/${PF}" + GCC_VERSION=$(gcc --version | awk '{print $3;exit}') + if has profile ${FEATURES} ; then + if [[ ${GCC_VERSION} < 4.4.0 ]]; then + ewarn "\nGCC version is too old to use compilation with profile usage." + ewarn "GCC 4.4.0 or higher required." + ewarn "Falling back to compilation w/o profile usage.\n" + elif has profile-use ${FEATURES} ; then + if [[ -d ${PROFILE_SUBDIR} ]] ; then + einfo "\nCompiling with profiling data usage.\n" + CFLAGS+=" -fprofile-use -fprofile-dir=${PROFILE_SUBDIR} -Wcoverage-mismatch -fprofile-correction" + CXXFLAGS="${CFLAGS}" + else + ewarn "\nNo directory with profiling data. Did you run fist stage and then program itself?\n" + fi + else + einfo "\nCompiling with profiling data gathering support.\n" + mkdir -m 777 -p "${PROFILE_SUBDIR}" + CFLAGS+=" -fprofile-generate -fprofile-dir=${PROFILE_SUBDIR}" + CXXFLAGS="${CFLAGS}" + LDFLAGS+=" -fprofile-arcs" + fi + fi } strip_duplicate_slashes() {