#Maintainer: Thorsten Muehlfelder <thenktor(at)gmx.de>
# SLKBUILD based on Zenwalk build script by Simone Antoniucci

pkgname=texmaker
pkgver=2.3
pkgrel=1tm
source=("http://www.xm1math.net/texmaker/texmaker-$pkgver.tar.bz2")
url="http://www.xm1math.net/texmaker"

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (cross-platform LaTeX editor)"
"texmaker is a free LaTeX editor, that integrates many tools needed to"
"develop documents with LaTeX, in just one application."
)

build() {
	
	cd $startdir/src/${pkgname}-${pkgver}
	qmake PREFIX=/usr texmaker.pro || exit 1
	sed -i 's|CFLAGS        =|CFLAGS       +=|' Makefile
	sed -i 's|CXXFLAGS      =|CXXFLAGS     +=|' Makefile
	make -j $numjobs || return 1
	make install INSTALL_ROOT=$startdir/pkg || return 1

	### Docs, man, info
	mv -v $startdir/pkg/usr/share/$pkgname/AUTHORS $startdir/pkg/usr/doc/$pkgname-$pkgver
	mv -v $startdir/pkg/usr/share/$pkgname/CHANGELOG.txt $startdir/pkg/usr/doc/$pkgname-$pkgver
	mv -v $startdir/pkg/usr/share/$pkgname/COPYING $startdir/pkg/usr/doc/$pkgname-$pkgver

	### Desktop entry
	mv -v $startdir/pkg/usr/share/$pkgname/$pkgname.desktop $startdir/pkg/usr/share/applications
	sed -i 's|Categories=Office;Publishing;Qt;X-SuSE-Core-Office;X-Mandriva-Office-Publishing;X-Misc;|Categories=Application;Office;|'\
		$startdir/pkg/usr/share/applications/$pkgname.desktop

	### Icon
	mkdir -pv $startdir/pkg/usr/share/icons/hicolor/{16x16,22x22,32x32,48x48,scalable}/apps
	mv -v $startdir/pkg/usr/share/$pkgname/$pkgname.svg $startdir/pkg/usr/share/icons/hicolor/scalable/apps/$pkgname.svg
	for SIZE in 16 22 32 48; do
		convert -resize ${SIZE}x${SIZE} \
			$startdir/pkg/usr/share/pixmaps/$pkgname.png \
			$startdir/pkg/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/$pkgname.png || return 1
	done
}