# Template file for 'clementine'
pkgname=clementine
version=1.4.0rc1
revision=1
_fullver=$version-343-gb49afcc5b
wrksrc=${pkgname}-${_fullver}
build_style=cmake
configure_args="-DUSE_SYSTEM_TAGLIB=ON -DBUILD_WERROR=OFF -DUSE_SYSTEM_PROJECTM=ON"
hostmakedepends="gettext sparsehash pkg-config qt5-qmake qt5-host-tools protobuf"
makedepends="chromaprint-devel boost-devel gst-plugins-base1-devel
 qt5-devel glew-devel sqlite-devel protobuf-devel libplist-devel
 libusbmuxd-devel libmtp-devel libcdio-devel pulseaudio-devel glu-devel
 taglib-devel crypto++-devel
 libgpod-devel libmygpo-qt-devel qt5-x11extras-devel qt5-plugin-mysql
 qt5-plugin-pgsql qt5-plugin-sqlite qt5-plugin-tds qt5-plugin-odbc
 qt5-tools-devel liblastfm-qt5-devel libechonest-qt5-devel projectM-devel"
depends="desktop-file-utils"
short_desc="Modern music player and library organizer"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-3.0-or-later"
homepage="https://www.clementine-player.org/"
distfiles="https://github.com/clementine-player/Clementine/releases/download/${_fullver}/${pkgname}-${_fullver}.tar.xz"
checksum=e1fa2482b81336282a36a5451a0217c274e5b45aa3eeed83fe3fd29a5df59397

# Liberation
# Some code has been taken and modified from:
# https://git.parabola.nu/abslibre.git/tree/libre/clementine/PKGBUILD
post_patch() {
	# remove nonfree artwork for the Nyan Cat plugin
	# https://labs.parabola.nu/issues/329
	rm -v data/nyancat.png

	# remove Spotifyblob files
	rm -rv ext/{$pkgname-spotifyblob,lib${pkgname}-spotifyblob}

	# remove Spotify files
	rm -rv src/internet/spotify
	rm -v data/icons/svg/spotify.svg
	rm -v data/providers/{22x22,32x32,48x48}/spotify.png
	rm -v data/spotify-attribution.png
	rm -v data/clementine-spotify-public.pem
	rm -v cmake/SpotifyVersion.cmake
	rm -v data/schema/schema-30.sql
	rm -v src/globalsearch/spotifysearchprovider.{cpp,h}

	# move free Nyan Cat replacement mascot (MooGNU) to the source code
	# https://labs.parabola.nu/issues/329
	install -m644 -v ${FILESDIR}/moognu.png data

	# create a blank file because it's a dependency for Clementine
	touch data/schema/schema-30.sql
}

post_install() {
	rm -rf $DESTDIR/builddir
}

# Liberation
# "clementine-spotify" package has been removed due to being nonfree
