#Maintainer: George Vlahavas (vlahavas~at~gmail~dot~com)

pkgname=icewm
pkgver=1.2.37
pkgrel=1gv
arch=i486
source=("http://prdownloads.sourceforge.net/icewm/icewm-$pkgver.tar.gz" icewm.desktop xinitrc.icewm menu toolbar "http://pnboy.pinguix.com/gapan/icelooks/icelooks-1.1.tar.gz" FriendsAreLikeBrothers.jpg)
docs=("readme*" "install" "copying" "changelog" "authors" "news" "todo" "maintainers" "version" "platforms" "changes" "bugs" "icewm*.html")
url=http://www.icewm.org/
options=('noautodotnew')

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"icewm is a window manager for the X Window System"
"The goal of IceWM is speed, simplicity, and not getting in the user's"
"way. It is able to emulate the looks of Motif, OS/2, and Windows, and"
"allows you to have a customizable look using pixmaps."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --enable-gradients --enable-antialiasing --enable-corefonts --enable-guievents --with-icesound=ESound
	make || return 1
	make install DESTDIR=$startdir/pkg

	rm -f $startdir/pkg/usr/share/icewm/{menu,toolbar}
	cp $startdir/src/menu $startdir/pkg/usr/share/icewm
	cp $startdir/src/toolbar $startdir/pkg/usr/share/icewm
	sed -i "s/# DesktopBackgroundCenter=0/DesktopBackgroundCenter=1/" $startdir/pkg/usr/share/icewm/preferences
	sed -i "s/# SupportSemitransparency=\(.*\)/SupportSemitransparency=1/" $startdir/pkg/usr/share/icewm/preferences
	sed -i "s|# DesktopBackgroundColor=\(.*\)|DesktopBackgroundColor=\"rgb:FF/FF/FF\"|" $startdir/pkg/usr/share/icewm/preferences
	sed -i "s|# DesktopBackgroundImage=\"\"|DesktopBackgroundImage=\"/usr/share/icewm/wallpapers/FriendsAreLikeBrothers.jpg\"|" $startdir/pkg/usr/share/icewm/preferences
	mkdir -p $startdir/pkg/usr/share/icewm/wallpapers
	cp $startdir/src/FriendsAreLikeBrothers.jpg $startdir/pkg/usr/share/icewm/wallpapers
	mkdir -p $startdir/pkg/usr/man/man1
	cp $startdir/src/$pkgname-$pkgver/doc/icewm.1.man $startdir/pkg/usr/man/man1/icewm.1
	mkdir -p $startdir/pkg/usr/share/xsessions
	mv $startdir/src/icewm.desktop $startdir/pkg/usr/share/xsessions
	mkdir -p $startdir/pkg/etc/X11/xinit
	mv $startdir/src/xinitrc.icewm $startdir/pkg/etc/X11/xinit
	chmod 755 $startdir/pkg/etc/X11/xinit/xinitrc.icewm
	mv $startdir/src/icelooks $startdir/pkg/usr/share/icewm/themes
	echo "Theme=icelooks/default.theme" > $startdir/pkg/usr/share/icewm/theme
	chown -R root:root $startdir/pkg
}