SUMMARY="A music player and music collection organizer"
DESCRIPTION="Strawberry is a music player and music collection organizer. It \
is a fork of Clementine released in 2018 aimed at music collectors and \
audiophiles.

Main features:

* smart and dynamic playlists in multiple formats
* album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer, \
Tidal, Qobuz and Spotify
* song lyrics from AudD AudD, Genius, Musixmatch, ChartLyrics, lyrics.ovh and \
lololyrics.com
* get tags from MusicBrainz
* edit tags
* audio equalizer
* audio analyzer
* transcode to multiple audio formats
* stream internet radio for Subsonic-compatible servers"
HOMEPAGE="https://www.strawberrymusicplayer.org/"
COPYRIGHT="2003-2005 Mark Kretschmann
	2003-2005 Max Howell
	2005 Jakub Stachowski
	2005 Gábor Lehel
	2006 Paul Cifarelli
	2009-2015 David Sansome
	2010 Andrea Decorte
	2010-2014 John Maguire
	2011 Joachim Bengtsson
	2011 Tyler Rhodes
	2011 Mike McQuaid
	2012 Arnaud Bienner
	2013-2021 Jonas Kvinge
	2014 Alibek Omarov
	2014 Krzysztof Sobiecki
	2014-2015 Mark Furneaux
	2015 Arun Narayanankutty
	2015-2020 Itay Grudev
	2016 Valeriy Malov
	2017 Santiago Gil
	2018 Vikram Ambrose"
LICENSE="GNU GPL v3"
REVISION="3"
SOURCE_URI="https://github.com/strawberrymusicplayer/strawberry/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="0d2d22fae7569944ae38b46ec8c0ff97950bca2a4c939eb25ac69d68d7357169"
SOURCE_FILENAME="strawberry-$portVersion.tar.gz"
ADDITIONAL_FILES="strawberry.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	strawberry$secondaryArchSuffix = $portVersion
	cmd:strawberry = 1.0
	cmd:strawberry_tagreader =$portVersion
	app:Strawberry = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libcdio$secondaryArchSuffix
	lib:libchromaprint$secondaryArchSuffix
	lib:libfftw3$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libgstreamer_1.0$secondaryArchSuffix
	lib:libgstapp_1.0$secondaryArchSuffix
	lib:libgstaudio_1.0$secondaryArchSuffix
	lib:libgstbase_1.0$secondaryArchSuffix
	lib:libgstpbutils_1.0$secondaryArchSuffix
	lib:libgsttag_1.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libmtp$secondaryArchSuffix
	lib:liborc_0.4$secondaryArchSuffix
	lib:libprotobuf$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Concurrent$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix >= 1.70.0
	devel:libcdio$secondaryArchSuffix
	devel:libchromaprint$secondaryArchSuffix
	devel:libfftw3$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgobject_2.0$secondaryArchSuffix
	devel:libgio_2.0$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libgstreamer_1.0$secondaryArchSuffix
	devel:libgstapp_1.0$secondaryArchSuffix
	devel:libgstaudio_1.0$secondaryArchSuffix
	devel:libgstbase_1.0$secondaryArchSuffix
	devel:libgstpbutils_1.0$secondaryArchSuffix
	devel:libgsttag_1.0$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libmtp$secondaryArchSuffix
	devel:liborc_0.4$secondaryArchSuffix
	devel:libprotobuf$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Concurrent$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:linguist$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DUSE_TAGLIB=ON
	make -C build
}

INSTALL()
{
	make -C build install

	mkdir -p $appsDir $manDir
	mv $prefix/bin/strawberry $appsDir/Strawberry
	mv $prefix/share/man/man1 $manDir
	rm -rf $prefix/share

	# prepare the rdef file
	local APP_SIGNATURE="application/x-vnd.strawberry"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local LONG_INFO="$SUMMARY"

	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/strawberry.rdef.in > $portDir/strawberry.rdef

	addResourcesToBinaries $portDir/strawberry.rdef $appsDir/Strawberry
	addAppDeskbarSymlink $appsDir/Strawberry
}
