# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit git-r3
DESCRIPTION="A DeaDBeeF plugin for playing streaming video game music using vgmstream"
HOMEPAGE="https://github.com/jchv/deadbeef-vgmstream"
EGIT_REPO_URI="https://github.com/jchv/${PN}.git"
LICENSE="vgmstream"
SLOT="0"
DEPEND_COMMON="
media-sound/deadbeef
media-libs/libvorbis
media-sound/mpg123"
RDEPEND="${DEPEND_COMMON}"
DEPEND="${DEPEND_COMMON}"
src_prepare(){
sed \
-e "s|-I\$(DEADBEEF_ROOT)/include|-I/usr/include/deadbeef|" \
-e "s|-I\$(DEADBEEF_ROOT)/lib|-I/usr/$(get_libdir)/deadbeef|" \
-i Makefile || die "sed fail"
default
}
src_compile() {
# The bundled vgmstream sources link into a shared object, so every
# TU needs -fPIC; upstream's Makefile doesn't force it and binutils
# rejects the final link without it. # verified 2026-07-06
emake CFLAGS="${CFLAGS} -fPIC"
}
src_install(){
insinto /usr/$(get_libdir)/deadbeef
doins vgm.so
}