# Template file for 'deadbeef'
pkgname=deadbeef
version=1.8.7
revision=1
build_style=gnu-configure
configure_args="--disable-oss --disable-lfm --disable-notify --disable-gtk2"
hostmakedepends="automake libtool gettext gettext-devel intltool pkg-config
 yasm clang glib-devel"
makedepends="
 alsa-lib-devel dbus-devel faad2-devel ffmpeg-devel gtk+3-devel imlib2-devel
 jansson-devel libcddb-devel libcdio-devel libcurl-devel libflac-devel
 libmad-devel libpng-devel libsamplerate-devel libsndfile-devel libvorbis-devel
 libzip-devel mpg123-devel opusfile-devel pulseaudio-devel wavpack-devel"
depends="desktop-file-utils hicolor-icon-theme"
short_desc="Ultimate Music Player for GNU/Linux"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Zlib, GPL-2.0-or-later, LGPL-2.1-or-later"
_apbuild_commit=c64f490e54447e3902fae54784d01ab59fa7dc95
_mp4p_commit=f111d7aa10d4516f5e02465245e9202db83b7c10
homepage="https://deadbeef.sourceforge.io"
changelog="https://deadbeef.sourceforge.io/news0.html"
distfiles="https://github.com/DeaDBeeF-Player/deadbeef/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz
 https://github.com/DeaDBeeF-Player/apbuild/archive/${_apbuild_commit}.tar.gz>apbuild-${_apbuild_commit}.tar.gz
 https://github.com/DeaDBeeF-Player/mp4p/archive/${_mp4p_commit}.tar.gz>mp4p-${_mp4p_commit}.tar.gz"
checksum="cbfe873d5bd84b70011dd6131b249fea8c89318c37411696a890c55029ac3e27
 c5eeb3fa116d51d251fe7c7e5c44798680f6478c43a1fffdcb28c4caf1c68286
 35b58679dbfec2c3a2688b1896afb0fb73b5184ac05d5bdbb787a86b5c00430d"
LDFLAGS+=" -Wl,-z,stack-size=1048576"

# The soundtouchup plugin was made default in 1.8.4 and fails to build on i686.
# Fixing that might be a good maintainer task.
case "$XBPS_TARGET_MACHINE" in
	i686*) configure_args+=" --disable-soundtouch" ;;
esac

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	makedepends+=" musl-legacy-compat"
fi

post_extract() {
	rm -rf external/apbuild
	rm -rf external/mp4p
	mv -v ../apbuild-${_apbuild_commit} external/apbuild
	mv -v ../mp4p-${_mp4p_commit} external/mp4p
}

pre_configure() {
	NOCONFIGURE=1 ./autogen.sh
}

post_install() {
	vlicense COPYING
}

deadbeef-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
	}
}
