#Maintainer: Dimitris Tzemos <djemos(at)slackel.gr>

pkgname=clementine
pkgver=1.0.1
pkgrel=1rl
source=("http://clementine-player.googlecode.com/files/clementine-$pkgver.tar.gz" "fresh-start.patch" "clementine-fix-albumcoverfetch-crash.patch" "imobiledevice.patch" "liblastfm.patch" "linguas.patch")
sourcetemplate=http://people.salixos.org/djemos/salix/$pkgname
url="http://www.clementine-player.org/"
docs=('COPYING' 'ChangeLog' 'TODO')

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (music player)"
"Clementine is a multiplatform music player. It is inspired by Amarok"
"1.4, focusing on a fast and easy-to-use interface for searching and"
"playing your music."
)

build() {
	# how many build jobs?
	JOBS="-j$(($(getconf _NPROCESSORS_ONLN)*2))"
	NUMJOBS="${NUMJOBS:-"${JOBS}"}"

	cd $startdir/src/${pkgname}-${pkgver}
	patch -p0 < ../fresh-start.patch || return 1

   # http://code.google.com/p/clementine-player/issues/detail?id=2752
   patch -Np1 -i ../clementine-fix-albumcoverfetch-crash.patch || return 1
   patch -p0 < ../liblastfm.patch || return 1
   patch -p0 < ../linguas.patch || return 1
   
   # Use libimobiledevice new "udid" field instead of "uuid".
   patch -Np1 -i ../imobiledevice.patch || return 1

	mkdir build
	cd build
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DLIB_DIR=lib${LIBDIRSUFFIX} \
		-DLIB_SUFFIX=${LIBDIRSUFFIX} \
		-DMAN_INSTALL_DIR=/usr/man \
		-DENABLE_VISUALISATIONS=1 \
		-DENABLE_WIIMOTEDEV=0 \
		-DENGINE_GSTREAMER_ENABLED=1 \
		-DENGINE_LIBXINE_ENABLED=0 \
		-DENGINE_LIBVLC_ENABLED=0 \
		-DENGINE_QT_PHONON_ENABLED=0 \
		-DENABLE_LIBLASTFM=1 \
		..
	make $NUMJOBS || return 1
	make DESTDIR=$startdir/pkg/ install || return 1
}