cd ${SOURCE_DIRECTORY}  &&

mkdir -p ${INSTALL_ROOT}/usr/include/${SPELL}  &&

install CImg.h ${INSTALL_ROOT}/usr/include/${SPELL}  &&

if [[ "${CIMG_PLUGINS}" == "y" ]]
then
  cp -r plugins ${INSTALL_ROOT}/usr/include/${SPELL}
fi  &&

if [[ "${CIMG_EXAMPLES}" == "y" ]]
then
  mkdir -p ${INSTALL_ROOT}/usr/share/doc/${SPELL}/examples/bin  &&
  cd ${SOURCE_DIRECTORY}/examples  &&
  cp -R img ${INSTALL_ROOT}/usr/share/doc/${SPELL}/examples/bin  &&
  FILES=`find . -type f -perm -755` &&
  for file in $FILES
  do
    install ${file} ${INSTALL_ROOT}/usr/share/doc/${SPELL}/examples/bin  &&
    install ${file}.cpp ${INSTALL_ROOT}/usr/share/doc/${SPELL}/examples
  done 
fi
