diff options
author | Simon Stelling <blubb@gentoo.org> | 2006-03-11 23:38:30 +0000 |
---|---|---|
committer | Simon Stelling <blubb@gentoo.org> | 2006-03-11 23:38:30 +0000 |
commit | 4a8b23ce89b8e0063477f73b83c29cb913cc36df (patch) | |
tree | 6dda2bae311f57bb2c95d06115df1d0db8e807bb /profiles/default-linux | |
parent | Added a build fix for gcc4 (diff) | |
download | gentoo-2-4a8b23ce89b8e0063477f73b83c29cb913cc36df.tar.gz gentoo-2-4a8b23ce89b8e0063477f73b83c29cb913cc36df.tar.bz2 gentoo-2-4a8b23ce89b8e0063477f73b83c29cb913cc36df.zip |
we've had enough ricer bugs for a while...
this profile.bashrc filters out any flag that isn't recognized by the compiler (will make the -fPIC configure test fail) and spit out a warning. also spit out warnings for the flags that should never get set by the user (-m32, -fPIC, -fvisibility=hidden to name a few)
Diffstat (limited to 'profiles/default-linux')
-rw-r--r-- | profiles/default-linux/amd64/profile.bashrc | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/profiles/default-linux/amd64/profile.bashrc b/profiles/default-linux/amd64/profile.bashrc new file mode 100644 index 000000000000..d67aee64b2e8 --- /dev/null +++ b/profiles/default-linux/amd64/profile.bashrc @@ -0,0 +1,65 @@ +getPROG() { + local var=$1 + local prog=$2 + + if [[ -n ${!var} ]] ; then + echo "${!var}" + return 0 + fi + + local search= + [[ -n $3 ]] && search=$(type -p "$3-${prog}") + [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}") + [[ -n ${search} ]] && prog=${search##*/} + + export ${var}=${prog} + echo "${!var}" +} + +hasme() { + local x + + local me=$1 + shift + for x in "$@"; do + if [ "${x}" == "${me}" ]; then + return 0 + fi + done + return 1 +} + +test_broken_flags() { + local mygcc=${1} + shift + echo 'main(){}' | ${mygcc} ${@} -E - 2>&1 | egrep "unrecognized .*option" \ + | egrep -o -- '('\''|\"|`)-.*' | sed -r 's/('\''|`|")//g' +} + +if [[ ${EBUILD_PHASE} == "setup" ]]; then + trigger=0 + for flag in ${CFLAGS} ; do + broken_flag=$(test_broken_flags $(getPROG CC gcc) ${flag}) + if [[ -n ${broken_flag} ]]; then + ewarn "Filtering out the non-existing CFLAG \"${broken_flag}\"" + CFLAGS=${CFLAGS//${broken_flag}} + fi + done + for flag in ${CXXFLAGS} ; do + broken_flag=$(test_broken_flags $(getPROG CXX g++) ${flag}) + if [[ -n ${broken_flag} ]]; then + ewarn "Filtering out the non-existing CXXFLAG \"${broken_flag}\"" + CXXFLAGS=${CXXFLAGS//${broken_flag}} + fi + done + for flag in "-fvisibility=hidden" "-fvisibility-hidden" "-fvisibility-inline-hidden" "-fPIC" "-fweb" "-m32" "-m64" "-g3" "-ggdb3" ; do + hasme ${flag} ${CFLAGS} ${CXXFLAGS} && trigger=1 && \ + ewarn "Your C(XX)FLAGS contain(s) \"${flag}\" which can break packages." + done + if [[ ${trigger} -ge 1 ]]; then + ewarn "" + ewarn "Before you file a bug please remove these flags and " + ewarn "re-compile the package in question as well as all its dependencies" + fi +fi +unset trigger broken_flag |