# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Taner Tas <taner76@gmail.com>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=deadbeef
pkgver=1.9.5
pkgrel=4
pkgdesc="fairly capable playlist-oriented audio player"
url="https://deadbeef.sourceforge.net/"
# armhf, riscv64: blocked by libdispatch-dev
# s390x: fails to build
arch="all !s390x !armhf !riscv64"
license="Zlib GPL-2.0-or-later LGPL-2.1-or-later"
depends="desktop-file-utils hicolor-icon-theme"
depends_dev="
	alsa-lib-dev
	curl-dev
	ffmpeg-dev
	flac-dev
	gtk+3.0-dev
	jansson-dev
	libdispatch-dev
	libmad-dev
	libsamplerate-dev
	libsndfile-dev
	libvorbis-dev
	libzip-dev
	opusfile-dev
	zlib-dev
	"
makedepends="
	$depends_dev
	bsd-compat-headers
	clang
	gettext
	intltool
	yasm
	"
subpackages="$pkgname-dev $pkgname-lang $pkgname-doc"
source="https://downloads.sourceforge.net/sourceforge/deadbeef/deadbeef-$pkgver.tar.bz2
	lfs64.patch
	strdupa.patch
	use-endian-h.patch
	"
options="!check" # No test suite

prepare() {
	default_prepare
	update_config_sub
	update_config_guess
}

build() {
	case "$CARCH" in
		x86)
			build_options="--disable-soundtouch --disable-ffap"
		;;
	esac

	LDFLAGS=-lintl \
	CC=clang \
	CFLAGS="$CFLAGS -Wno-error" \
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-oss \
		--disable-static \
		--disable-libretro \
		$build_options
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
c7a15f47fd8081a363e5cba732aa4ff4b1c311408728fbc5f7f47cf349bc112274a1d9fe0df8a58f09abf8f7656d914fb1baafa38fdf4dcb38fae7e1f70f682c  deadbeef-1.9.5.tar.bz2
50020326ae5b99be5c5b9517d43ffb2b0e5c0add0945b99aaa7b88725bd27b7c683a791335e38471e83025204bd4ef125d0d9a7b91207489ff7ad45b7c8437df  lfs64.patch
902c65cc5fd39f9935080a7f5df6d7c17fb366706501957a6b54d796f1b7b64a03fed64f93c9149d9332c4638de35254d526c031af0cd12674efb8d25dff31e1  strdupa.patch
9d933a33c6d78d66d4b6cb448aaeaf60b79e6269ce1c48e314b135f79779cdeb4e541b4c10c8666010b488e10108d0154a84835115933a8c6677f066044a1197  use-endian-h.patch
"
