# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=spice-gtk
pkgver=0.34
pkgrel=1
pkgdesc="A GTK+ widget for SPICE clients"
url="http://spice-space.org/page/Spice-Gtk"
arch="all"
license="LGPL-2.0-or-later"
depends=""
depends_dev="gtk+3.0-dev celt051-dev polkit-dev libxrandr-dev libressl-dev
	cyrus-sasl-dev gst-plugins-base-dev libjpeg-turbo-dev zlib-dev
	acl-dev lz4-dev"
makedepends="$depends_dev bash usbutils python2-dev eudev-dev phodav-dev
	usbredir-dev libusb-dev libsoup-dev spice-protocol
	polkit-dev py-parsing gobject-introspection-dev
	"
options="suid"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-tools
	spice-glib:glib"
source="http://www.spice-space.org/download/gtk/$pkgname-$pkgver.tar.bz2
	libressl.patch
	"
builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--with-gtk=3.0 \
		--with-audio=gstreamer \
		--enable-smartcard=no \
		--enable-usbredir=yes
	make
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
}

tools() {
	pkgdesc=""
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

glib() {
	pkgdesc=""
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*-glib-*.so* \
		"$pkgdir"/usr/lib/*controller.so.* \
		"$subpkgdir"/usr/lib/
}

sha512sums="17ea737511855b47f5eaf5143756483542cf8ee83f8d276cbfb2c0407355f68ed329fcbed8a67737179f3e53587710634d6faa856590234ee68be7b4b13f2689  spice-gtk-0.34.tar.bz2
3a5079767c29ee91d605faf2bbb3def052f285dc1e9999da16beb9b9e5307f580e5c6e5a01df6168eb2467ab9df32ea649a6a6cfd77a368f1868fcca84a097f5  libressl.patch"
