# Template file for 'clementine'
pkgname=clementine
version=1.3.1
revision=16
patch_args="-Np1"
build_style=cmake
hostmakedepends="sparsehash pkg-config qt-host-tools qt-devel protobuf-c"
makedepends="chromaprint-devel boost-devel gst-plugins-base1-devel liblastfm-devel
 qt-webkit-devel glew-devel qjson-devel sqlite-devel protobuf-devel libplist-devel
 libusbmuxd-devel libmtp-devel libcdio-devel qca-devel pulseaudio-devel glu-devel
 taglib-devel crypto++-devel $(vopt_if spotify libspotify-devel) libechonest-devel
 libgpod-devel"
depends="desktop-file-utils"
short_desc="A modern music player and library organizer"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-3"
homepage="https://www.clementine-player.org/"
wrksrc="Clementine-${version}"
distfiles="https://github.com/clementine-player/Clementine/archive/${version}.tar.gz"
checksum=f885931a9ab7c88607d07b50c64fcce46fc05f13dd2c0a04188c94eff938f37c

build_options="spotify"

case "$XBPS_TARGET_MACHINE" in
	x86_64 | i686 | armv7l)
		build_options_default="spotify";;
	*)
		build_options_default="";;
esac

subpackages="$(vopt_if spotify clementine-spotify)"

pre_configure() {
	sed -i 's|-Wno-unused-private-field||g' src/CMakeLists.txt ext/clementine-spotifyblob/CMakeLists.txt
	sed -i 's|-Wno-unknown-warning-option||g' src/CMakeLists.txt ext/clementine-spotifyblob/CMakeLists.txt
	sed -i 's|AMAZON_CLOUD_DRIVE OFF|AMAZON_CLOUD_DRIVE ON|g' CMakeLists.txt
	sed -i 's;if (fs == NULL);if (!fs);' 3rdparty/libprojectm/MilkdropPresetFactory/Parser.cpp
}

post_install() {
	$(vopt_if spotify rm\ -r\ $DESTDIR/builddir)
}

clementine-spotify_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - spotify extension"
	repository="nonfree"
	pkg_install() {
		vmove usr/bin/clementine-spotifyblob
	}
}
