
#120517 gentoo...
#DISTRO_BINARY_COMPAT is exported in 2createpackages.
if [ "$DISTRO_BINARY_COMPAT" = "gentoo" ];then
 GCCEXE="`find usr -name 'gcc' | head -n 1`"
 if [ "$GCCEXE" ];then
  GCCBINDIR="`dirname $GCCEXE`"
  cp -a -f --remove-destination ${GCCBINDIR}/* usr/bin/
  #rm -rf ./${GCCBINDIR}
 fi
fi

#ubuntu is the problem, these symlinks are missing...

if [ ! -e usr/bin/g++ ];then
 REALFILE="`find usr/bin/ -maxdepth 1 -type f -name "g++-*" | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 ln -s $REALFILE usr/bin/g++
 ln -s $REALFILE usr/bin/c++
fi

#121028 01micko: Slackware ships with exec named gcc-4.7.1 and another util named gcc-somethingelse (forget sorry)
# change -name "gcc-*" to -name "gcc-*.*" ...
if [ ! -e usr/bin/gcc ];then
 REALFILE="`find usr/bin/ -maxdepth 1 -type f -name "gcc-*.*" | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 ln -s $REALFILE usr/bin/gcc
 ln -s $REALFILE usr/bin/cc
fi

#t2, i had to recompile gcc in running quirky, my new binary tarball has some things missing...
if [ ! -e usr/bin/cc ];then
 REALFILE="`find usr/bin/ -maxdepth 1 -type f -name gcc | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 [ "$REALFILE" = "" ] && REALFILE="`find usr/bin/ -maxdepth 1 -type f -name "gcc-*" | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 [ "$REALFILE" ] && ln -s $REALFILE usr/bin/cc
fi
if [ ! -e usr/lib/libgcc_s.so ];then
 REALFILE="`find usr/lib/ -maxdepth 1 -type f -name "libgcc_s.so*" | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 [ "$REALFILE" ] && ln -s $REALFILE usr/lib/libgcc_s.so
fi
if [ ! -e usr/bin/c++ ];then
 REALFILE="`find usr/bin/ -maxdepth 1 -type f -name g++ | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 [ "$REALFILE" = "" ] && REALFILE="`find usr/bin/ -maxdepth 1 -type f -name "g++-*" | head -n 1 | rev | cut -f 1 -d '/' | rev`"
 [ "$REALFILE" ] && ln -s $REALFILE usr/bin/c++
fi

#110628 mageia 1...
if [ ! -e usr/bin/cpp ];then
 CPPBIN="`find usr/bin/ -maxdepth 1 -type f -name 'cpp-*' | head -n 1`"
 if [ "$CPPBIN" ];then
  CPPBASE="`basename $CPPBIN`"
  ln -s $CPPBASE usr/bin/cpp
 fi
fi

#130707...
BADPYLIB="$(find usr/lib -mindepth 1 -maxdepth 1 -iname 'libstdc*.py' | tr '\n' ' ')"
if [ "$BADPYLIB" ];then
 for ABADPYLIB in $BADPYLIB
 do
  rm -f $ABADPYLIB
 done
fi

