# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
setvar pkgname = 'libcanberra'
setvar pkgver = '0.30'
setvar pkgrel = '1'
setvar pkgdesc = ""simple audio library for GTK applications""
setvar url = ""http://0pointer.de/lennart/projects/libcanberra/""
setvar license = ""LGPL""
setvar depends = ''
setvar makedepends = ""gtk+-dev libogg-dev libvorbis-dev alsa-lib-dev libtool gtk+3.0-dev""
setvar install = ''
setvar subpackages = ""$pkgname-dev $pkgname-doc $pkgname-gtk2 $pkgname-gtk3""
setvar source = ""http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz""
setvar arch = ""all""

setvar depends_dev = "$makedepends"

setvar _builddir = ""$srcdir"/$pkgname-$pkgver"

proc prepare {
	cd $_builddir
	update_config_sub || return 1
}

proc build {
	cd $_builddir
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1
	make || return 1
}

proc package {
	cd $_builddir
	make -j1 DESTDIR="$pkgdir" install || return 1
}

proc gtk2 {
	setvar pkgdesc = ""Gtk+ 2.x Bindings for libcanberra""
	mkdir -p "$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/lib/libcanberra-gtk.so.* \
		"$subpkgdir"/usr/lib/ || return 1
	mv "$pkgdir"/usr/lib/gtk-2.0 \
		"$subpkgdir"/usr/lib/ || return 1
}

proc gtk3 {
	setvar pkgdesc = ""Gtk+ 3.x Bindings for libcanberra""
	mkdir -p "$subpkgdir"/usr/lib/gnome-settings-daemon-3.0/gtk-modules \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/share/gnome/autostart \
		"$subpkgdir"/usr/share/gnome/shutdown \
		"$subpkgdir"/usr/share/gdm/autostart/LoginWindow || return 1
	mv "$pkgdir"/usr/lib/gtk-3.0 \
		"$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/lib/libcanberra-gtk3.so.* \
		"$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/bin/canberra-gtk-play \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/share/gnome/autostart/libcanberra-login-sound.desktop \
		"$subpkgdir"/usr/share/gnome/autostart || return 1
	mv "$pkgdir"/usr/share/gnome/shutdown/libcanberra-logout-sound.sh \
		"$subpkgdir"/usr/share/gnome/autostart/ || return 1
	mv "$pkgdir"/usr/share/gdm/autostart/LoginWindow/libcanberra-ready-sound.desktop \
		"$subpkgdir"/usr/share/gdm/autostart/LoginWindow/ || return 1
	mv "$pkgdir"/usr/lib/gnome-settings-daemon-3.0/gtk-modules/canberra-gtk-module.desktop \
		"$subpkgdir"/usr/lib/gnome-settings-daemon-3.0/gtk-modules/ || return 1
}

setvar sha512sums = ""f7543582122256826cd01d0f5673e1e58d979941a93906400182305463d6166855cb51f35c56d807a56dc20b7a64f7ce4391368d24990c1b70782a7d0b4429c2  libcanberra-0.30.tar.xz""