#some directories are not needed now
local FDIRS FARCH FF DD  &&
default_pre_build        &&
FDIRS="compiler installer tests ide  utils"  &&
cd $SOURCE_DIRECTORY      &&
rm -r $FDIRS $FARCH       &&
cd packages               &&
rm -r   fcl-*/tests \
        amunits gnome1 gtk1 libndsfpc os2units palmunits univint winceunits winunits* &&
cd ptc/src                &&
rm -r dos win32 wince     &&
cd $SOURCE_DIRECTORY      &&
mkdir $FDIRS              && 
# link to existing units
ln -s ${INSTALL_ROOT}/usr/lib/fpc/${VERSION//\.rc?}/units  &&
for DD in packages/fcl-base/src rtl rtl/linux; do
  cd $SOURCE_DIRECTORY/$DD  &&
  for FF in `ls`;do
   if [[ -d $FF ]];then
      case $FF in
      common|linux|unix|i386|x86_64|inc);;
      *)  rm -r $FF;;
      esac
    fi
  done
done
