pkgname=kdegraphics-dreamdesktop
_pkgname=plasma-video-wallpaper
pkgver=06012014
pkgrel=1
pkgdesc="Animated wallpaper for KDE 4 environment"
arch=('any')
url="https://github.com/Fincer/Plasma-Wallpaper-DreamDesktop" ## Developed by Korneliusz Jarzębski
license=('GPL')
depends=('kdebase-workspace' 'ffmpeg')
source=(crashfix.patch)

_gitname="Plasma-Wallpaper-DreamDesktop"
_gitroot="https://github.com/Fincer/${_gitname}.git"

build() {
  cd $srcdir
  msg "Connecting to GIT (${_gitroot}) ..."
 
  if [ -d $_gitname ]; then
    cd $_gitname && git pull origin
    msg "The local files of ${_gitname} were updated."
  else
    git clone $_gitroot $_gitname
  fi
 
  msg "GIT checkout done or server timeout"
 
  cd $srcdir/${_gitname}
  patch -Np1 -i "$srcdir/crashfix.patch"
  mkdir build
  cd build
  cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`
  make all
}
 
package() {
  mkdir -p $pkgdir/usr/lib/kde4/
  mkdir -p $pkgdir/usr/share/kde4/services/
  mkdir -p $pkgdir/usr/share/doc/$pkgname
  mkdir -p $pkgdir/usr/share/kde4/apps/dreamdesktop/thumbs/
  
  chmod 755 $srcdir/${_gitname}/thumbs/default.png
  mv $srcdir/${_gitname}/build/lib/dreamdesktop.so $pkgdir/usr/lib/kde4/
  mv $srcdir/${_gitname}/dreamdesktop.desktop $pkgdir/usr/share/kde4/services/
  mv $srcdir/${_gitname}/README.ENGLISH $pkgdir/usr/share/doc/$pkgname/
  mv $srcdir/${_gitname}/thumbs/default.png $pkgdir/usr/share/kde4/apps/dreamdesktop/thumbs/
}

md5sums=('acd498b8ad87989469912f35ce396c9e')
