# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bsm-simple-themes
pkgver=1.3
_ver=${pkgver/./}
pkgrel=2
pkgdesc="BSM Simple GTK Themes"
url="http://gnome-look.org/content/show.php/?content=121685"
arch="noarch"
license="GPL"
depends="gtk-engines-clearlooks faenza-icon-theme"
makedepends=""
install=""
subpackages="$pkgname-xfwm4 $pkgname-metacity"
#source="http://gnome-look.org/CONTENT/content-files/121685-BSM%20Simple%20$_ver.tar.gz
source="http://distfiles.alpinelinux.org/distfiles/121685-BSM%2520Simple%252013.tar.gz
	bsm-simple-panel.patch
	bsm-simple-xfwm.patch"

_builddir="$srcdir"
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
}

package() {
	cd "$_builddir"
	# fix permissions
	find . -type d -exec chmod 755 '{}' \;
	find . -type f -exec chmod 644 '{}' \;
	mkdir -p "$pkgdir"/usr/share/themes
	for i in *; do
		[ -L "$i" ] && continue
		cp -ra "$i" "$pkgdir"/usr/share/themes/ || return 1
	done
}

xfwm4() {
	pkgdesc="BSM Simple GTK Themes - xfwm4"
	install_if="$pkgname=$pkgver-r$pkgrel xfwm4"
	cd "$pkgdir"
	find . -name 'xfwm4' -type d | while read dir; do
		mkdir -p "$subpkgdir/${dir%/*}"
		mv "$dir" "$subpkgdir/${dir%*}"
	done
}

metacity() {
	pkgdesc="BSM Simple GTK Themes - metacity"
	install_if="$pkgname=$pkgver-r$pkgrel metacity"
	cd "$pkgdir"
	find . -name 'metacity-?' -type d | while read dir; do
		mkdir -p "$subpkgdir/${dir%/*}"
		mv "$dir" "$subpkgdir/${dir%*}"
	done
}

md5sums="26ba7fd532b8811e77a041ce8bacf79f  121685-BSM%2520Simple%252013.tar.gz
397bb9e05136048d64f5c4e629434245  bsm-simple-panel.patch
ae6887234cee7e18330f6f2fc79b65be  bsm-simple-xfwm.patch"
sha256sums="c38466dc422ed58518001f4b8f7b5e5adb124e7180e6815604592556d18d2ab0  121685-BSM%2520Simple%252013.tar.gz
9ea99e560aac8535be06da6d3382101f88652a8e990e38547f96f814118194e3  bsm-simple-panel.patch
5d7c326267e64bb4f9e15a8c72025543780dd70026c91b54b082d98bfd876a0b  bsm-simple-xfwm.patch"
sha512sums="4254ccdb2869a1caefbac9f9b1bffa6f5bc0a3ba64989d198cd2154d23e5e725dd8f408b17bb37d56eaef6ce74660d29b1167d99b91df7480ddf649957449adb  121685-BSM%2520Simple%252013.tar.gz
84ad713a7a5850b970a96e97d6c71b81e127a02caead429b71cd50868bfdfce6d327ed113aca40f7a4d4ccfd18f48a84ec27dcbc2af6fe0cbbb47e207ad41e47  bsm-simple-panel.patch
8f015a39d06d6713d75d872fba1139cf734a7ea6af272e198cbc0192148c5eabed3828902a608aa83b2661fc92159057508a9e792f7032680c6f728325b6792f  bsm-simple-xfwm.patch"