SUMMARY="An advanced audio player"
DESCRIPTION="Audacious is an open source audio player. A descendant of XMMS, \
Audacious plays your music how you want it, without stealing away your \
computer’s resources from other tasks.

Drag and drop folders and individual song files, search for artists and albums \
in your entire music library, or create and edit your own custom playlists. \
Listen to CD’s or stream music from the Internet. Tweak the sound with the \
graphical equalizer or experiment with LADSPA effects.
Enjoy the modern GTK-themed interface or change things up with Winamp Classic \
skins.

Install the Audacious Plugins package to fetch lyrics for your music, to set \
an alarm in the morning, and more."
HOMEPAGE="https://audacious-media-player.org/"
COPYRIGHT="2001-2021 Audacious developers and others"
LICENSE="BSD (2-clause)"
REVISION="2"
SOURCE_URI="https://github.com/audacious-media-player/audacious/archive/audacious-$portVersion.tar.gz"
CHECKSUM_SHA256="e2186130821b8d20d39104dbbf695102c99e95b579201caea1999459b7a05744"
SOURCE_DIR="audacious-audacious-$portVersion"
PATCHES="audacious-$portVersion.patchset"
ADDITIONAL_FILES="audacious.rdef.in"

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

PROVIDES="
	audacious$secondaryArchSuffix = $portVersion
	app:Audacious$secondaryArchSuffix = $portVersion
	lib:libaudcore$secondaryArchSuffix = 5.3.0 compat >= 5
	lib:libaudqt$secondaryArchSuffix = 2.3.0 compat >= 2
	lib:libaudtag$secondaryArchSuffix = 3.0.0 compat >= 3
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libarchive$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgmodule_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

PROVIDES_devel="
	audacious${secondaryArchSuffix}_devel = $portVersion
	devel:libaudcore$secondaryArchSuffix = 5.3.0 compat >= 5
	devel:libaudqt$secondaryArchSuffix = 2.3.0 compat >= 2
	devel:libaudtag$secondaryArchSuffix = 3.0.0 compat >= 3
	"
REQUIRES_devel="
	audacious$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libarchive$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autom4te
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python2
	"

BUILD()
{
	./autogen.sh
	runConfigure ./configure \
		--disable-gtk \
		--enable-qt \
		--disable-dbus \
		--enable-libarchive \
		--enable-valgrind
	make $jobArgs
true
}

INSTALL()
{
	mkdir -p $appsDir
	make install
	rm -rf $binDir/audacious
	cp src/audacious/audacious $appsDir/Audacious

	local APP_SIGNATURE="application/x-vnd.qt5-audacious"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="0"
	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/audacious.rdef.in > audacious.rdef

	addResourcesToBinaries audacious.rdef $appsDir/Audacious
	mimeset -f $appsDir/Audacious
	addAppDeskbarSymlink $appsDir/Audacious

	fixPkgconfig
	prepareInstalledDevelLibs libaudtag libaudqt libaudcore
	packageEntries devel $developDir

}
