# Description: A sample multi-channel audio mixer library.
# URL: https://github.com/libsdl-org/SDL_mixer
# Maintainer: John McQuah, jmcquah at disroot dot org
# Depends on: libvorbis libmodplug flac libsdl2 mpg123
# Optional: fluidsynth opusfile

name=sdl2_mixer
version=2.6.3
release=2
source=(https://github.com/libsdl-org/SDL_mixer/releases/download/release-$version/SDL2_mixer-$version.tar.gz)

build() {
	prt-get isinst fluidsynth \
		|| PKGMK_SDLMIX="-D SDL2MIXER_MIDI_FLUIDSYNTH=OFF"
	prt-get isinst opusfile \
		|| PKGMK_SDLMIX+=" -D SDL2MIXER_OPUS=OFF"
	cmake -S SDL2_mixer-$version -B build -G Ninja \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D CMAKE_INSTALL_LIBDIR=lib \
		-D CMAKE_BUILD_TYPE=Release \
		-D CMAKE_C_FLAGS_RELEASE="$CFLAGS" $PKGMK_SDLMIX

	ninja -C build -j ${JOBS:-1}
	DESTDIR=$PKG ninja -C build install

	# delete installed license.txt
	rm -rf $PKG/usr/share
}
