# Template file for 'mednafen'
pkgname=mednafen
version=1.22.2
revision=2
wrksrc="$pkgname"
build_style=gnu-configure
configure_args="--with-libsndfile --enable-alsa $(vopt_enable altivec)
 ac_cv_sizeof_off_t=8"
hostmakedepends="automake pkg-config libtool gettext-devel"
makedepends="libsndfile-devel glu-devel SDL2-devel zlib-devel"
short_desc="Portable, argument(command-line)-driven multi-system emulator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://mednafen.github.io/"
distfiles="https://mednafen.github.io/releases/files/mednafen-${version}.tar.xz"
checksum=fad433ac694696d69ea38f6f4be1d0a6c1aa3609ec7f46ce75412be2f2df2f95
nopie=yes

build_options="altivec"
desc_option_altivec="Enable AltiVec support on PowerPC"

case "$XBPS_TARGET_MACHINE" in
	ppc64*) build_options_default="altivec";;
	*) ;;
esac

pre_configure() {
	# otherwise it tries to call aclocal-1.14 which we don't have
	./autogen.sh

	export CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
	export CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
}

pre_build() {
	# XXX not sure what's going on with those asserts.
	sed -i '/assert/d' src/hash/sha{1,256}.cpp
}
