# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=scrot
pkgver=0.8.13
pkgrel=0
pkgdesc="A simple command-line screenshot utility for X"
url="http://linuxbrit.co.uk/scrot/"
arch="all"
license="MIT"
subpackages="$pkgname-doc"
depends=
makedepends="giblib-dev imlib2-dev libx11-dev"
source="http://scrot.sourcearchive.com/downloads/${pkgver%.*}-${pkgver##*.}/${pkgname}_${pkgver%.*}.orig.tar.gz
http://scrot.sourcearchive.com/downloads/${pkgver%.*}-${pkgver##*.}/${pkgname}_${pkgver%.*}-${pkgver##*.}.debian.tar.gz"

prepare() {
	for patch in $(<$srcdir/debian/patches/series); do
		patch -p1 -d $srcdir/$pkgname-${pkgver%.*} -i $srcdir/debian/patches/$patch || return 1
	done
}
build() {
	cd "$srcdir"/$pkgname-${pkgver%.*}
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		|| return 1
	make || return 1
}

package() {
	cd "$srcdir"/$pkgname-${pkgver%.*}
	make DESTDIR="$pkgdir" docsdir=/usr/share/doc/scrot install || return 1
	install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
md5sums="ccae904d225609571bdd3b03445c1e88  scrot_0.8.orig.tar.gz
8b725c26660abc1ffd613903f2d7b0c2  scrot_0.8-13.debian.tar.gz"
sha256sums="613d1cf524c2b62ce3c65f1232ea4f05c7daf248d5e82ff2a6892c98093994f2  scrot_0.8.orig.tar.gz
508bb60c9f476d593a49ca0f1bbe0b3d5a742289146c5b33033435fc286e2376  scrot_0.8-13.debian.tar.gz"
sha512sums="cba8f589e45758ddbfe4e276399a1ecb0dbe29569be5d85d97733e7f64de2911bd2d03e62700ad0c718a1fc886c2e3def9dee1de5cac884f9e65e772cebe838c  scrot_0.8.orig.tar.gz
3f6d0a8e592088af38a3d90394b6b7246430479f5b0c8451af5eae383725d1896dc4bbf595495f9f2b546f00ef38780123c4ee0e3f06971c55a6ac2dfa5b7d53  scrot_0.8-13.debian.tar.gz"
