# Maintainer (aur): chrisl echo archlinux@c2h0r1i2s4t5o6p7h8e9r-l3u4n1a.com|sed 's/[0-9]//g'
# Maintainer (aur): Dany Martineau <dany.luc.martineau gmail.com>
# Contributor:  Stefan Clarke <fm0nk3y@yahoo.co.uk>
# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697

pkgname=xwinwrap
pkgver=20090215
pkgrel=3
pkgdesc="Shantanu Goel's patched xwinwrap. Xwinwrap is a utility, originally written by David Reveman/Novell, that will embed movies or screensavers as wallpaper. It is under a custom but permissive license."
[ "$CARCH" = "i686"   ] && ARCH=i386
[ "$CARCH" = "x86_64" ] && ARCH=x86_64
arch=('i686' 'x86_64')
url="https://shantanugoel.com/2008/09/03/shantz-xwinwrap/"
license=('custom')
depends=(libxext libxrender)
provides=('xwinwrap')
conflicts=('xwinwrap')
makedepends=('make')
source=('https://bazaar.launchpad.net/~shantanu-goel/xwinwrap/devel/download/shantanu.goel%40gmail.com-20081018102932-9a50c8t7sa40ihkx/makefile-20080824172326-ckr2ck4kremspqqc-1/Makefile'
        'https://bazaar.launchpad.net/~shantanu-goel/xwinwrap/devel/download/shantanu.goel%40gmail.com-20090215112845-2e2mb6202tzwa4vb/xwinwrap.c-20080824172326-ckr2ck4kremspqqc-2/xwinwrap.c')
sha256sums=('3ff1e3627e17de1b520ce90b7c07c7c3b74d45e3a4eebbe78f37c426585e1585'
            '5614d40d80d5f0f2a67590b143adaf1e081d2e4ed722affd2b869e44fcaf9721')

prepare(){
  cd ${srcdir}
  sed -i "s/-lX11/$CPPFLAGS $CFLAGS -lX11/" Makefile
}

build() {
  cd ${srcdir}
  if [ "$CARCH" == "i686" ]; then
    make all32 || return 1
  else
    make all64 || return 1
  fi
}
package() {
  cd ${srcdir}
  install -D -m0755 ${srcdir}/$ARCH/xwinwrap ${pkgdir}/usr/bin/xwinwrap
  head -n43 xwinwrap.c >> LICENSE
  install -D LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
