BASEQTNAME='qtimageformats'

if [ -d usr/bin/qt5 ];then
 mkdir -p ../${BASEQTNAME}_DEV/usr/bin
 cp -a -f usr/bin/qt5/* ../${BASEQTNAME}_DEV/usr/bin/
 rm -rf usr/bin/qt5
fi
#qt5 built in oe, has an unwanted paragraph in some .cmake files...
if [ -d ../${BASEQTNAME}_DEV/usr/lib/cmake ];then
 for aFILE in `find ../${BASEQTNAME}_DEV/usr/lib/cmake -type f -name '*.cmake'`
 do
  #remove paragraph with this in it:
  sed -i '/NOT DEFINED OE_QMAKE_PATH_EXTERNAL_HOST_BINS/,/^\s*$/{d}' ${aFILE}
  #exported OE_QMAKE_PATH_EXTERNAL_HOST_BINS but not read in .cmake files, so delete all...
  sed -i -e 's%\${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}%/usr/bin%' ${aFILE}
  #some .cmake files have a wrong path from original host...
  #ex: _qt5gui_find_extra_libs(EGL "EGL" "" "/mnt/sdb1/projects/oe/pyro/oe-quirky/buildPC/tmp-glibc/work/nocona-64-oe-linux/qtbase/5.10.1+gitAUTOINC+6c6ace9d23-r0/recipe-sysroot/usr/include/libdrm")
  sed -i -e 's%"/mnt/[a-zA-Z0-9+._/-]*/recipe\-sysroot/%"/%' ${aFILE}
 done
fi
