# Template file for 'stella'
pkgname=stella
version=5.1.2
revision=1
build_style=gnu-configure
makedepends="SDL2-devel glu-devel libpng-devel zlib-devel"
short_desc="A multi-platform Atari 2600 VCS Emulator"
maintainer="Diogo Leal <diogo@diogoleal.com>"
license="GPL-2"
homepage="https://stella-emu.github.io/"
distfiles="https://github.com/stella-emu/stella/releases/download/${version}/stella-${version}-src.tar.xz"
checksum=77b210d51af7e4be88c14014d507e48367bcdff6b8ba513793f035f3e30a21bd

post_extract() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)
		sed -i 's/::PAGE_SIZE/::_PAGE_SIZE/g' $(grep -r '::PAGE_SIZE' -l)
		sed -i 's/PAGE_SIZE/_PAGE_SIZE/g' src/emucore/MT24LC256.[ch]xx \
			src/emucore/System.hxx
	;;
	esac
}

do_configure() {
	./configure --prefix=/usr
}

do_install() {
	make DESTDIR=$DESTDIR install
	vbin stella
}
